-1
Guys I’m having this error when I try to share a bitmap via Intent on Android 7.0, I’ve researched enough and could not solve, so I saw Google itself has the recommendation to avoid the error https://developer.android.com/guide/topics/resources/runtime-changes.html but I could not understand the proposed solution or find another alternative.
This is the Google sample code, I didn’t understand the Datafragment class what it is.
public class MyActivity extends Activity {
private RetainedFragment dataFragment;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// find the retained fragment on activity restarts
FragmentManager fm = getFragmentManager();
dataFragment = (DataFragment) fm.findFragmentByTag(“data”);
// create the fragment and data the first time
if (dataFragment == null) {
// add the fragment
dataFragment = new DataFragment();
fm.beginTransaction().add(dataFragment, “data”).commit();
// load the data from the web
dataFragment.setData(loadMyData());
}
// the data is available in dataFragment.getData()
...
}
@Override
public void onDestroy() {
super.onDestroy();
// store the data in the fragment
dataFragment.setData(collectMyLoadedData());
}
}
what did you do? it would help if you showed the code...
– Daniel Gentil
I put the Google sample code I’m having the doubt.
– Neto Lobo