Skip to content Skip to sidebar Skip to footer

Add Items To Listview Dynamically Android

How to take data that was typed in EditText and by clicking 'submit' in that window should add it to previous activity listview items? What I need to do is: Creating EditText and

Solution 1:

You could create a new class with a public static variable that holds the data which was submitted when you pressed the button. Then override the onResume() event of your previous activity, which will be called when you return to the activity, and add the data into the listview.

UPDATE:

publicclassGlobalVariable{
    publicstatic ArrayList<Object> exampleList = new ArrayList<Object>();
}

Then in your code:

GlobalVariable.exampleList.add(exampleObject);

Then in your previous activity:

protectedvoidonResume()
{
    // Put code to add to listview heresuper.onResume();
}

Post a Comment for "Add Items To Listview Dynamically Android"