0

I have a problem with updates my recyclerView. When I get unswer (it`s ArrayList with objects) in method onActivityResult I call the custom update method, where I update my ArrayList, but nothing happens... I try to do it like in this topic how to update RecyclerView element from OnActivityResult

It`s my code :

Parent`s activity :

ArrayList<Unswer> unswerFromMain;

@Override

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    //super.onActivityResult(requestCode, resultCode, data);

    if (data==null){
        Log.d("LOGO", "no unswer" );
        return;
    } else {


        unswerFromMain = (ArrayList<Unswer>) data.getSerializableExtra("aboutGROUPS");

        recyclerAdapter.updateAdapter(unswerFromMain);

    }

}

}

RecyclerAdapter class :

private ArrayList<Unswer> getUnswer = new ArrayList<>();

public void updateAdapter (ArrayList<Unswer> updateUnswer){

    getUnswer = updateUnswer;

    notifyDataSetChanged();
}
Community
  • 1
  • 1
Dem
  • 3
  • 2
  • 5
  • at what point are you setting the recyclerviews adapter and how do you update the data of the adapter? – Henning Luther Mar 06 '17 at 09:34
  • I setting custom View, which contain 3 TextView and 1 ImageButton.When somebody tap to ImageButton - start method startActivityForResult from adapter. After you changes field I update it. Updating start in method onActivityResult when I call method updateAdapter and put my new ArrayList – Dem Mar 06 '17 at 09:45

1 Answers1

0

Try

getUnswer.clear()
getUnswer.addAll(updateUnswer);

instead of

getUnswer = updateUnswer;
Rachit
  • 3,173
  • 3
  • 28
  • 45