Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 一旦数据被消耗,如何将bundle设置为null_Android_Performance_Android Fragments_Android Intent - Fatal编程技术网

Android 一旦数据被消耗,如何将bundle设置为null

Android 一旦数据被消耗,如何将bundle设置为null,android,performance,android-fragments,android-intent,Android,Performance,Android Fragments,Android Intent,我使用以下代码将数据从活动传递到片段 Bundle bundle= new Bundle(); bundle.putString("seatId", seatId); fragment.setArguments(bundle); 然后在片段中使用以下代码来使用数据 Bundle args = getArguments(); if(args!=null && args.getString("seatId")!=null){ matc

我使用以下代码将数据从活动传递到片段

    Bundle bundle= new Bundle();
    bundle.putString("seatId", seatId);
    fragment.setArguments(bundle);
然后在片段中使用以下代码来使用数据

Bundle args = getArguments();
    if(args!=null && args.getString("seatId")!=null){
        matchId = args.getString("seatId", "");
    }
在这之后,我想把bundle设置为null


问题是,一旦我将数据设置为通过bundle分割,它就会将其保留在那里。

抓住bundle,或者像前面所说的那样简单地
getArguments().clear()

覆盖bundle?我认为您无法做到这一点,也不认为您应该尝试删除它。你的应用程序在内存不足的情况下会以非常奇怪的方式崩溃。