如何通过自定义对象的包?自定义、对象

由网友(别拿精子射爱情)分享简介:我想通过我自己的自定义对象成束:叠B =新包();STMessage消息=(STMessage)a.getAdapter()的getItem(位置)。b.putObject(消息,消息);我得到的错误:的方法putObject(字符串,对象)是未定义的类型包解决方案 一种方法是让你的自定义对象实现Parcelable接...

我想通过我自己的自定义对象成束:

 叠B =新包();
                STMessage消息=(STMessage)a.getAdapter()的getItem(位置)。
                b.putObject(消息,消息);
 

我得到的错误:

 的方法putObject(字符串,对象)是未定义的类型包
 

解决方案

一种方法是让你的自定义对象实现Parcelable接口,并使用 Bundle.putParcelable / Bundle.getParcelable

微信怎么添加自定义表情包

I am trying to pass my own custom object into a bundle:

Bundle b = new Bundle();
                STMessage message = (STMessage)a.getAdapter().getItem(position);
                b.putObject("message",message);

I get the error:

The method putObject(String, Object) is undefined for the type Bundle

解决方案

One way is to have your custom object implement the Parcelable interface and use Bundle.putParcelable/Bundle.getParcelable

阅读全文

相关推荐

最新文章