【问题标题】:How to get 'ParcelableArrayListExtra' data in the sub activity?如何在子活动中获取“ParcelableArrayListExtra”数据?
【发布时间】:2013-07-31 09:18:18
【问题描述】:

这就是我创建数组列表并将其传递给意图的方式

private ArrayList<Words> words = new ArrayList<Words>();
Intent intent = new Intent(Game.this,removeWords.getClass());
intent.putParcelableArrayListExtra("LIST OF WORDS", (ArrayList<? extends Parcelable>) words);
startActivity(intent);

这就是我在子活动中获取这些数据的方式

private List<Words> words;
words = new ArrayList<Words>();
words = getIntent().getParcelableArrayListExtra("LIST OF WORDS");

但问题是,我收到下面提到的错误:

绑定不匹配:Intent 类型的通用方法 getParcelableArrayListExtra(String) 不适用于参数 (String)。

推断的类型 Words 不是有界 parameter&lt;T extends parcelable&gt; 的有效替代品

我正在尝试传递该数组列表,所以我不介意它是 putParcelableArrayListExtra 还是其他方法。我发现这是在 SO question 中完成这项工作的方法,这就是我使用它的原因。

那么,我怎样才能摆脱这个异常呢?

【问题讨论】:

    标签: android eclipse list android-intent arraylist


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多