Sorry for my English. Before i load all data if user enter to apps, i use isynk task. But now i need use lazy load(example:instagram), if i have not internet i can see last post(image, text). if i drop down list, load new data. I cant understand how make this. This is my structure project now:
//this i load json
ArrayList<NewsObject> newsList;
ListView list;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//code
list = (ListView) findViewById(R.id.list);
newsList = new ArrayList<NewsObject>();
//code
//load data(json)
new NewsAsynkTask().execute();
}
public class NewsAsynkTask extends AsyncTask<String , Void, String> {
//code
protected String doInBackground(String... params) {
//this i add json to object,
//then i add in list object
newsList.add(newsObject);
}
protected void onPostExecute(String file_url) {
//adapter in game
NewsAdapter adapter = new NewsAdapter(getApplicationContext(), R.layout.n_news_list_object, newsList);
list.setAdapter(adapter);
}
}
And then adapter display all. I see example, but i cant understand how i get json, and then add in lazy load. Ples give me explain or simple lesson