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:
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:
public class GlobalVariable
{
public static ArrayList<Object> exampleList = new ArrayList<Object>();
}
Then in your code:
GlobalVariable.exampleList.add(exampleObject);
Then in your previous activity:
protected void onResume()
{
// Put code to add to listview here
super.onResume();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.