1
0
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:
Schoumi 2018-08-31 18:37:06 +02:00
parent ba6cd8c9a3
commit 62382b7559

View File

@ -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) {