异常 java.lang.RuntimeException: Error receiving broadcast Intent

06-19 12:12:54.065: E/AndroidRuntime(11744): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.gloud.service.ACTION_MYSERVICE flg=0x10 (has extras) } in cn.gloud.client.activities.TvAssistantActivity$SearchDeviceBroadcastReceiver@43461d70
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:772)
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.os.Handler.handleCallback(Handler.java:615)
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.os.Handler.dispatchMessage(Handler.java:92)
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.os.Looper.loop(Looper.java:137)
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.app.ActivityThread.main(ActivityThread.java:4866)
06-19 12:12:54.065: E/AndroidRuntime(11744): at java.lang.reflect.Method.invokeNative(Native Method)
06-19 12:12:54.065: E/AndroidRuntime(11744): at java.lang.reflect.Method.invoke(Method.java:511)
06-19 12:12:54.065: E/AndroidRuntime(11744): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
06-19 12:12:54.065: E/AndroidRuntime(11744): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
06-19 12:12:54.065: E/AndroidRuntime(11744): at dalvik.system.NativeStart.main(Native Method)
06-19 12:12:54.065: E/AndroidRuntime(11744): Caused by: android.os.BadParcelableException: Parcelable protocol requires a Parcelable.Creator object called CREATOR on class cn.gloud.client.entity.ServiceTypeEntity
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.os.Parcel.readParcelable(Parcel.java:2086)
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.os.Parcel.readValue(Parcel.java:1965)
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.os.Parcel.readMapInternal(Parcel.java:2226)
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.os.Bundle.unparcel(Bundle.java:223)
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.os.Bundle.getParcelable(Bundle.java:1165)
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.content.Intent.getParcelableExtra(Intent.java:4467)
06-19 12:12:54.065: E/AndroidRuntime(11744): at cn.gloud.client.activities.TvAssistantActivity$SearchDeviceBroadcastReceiver.onReceive(TvAssistantActivity.java:284)
06-19 12:12:54.065: E/AndroidRuntime(11744): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:762)
06-19 12:12:54.065: E/AndroidRuntime(11744): ... 9 more

 

 

原因就是一个实体类实现了parcelable接口,而没有在实体类里写下面的这些方法 ,而这些方法的内容都是需要自己去写的

public int describeContents();  

public void writeToParcel(Parcel dest, int flags);  

 public interface Creator<T> {}

解决办法就是要么在实体类里加上这三个方法,并实现,要么就是实体类不要实现这个接口了,改换成Serializable接口

 

你可能感兴趣的:(异常 java.lang.RuntimeException: Error receiving broadcast Intent)