Android Question Why I can't Use Activity_Resume

Discussion in 'Android Questions' started by lamsri799, Jun 19, 2015.

  1. lamsri799

    lamsri799 Member Licensed User

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

    thank for help:
     
  2. LucaMs

    LucaMs Expert Licensed User

    The question is: why do you need this strange kind of flow?
     
    mangojack likes this.
  3. lamsri799

    lamsri799 Member Licensed User

    When i use
    Code:
    Sub Activity_Resume
    Activity_Create(
    True)
    End Sub
    my application is Error!
    [​IMG]
     
  4. lamsri799

    lamsri799 Member Licensed User

    do you have Code for reload activity ?
     
  5. RandomCoder

    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?
     
    LucaMs likes this.
  6. Erel

    Erel Administrator Staff Member Licensed User

    You shouldn't (and don't need to) call Activity_Create.
     
  7. lamsri799

    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 ?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    If I understand correctly you can use CallSubDelayed to call a sub in the first activity from the second activity. In this sub update the fields that you need to update.
     
  9. RandomCoder

    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.
     
    Erel likes this.
  10. lamsri799

    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***
     
  11. lamsri799

    lamsri799 Member Licensed User

    but i'm Exit Application And start again it have data in CustomListView
     
  12. mangojack

    mangojack Well-Known Member Licensed User

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

    In Activity Two maybe this ..
    Code:
    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.
     
    RandomCoder likes this.
  13. klaus

    klaus Expert Licensed User

    Have a look at the SQLiteLight examples in my signature they do what you want to do.
     
    Last edited: Jun 21, 2015
    RandomCoder likes this.
  14. lamsri799

    lamsri799 Member Licensed User

    i'm Test Follow the instructions
    but error at Class Module CustomListView.
     
  15. lamsri799

    lamsri799 Member Licensed User

    Thank you
    Let's try
     
Loading...