相关疑难解决方法(0)

如何使用LocalBroadcastManager?

LocalBroadcastManager谷歌文档服务广播文档中所述如何使用/定位?

我试图谷歌它,但没有可用的代码开始?

文件说如果我想在我的应用程序进程内部进行广播,我应该使用它,但我不知道在哪里寻找这个.

任何帮助/评论?

更新:我知道如何使用广播,但不知道如何LocalBroadcastManager在我的项目中使用.

android broadcastreceiver

440
推荐指数
8
解决办法
21万
查看次数

Intent putExtra ArrayList <NameValuePair>

有谁知道如何添加ArrayList<NameValuePair>一个Intent作为额外的?

ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("first_name", first_name));
nameValuePairs.add(new BasicNameValuePair("last_name", last_name));
nameValuePairs.add(new BasicNameValuePair("email", email));
nameValuePairs.add(new BasicNameValuePair("password", password));

/* Move on to step 2 */
Intent intent = new Intent(RegisterActivity1.this, RegisterActivity2.class);
intent.putExtra("nvp", nameValuePairs);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

这是RegisterActivity2的类声明:

public class RegisterActivity2 extends Activity implements Serializable {
}
Run Code Online (Sandbox Code Playgroud)

logcat中的错误是:

> Parcel: unable to marshal value first_name="whatever"
Run Code Online (Sandbox Code Playgroud)

在实施Ted Hopp的建议后,我仍然收到错误.这是堆栈跟踪:

08-04 22:10:16.095: E/AndroidRuntime(5065): FATAL EXCEPTION: main
> 08-04 22:10:16.095: E/AndroidRuntime(5065):
> java.lang.RuntimeException: Unable to start activity
> ComponentInfo{/.RegisterActivity2}: java.lang.RuntimeException:
> Parcelable encountered IOException reading …
Run Code Online (Sandbox Code Playgroud)

android android-intent

25
推荐指数
2
解决办法
5万
查看次数