Android Question Why I can't Use Activity_Resume

lamsri799

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

thank for help:
 

lamsri799

Member
Licensed User
Longtime User
When i use
B4X:
Sub Activity_Resume
Activity_Create(True)
End Sub
my application is Error!
150620062624.jpg
 
Upvote 0

RandomCoder

Well-Known Member
Licensed User
Longtime 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?
 
Upvote 0

lamsri799

Member
Licensed User
Longtime 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 ?
 
Upvote 0

RandomCoder

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

lamsri799

Member
Licensed User
Longtime 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***
 
Upvote 0

mangojack

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

lamsri799

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

Similar Threads

Replies
2
Views
233
D
  • Question
Android Question Activity_Resume run 2 times
2 3 4
Replies
65
Views
8K
Deleted member 103
D
Top