Arraylist Become Null
I am getting id from previous activity,if id is null then i parse data and store it in arraylist,but if it is not null then i dont parse data and trying to set arraylist in listvie
Solution 1:
You have not set a LayoutManager
to your RecyclerView
:
use this to set LayoutManager
to your RecyclerView
:
mRecyclerView.setLayoutManager(newLinearLayoutManager(this));
in oncreate
Solution 2:
The problem is this part
if(filtrid!=null)
{
System.out.println("datacat null"+filterList);
mAdapter = new CardViewDataAdapter(filterList);
mRecyclerView.setAdapter(mAdapter);
}
You read the filtrid
but you don't initialize your filterList
in this case.
EDIT:
Retrieving the filtrid
from the intent extras is not the same as populating the filterList
. You could probably pass the filterList as JSON-String in the same way, you passed the filtrid
. Then parse the JSON-String as you did already in makeJsonArrayRequestCountry()
. A better way would be, to store the list persistent (SharedPreferences, SQL, ...), or don't store it at all. Just load the list from the server, whenever you start that activity.
Post a Comment for "Arraylist Become Null"