android.os.TransactionTooLargeException on Nougat solved

Md. Masud Parvez
6 min readMar 2, 2018
Too Large Right!!!

Recently i was just working in a wallpaper application. In this application i have to maintain lot’s of data almost 1M in diffident category. For UI i am using sliding tab let 6 tabs.

Sliding Tab

So when i sweep from one tab to another tab and came to my previous tab. I was wondering my previous data was missing so i think why not i save data in my savedInstanceState using Parcelable ArrayList . So i write code for

this just implement Parcelable into my pojo class. Then i started to save data in my savedInstanceState. Like

@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
Bridge.saveInstanceState(this, outState);
ArrayList<WallpaperItem> wallpaperItems = adapter.getAllWallpaper();
if (wallpaperItems!=null){
outState.putParcelableArrayList(Constant.SAVE_INTO_ALL_WALLPAPER , wallpaperItems);
}
}

and i was retrieving data like..

if (savedInstanceState!=null){
if (savedInstanceState.containsKey(Constant.SAVE_INTO_ALL_WALLPAPER)){
ArrayList<WallpaperItem> newList = savedInstanceState.getParcelableArrayList(Constant.SAVE_INTO_ALL_WALLPAPER);
adapter.add(newList);
recyclerView.setAdapter(adapter);
progressBar.hide();
}
}

Now i don’t lose my data when i sweep one tab to another tab and when i came to my previous tab everything was file. But after some time i was wondering my application are getting little bit slow and their response are slower bit now. Then thinking thinking after searching in google i found a tools which can show which Parcelable ArrayList getting how much size.

Md. Masud Parvez

Android Application Developer and love to learn new tech. I believe the hardest job is to develop simple thing. Shoot me(pavelcep.sust11@gmail.com) for project