Android Question New instance of an activity

alimanam3386

Active Member
Licensed User
Longtime User
Hi guys ,

How can I create new instance of an activity ? I want to create new activity of act2 and again when I clicked the activity again new instance of this activity create.

its my code but it not works

B4X:
Sub Activity_Click
    Dim Intent1 As Intent
    Intent1.Initialize("", "")
    Intent1.SetComponent(Application.PackageName & "/.act2")
    Intent1.PutExtra("key", Rnd(1,1000000))
    StartActivity(Intent1)
End Sub

I also put this line of code in manifest :
B4X:
SetActivityAttribute(act2, android:launchMode, "standard")
 

Attachments

  • 1.zip
    7.1 KB · Views: 340
Last edited:

alimanam3386

Active Member
Licensed User
Longtime User
thanks Erel , but I would like to create new instance of activity every time when I click on it ( just in this case only ) please have a look at this video :

in telegram when we click on any channel name , the telegram makes new activity for it again ,I want do exactly same action in my application ( it is a social networking app )


or in Instagram we have same role :

 
Last edited:
Upvote 0

alimanam3386

Active Member
Licensed User
Longtime User
Thank you Erel but when I touch back key the activity ( act2 ) destroyed , this is not my expectation.Assuming you clicked several times on a button , every time when you clicked on it must new activity ( act2 ) to be display and when the user click on back key the last activity ( of act2 ) finish but one before the last show again ( Exactly like the videos I showed )
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
workaround
how about to change the content from the activity.
instead of 100 activitys - 100 CustomViews inside and make this visible that user will see.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Assuming you clicked several times on a button , every time when you clicked on it must new activity ( act2 ) to be display and when the user click on back key the last activity ( of act2 ) finish but one before the last show again ( Exactly like the videos I showed )
You will need to use panels instead of activities and manage the stack of panels yourself.
 
Upvote 0
Top