mirror of
https://github.com/stom79/exodus-android-app
synced 2024-12-23 09:48:42 +01:00
Save PackageInfo in the bundle in order to restore it after long time
This commit is contained in:
parent
ba6cd8c9a3
commit
62382b7559
@ -25,6 +25,7 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.PermissionInfo;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.view.LayoutInflater;
|
||||
@ -49,7 +50,7 @@ import java.util.Set;
|
||||
public class ReportFragment extends Fragment {
|
||||
|
||||
private PackageManager packageManager;
|
||||
private PackageInfo packageInfo;
|
||||
private PackageInfo packageInfo = null;
|
||||
private ReportBinding reportBinding;
|
||||
|
||||
public static ReportFragment newInstance(PackageManager packageManager, PackageInfo packageInfo) {
|
||||
@ -63,9 +64,17 @@ public class ReportFragment extends Fragment {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if(savedInstanceState != null && packageInfo == null) {
|
||||
packageInfo = savedInstanceState.getParcelable("PackageInfo");
|
||||
}
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
outState.putParcelable("PackageInfo", packageInfo);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
Loading…
Reference in New Issue
Block a user