Android Question Why I can't Use Activity_Resume

lamsri799

Member
Licensed User
why i can't use
B4X:
Sub Activity_Resume
Activity_Create(True)
End Sub
in activity with Custom List View ?

thank for help:
 

RandomCoder

Well-Known Member
Licensed User
It is not good to try and do this. I have seen that Activity_Resume can often fire twice on resuming the App and your suggested code would call Activity_Create which will no doubt trigger Activity Resume again.
As @LucaMs has already asked, why do you need to try this? Maybe there is a better way to achieve the same thing?
 

lamsri799

Member
Licensed User
Thank RandomCoder and Erel

when i Login app in frist ID i go to this activity and comback home to logout
when i login second ID and go to this activity but data is belong frist ID data not change
what should i do ?
 

RandomCoder

Well-Known Member
Licensed User
I think that I have understood @lamsri799 slightly differently... just use a Process Global to store which ID to load. Then when you start your Activity read in the Process Global and select the correct ID.
 

lamsri799

Member
Licensed User
Example:
i have Two activity
activity one for Insert data to database
activity two for select data from database to show in CustomListView
i start activity one but i don't Insert data. i Click button go to activity two I want to see data in CustomListView in activity Two
but i come back to activity one for Insert data When i insert data and i Click button go to activity two . data in CustomListView not Change , it don't have data that i added.
*** i see database it have data that i added***
 

mangojack

Well-Known Member
Licensed User
In Activity Two when / where do you load data into CustomListView.

In Activity Two maybe this ..
B4X:
Sub Activity_Resume

    CustomListView.Clear
  
    'Call Sub to reload all data from database ..
    ShowAllData

End Sub
In Activity One you could set Global Variable to signal if New records have been inserted ..
when starting activity two you could check this flag to see if you need to reload database or maybe just add the new records to your list.
 

lamsri799

Member
Licensed User
In Activity Two when / where do you load data into CustomListView.

In Activity Two maybe this ..
B4X:
Sub Activity_Resume

    CustomListView.Clear
 
    'Call Sub to reload all data from database ..
    ShowAllData

End Sub
In Activity One you could set Global Variable to signal if New records have been inserted ..
when starting activity two you could check this flag to see if you need to reload database or maybe just add the new records to your list.
i'm Test Follow the instructions
but error at Class Module CustomListView.
 
Top