Android RunTimeException:取消绑定到封送处理值
我正在使用改型将图像加载到Android RunTimeException:取消绑定到封送处理值,android,runtime-error,Android,Runtime Error,我正在使用改型将图像加载到回收视图,一次加载十个。当用户将RecyclerView滚动到底部位置时,将再加载十个图像。当活动进入暂停状态(onPause)时,我得到一个运行时异常 这不是一个重复的问题。我在网上查过,也遇到过类似的问题,但这种异常的原因是不同的。。。请看下面: 例外情况: Process: com.globemaster.samples, PID: 13132<br/> **java.lang.RuntimeException: Parcel: unable to m
回收视图
,一次加载十个。当用户将RecyclerView
滚动到底部位置时,将再加载十个图像。当活动
进入暂停状态(onPause
)时,我得到一个运行时异常
这不是一个重复的问题。我在网上查过,也遇到过类似的问题,但这种异常的原因是不同的。。。请看下面:
例外情况:
Process: com.globemaster.samples, PID: 13132<br/>
**java.lang.RuntimeException: Parcel: unable to marshal value**
com.globemaster.samples.RetroPhoto@150122e at
android.os.Parcel.writeValue(Parcel.java:1418) at
android.os.Parcel.writeList(Parcel.java:759) at
android.os.Parcel.writeValue(Parcel.java:1365) at
android.os.Parcel.writeArrayMapInternal(Parcel.java:686) at
android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1330) at
android.os.Bundle.writeToParcel(Bundle.java:1079) at
android.os.Parcel.writeBundle(Parcel.java:711) at
android.support.v4.app.FragmentState.writeToParcel(Fragment.java:157) at
android.os.Parcel.writeTypedArray(Parcel.java:1254) at
android.support.v4.app.FragmentManagerState.writeToParcel(FragmentManager.java:617) at android.os.Parcel.writeParcelable(Parcel.java:1437) at
android.os.Parcel.writeValue(Parcel.java:1343) at
android.os.Parcel.writeArrayMapInternal(Parcel.java:686) at
android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1330) at
android.os.Bundle.writeToParcel(Bundle.java:1079) at
android.os.Parcel.writeBundle(Parcel.java:711)at
android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3752) at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4700) at
android.os.Handler.handleCallback(Handler.java:739) at
android.os.Handler.dispatchMessage(Handler.java:95) at
android.os.Looper.loop(Looper.java:148) at
android.app.ActivityThread.main(ActivityThread.java:7325) at
java.lang.reflect.Method.invoke(Native Method) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
list.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
GetDataService service=RetrofitClientInstance.getClient().create(GetDataService.class);
Call<List<RetroPhoto>> call=service.getAllPhotos();
call.enqueue(new Callback<List<RetroPhoto>>() {
@Override
public void onResponse(Call<List<RetroPhoto>> call, Response<List<RetroPhoto>> response) {
Log.e("OnResponse","Called");
data=response.body();
arrayList= (ArrayList) data;
runOnUiThread(new Runnable() {
@Override
public void run() {
android.support.v4.app.FragmentTransaction transaction=getSupportFragmentManager().beginTransaction();
Recycler_Frag recycler_frag=new Recycler_Frag();
Bundle bundle=new Bundle();
bundle.putStringArrayList("list",arrayList);
recycler_frag.setArguments(bundle);
transaction.replace(R.id.frame,recycler_frag).commit();
}
});
}
@Override
public void onFailure(Call<List<RetroPhoto>> call, Throwable t) {
Log.e("OnFailure","Called");
Toast.makeText(getApplicationContext(),"Something wrong",Toast.LENGTH_SHORT).show();
}
});
}
});
public class RetroPhoto {
@SerializedName("albumId")
private Integer albumId;
@SerializedName("id")
private Integer id;
@SerializedName("title")
private String title;
@SerializedName("url")
private String url;
@SerializedName("thumbnailUrl")
private String thumbnailUrl;
public RetroPhoto(Integer albumId,Integer id,String title,String url,String thumbnailUrl)
{
this.albumId=albumId;
this.id=id;
this.title=title;
this.url=url;
this.thumbnailUrl=thumbnailUrl;
}
public Integer getAlbumId() {
return albumId;
}
public void setAlbumId(Integer albumId) {
this.albumId = albumId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getThumbnailUrl() {
return thumbnailUrl;
}
public void setThumbnailUrl(String thumbnailUrl) {
this.thumbnailUrl = thumbnailUrl;
}
}
public class RetroPhoto实现可包裹的
可能重复为什么我要实现它?标题很模糊,您可能应该更具体一些。
public class RetroPhoto {
@SerializedName("albumId")
private Integer albumId;
@SerializedName("id")
private Integer id;
@SerializedName("title")
private String title;
@SerializedName("url")
private String url;
@SerializedName("thumbnailUrl")
private String thumbnailUrl;
public RetroPhoto(Integer albumId,Integer id,String title,String url,String thumbnailUrl)
{
this.albumId=albumId;
this.id=id;
this.title=title;
this.url=url;
this.thumbnailUrl=thumbnailUrl;
}
public Integer getAlbumId() {
return albumId;
}
public void setAlbumId(Integer albumId) {
this.albumId = albumId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getThumbnailUrl() {
return thumbnailUrl;
}
public void setThumbnailUrl(String thumbnailUrl) {
this.thumbnailUrl = thumbnailUrl;
}
}