I have three fragment in an Activity C. they are behaving as tabs. I have to go from a fragment to a new Activity X. Now i want to come back to fragment from Activity X.
This code works in my case. I just make an Onclick method to the button . the code is below:I made onclick method clickForFriends in Button and Id is backFriendsList, And I use android.support.v4.app.Fragment class. This method should take back from new Activity to the fragment from the Activity was launched and this method should be in the Activity after the onCreate method
public void clickedForFriends(View v){
if (v.getId() == R.id.backFriendsList){
onBackPressed();
}
}