How i can access ArrayList from one Activity to another and also clear ArrayList value?
Asked
Active
Viewed 558 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
- 28,933
- 23
- 88
- 140
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
- 28,933
- 23
- 88
- 140
Arpit Garg
- 8,296
- 6
- 33
- 59