Android-TransactionTooLargeException

Android-TransactionTooLargeException,第1张

概述ExceptionthrownlaunchingactivitiesinProcessRecord{3c67ecf8080:com.example/u0a171}android.os.TransactionTooLargeException:dataparcelsize572488bytes传递数据Intentintent=newIntent(activity,SearchListActivity.class);intent.putExtra(HRConsta

Exception thrown launching activitIEs in ProcessRecord{3c67ecf8080:com.example/u0a171}
android.os.TransactionToolargeException: data parcel size 572488 bytes

传递数据

Intent intent = new Intent(activity, SearchListActivity.class);intent.putExtra(HRConstants.SEARCHList, searchResponse);startActivity(intent);

获取数据

Intent intent = getIntent();searchResponse = intent.getParcelableExtra(HRConstants.SEARCHList);searchLists = searchResponse.getSearchResults();

我的minSdkVersion是15,targetSdkVersion是26.

响应包含1736个项目,后跟一个异常.它可以用更少的物品正常工作.

解决方法:

这是因为AndroID中的意图最多只能承载1MB的数据.解决方法是将“ searchResult”放入公共静态对象中

Intent intent=new Intent(activity,SearchListActivity.class);//intent.putExtra(HRConstants.SEARCHList,  searchResponse);YourActivity.SearchResponse = searchResponse;startActivity(intent);

在SearchListActivity中,而不是

getIntent.getExtras();

您可以访问已保存到的对象

List<Search> List = YourActivity.SeachResponse;

希望这可以帮助

总结

以上是内存溢出为你收集整理的Android-TransactionTooLargeException全部内容,希望文章能够帮你解决Android-TransactionTooLargeException所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1081034.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存