【问题标题】:Android ClassCastException Error - String cannot be cast to ArrayListAndroid ClassCastException 错误 - 字符串无法转换为 ArrayList
【发布时间】:2019-05-07 06:41:47
【问题描述】:
ImageActivity:
fullImage = (ArrayList<mehndiimg>) bundle.getSerializable("images");
MainActivity:
bundle.putSerializable("images",img.getImages());

错误

原因:java.lang.ClassCastException:java.lang.String 不能 转换为 java.util.ArrayList

【问题讨论】:

    标签: android android-intent


    【解决方案1】:

    您正在尝试将字符串强制转换为 ArrayList,这是不可能的。

    fullImage = (ArrayList) bundle.getSerializable("images");
    
    bundle.getSerializable("images") //this returns a string
    

    我假设您正在尝试通过活动传递图像,check this post

    【讨论】:

      猜你喜欢
      • 2017-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-10
      • 2013-07-24
      • 1970-01-01
      • 2017-11-27
      相关资源
      最近更新 更多