Fixed change fragment crash on Android 4.x
This commit is contained in:
parent
0907fe2d5b
commit
e7f5c46529
@ -2,7 +2,6 @@ package org.itxtech.daedalus.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.VpnService;
|
||||
import android.os.Bundle;
|
||||
@ -56,20 +55,12 @@ public class MainFragment extends Fragment {
|
||||
});
|
||||
|
||||
updateUserInterface();
|
||||
mHandler = (new MainFragmentHandler()).setFragment(this);
|
||||
MainActivity.getInstance().setMainFragmentHandler(mHandler);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
if (context instanceof MainActivity) {
|
||||
mHandler = (new MainFragmentHandler()).setFragment(this);
|
||||
((MainActivity) context).setMainFragmentHandler(mHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
|
Loading…
Reference in New Issue
Block a user