Initially when the fragment
is loaded it has layout:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = null;
view = inflater.inflate(R.layout.authenticate, null);
return view;
}
Later in the fragment
I'm perfomring a functionality which will call startActivityForResult(intent, 1);
If the reponse is successful, I want to replace the layout of the fragment with another layout, say: R.layout.success
In onActivityResult()
what should I write.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Some code
if(success){
// WHAT TO CODE HERE TO REPLACE THE LAYOUT R.layout.authenticate TO R.layout.success
}
}