How i can access ArrayList from one Activity to another and also clear ArrayList value?
Asked
Active
Viewed 562 times
2 Answers
2
you can use setter/getter method for it.
public class MySetGet
{
private ArrayList aList = null;
public void setList ( ArrayList aList )
{
this.aList = a.List;
}
public ArrayList getList ()
{
return aList;
}
}
Now you can set its value from any Activity/Class and get its value from any Activity/Class.

Lucifer
- 29,392
- 25
- 90
- 143
1
The most simply and possible way to do the desired::
1.Create a simple public class say Data.. Now create a public static your Array list object.
Now access any where..
Data.listObj
2.Create the List object as public static in one activity and use in another via,
SecondActivity.listObj.clear();

Lucifer
- 29,392
- 25
- 90
- 143

Arpit Garg
- 8,476
- 6
- 34
- 59