E evbedp Member Licensed User Longtime User Feb 27, 2019 #1 Can i call same activity more than one time? same like in visual studio / VB, we can call form more than one time with declare the form to new form object. may i do that in B4A? I'm making an ecommerce application, when i click product image it will start activity detail of the product. inside detail of the product i have insert other products with horizontalscrollbar, when i click product in horizontalscrollbar it's will start same activity( detail of the product ). can i do that? because if i try application like aliexpress/alibaba, they application can do like that. StartActivity (List Product) -> Click (Product) -> Detail of the Product ( Inside Detail Have List Products ) -> Click (List Products) -> Detail of the Product (Again). When we press back it will back to previous detail of the product.
Can i call same activity more than one time? same like in visual studio / VB, we can call form more than one time with declare the form to new form object. may i do that in B4A? I'm making an ecommerce application, when i click product image it will start activity detail of the product. inside detail of the product i have insert other products with horizontalscrollbar, when i click product in horizontalscrollbar it's will start same activity( detail of the product ). can i do that? because if i try application like aliexpress/alibaba, they application can do like that. StartActivity (List Product) -> Click (Product) -> Detail of the Product ( Inside Detail Have List Products ) -> Click (List Products) -> Detail of the Product (Again). When we press back it will back to previous detail of the product.
DonManfred Expert Licensed User Longtime User Feb 27, 2019 #2 evbedp said: Can i call same activity more than one time? Click to expand... Simple answer: NO https://www.b4x.com/android/forum/threads/android-process-and-activities-life-cycle.6487/#content Upvote 0
evbedp said: Can i call same activity more than one time? Click to expand... Simple answer: NO https://www.b4x.com/android/forum/threads/android-process-and-activities-life-cycle.6487/#content
MarkusR Well-Known Member Licensed User Longtime User Feb 27, 2019 #3 you can remove the layout (at android views) (in .net controls/ui) and then you can load other layout (designer file) its also possible to load more than one layout in a single activity form. something like LoadLayout("Titlebar") LoadLayout("Product Overview") LoadLayout("Product Detail") LoadLayout("Product Costs") LoadLayout("Navigation") only one activity can be active at the same time. Upvote 0
you can remove the layout (at android views) (in .net controls/ui) and then you can load other layout (designer file) its also possible to load more than one layout in a single activity form. something like LoadLayout("Titlebar") LoadLayout("Product Overview") LoadLayout("Product Detail") LoadLayout("Product Costs") LoadLayout("Navigation") only one activity can be active at the same time.
E evbedp Member Licensed User Longtime User Feb 28, 2019 #4 thank you, i already got solution. i create 2 activity same code. if i click product in first activity (detail of the product), it will "StartActivity" to second activity. on second activity i change the code when i click product again in second activity it's just recreate activity. i'm use this code to recreate activity Code: Copy Sub RecreateActivity Log("RecreateActivity called") Dim JavaObject1 As JavaObject JavaObject1.InitializeContext JavaObject1.RunMethod("NativeRecreateActivity", Null) End Sub #If JAVA public void NativeRecreateActivity(){ this.recreate(); } #End If http://developer.android.com/reference/android/app/Activity.html#recreate() https://www.b4x.com/android/forum/threads/start-activity-from-the-same-activity.52347/#post-327832 thank you Upvote 0
thank you, i already got solution. i create 2 activity same code. if i click product in first activity (detail of the product), it will "StartActivity" to second activity. on second activity i change the code when i click product again in second activity it's just recreate activity. i'm use this code to recreate activity Code: Copy Sub RecreateActivity Log("RecreateActivity called") Dim JavaObject1 As JavaObject JavaObject1.InitializeContext JavaObject1.RunMethod("NativeRecreateActivity", Null) End Sub #If JAVA public void NativeRecreateActivity(){ this.recreate(); } #End If http://developer.android.com/reference/android/app/Activity.html#recreate() https://www.b4x.com/android/forum/threads/start-activity-from-the-same-activity.52347/#post-327832 thank you