public RecyclerView.OnScrollListener onScroll = new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
...
More();
}
};
public void More(){
new UpdateDataFromMongoDb().execute(CurrentSection);
}
protected class UpdateDataFromMongoDb extends AsyncTask{
protected void onPreExecute() {
super.onPreExecute();
swipeLayout.setRefreshing(true);
}
protected doInBackground() {
... Добавление к существующему списку
ListOfNews.add(cnews);
}
protected void onPostExecute() {
swipeLayout.setRefreshing(false);
adapter.notifyDataSetChanged();
}
}
private class MySimpleAdapter extends SimpleAdapter{
public MySimpleAdapter(Context context, List<? extends Map<String, ?>> data, int resource, String[] from, int[] to) {
super(context, data, resource, from, to);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout. item_contactslist, null);
}
HashMap<String, String> item = (HashMap<String, String>) ListOfContacts.getItemAtPosition(position);
if(item.get("name") != null){
name.setText(item.get("name"));
}else{
name.setText("NoNamed");
}
return v;
}
}