I have two activities an initial with a Listview and a FAB and a second one with editText, Save and Clear Buttons.
I call the second one the activity for result I enter my values and click Save Button. My list is not refreshed its displaying only the first element and I did the following
in the first activity
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
// check if the request code is same as what is passed here it is 2
if(requestCode==3)
{
player = mHelper.getPlayersByTeam(new_id);
if(player!=null && player.getCount()>0)
{
playerdataAdapter = new PlayerAdapter(this, player);
// Assign adapter to ListView
listPlayers.setAdapter(playerdataAdapter);
playerdataAdapter.notifyDataSetChanged();
playerdataAdapter.swapCursor(mHelper.getPlayersByTeam(new_id));
}
}
What I am doing wrong here? why listview not displaying the refreshed data
Check your database if you retrieve the proper records