Android Question Call Activity?

evbedp

Member
Licensed User
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.
 

MarkusR

Well-Known Member
Licensed User
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.
 

evbedp

Member
Licensed User
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
B4X:
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
 
Top