Reputation: 299
How to Call Same Activity From Intent in firebase onChildChange ?
@Override
public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
try {
Intent i= new Intent(PlaceholderFragment.this,PlaceholderFragment.this);
}
catch (Exception e){}
}
How to Call Same Activity From Intent?
Upvotes: 0
Views: 366
Reputation: 933
You can call same fragment from itself as follows.
PlaceholderFragment newFragment = new PlaceholderFragment();
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(R.id.layoutContainer, newFragment , "New Fragment");
fragmentTransaction.addToBackStack("New Fragment");
fragmentTransaction.commit();
Upvotes: 0
Reputation: 24012
Intent i = new Intent(getActivity, YourActivity.class);
i.startActivity();
Or you can simply use:
getActivity().recreate();
Upvotes: 1