引起:GsaIOException:错误代码:393238 |缓冲区溢出,无可用 space
Caused by: GsaIOException: Error code: 393238 | Buffer overflow, no available space
在这里,我有两个活动,Activity_a 和 some_button 和 Activity_B .当some_button点击Activity_a,Activity_b会出现。在 Activity_b 中,我尝试使用 retrofit2[=45 获取 JSON_OBJECT =] 并在 recyclerview 中显示数据。
第一次一切顺利,在 Activity_a 中单击 some_button 后, Activity_b 会出现在 recyclerView 中的数据列表中。 但是如果我从 Activity_B 返回并再次尝试单击 Activity_a 的 some_button 并且屏幕仍然黑屏并显示以下错误。
原因:com.google.android.apps.gsa.shared.exception.GsaIOException:
错误代码:393238 |缓冲区溢出,无可用space.
这个有线问题让我失去了所有的时间,如果有人之前遇到过同样的问题或对此有任何想法,请帮助我。
Activity_A.java
@Override
public void onClick(View view) {
if (view.getId() == R.id.fab) {
Intent activityIntent = new Intent(this, Activity_B.class);
startActivity(activityIntent);
}
}
Activity_B.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_message);
toolbarAndViewInitialization();
/** Create handle for the RetrofitInstance interface*/
GetMessageDataService service = RetrofitInstance.getRetrofitInstance().create(GetMessageDataService.class);
/** Call the method with parameter in the interface to get the notice data*/
Call<MessageList> call = service.getMessageData();
/**Log the URL called*/
Log.wtf("URL Called", call.request().url() + "");
materialDialog.show();
call.enqueue(new Callback<MessageList>() {
@Override
public void onResponse(Call<MessageList> call, Response<MessageList> response) {
ArrayList<Message> noticeList = response.body().getMessageArrayList();
initDataToRecyclerView(noticeList);
materialDialog.hide();
}
@Override
public void onFailure(Call<MessageList> call, Throwable t) {
Toast.makeText(MessageActivity.this, "Something went wrong...Error message: " + t.getMessage(), Toast.LENGTH_SHORT).show();
materialDialog.hide();
}
});
}
RetrofitInstance.java
public class RetrofitInstance {
private static Retrofit retrofit;
private static final String BASE_URL2 = "https://someurl.com/";
/**
* Create an instance of Retrofit object
*/
public static Retrofit getRetrofitInstance() {
retrofit = new Retrofit.Builder()
.baseUrl(ApisUtils.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
return retrofit;
}
public static Retrofit getRetrofitInstance2() {
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL2)
.addConverterFactory(GsonConverterFactory.create())
.build();
return retrofit;
}
}
问题已解决!!
在我的例子中,这个问题是由于 for 循环 中的愚蠢错误引起的。即使在按下后退按钮后,for 循环也会继续将数据放入 array_list 并增加内存缓冲区大小。
在这里,我有两个活动,Activity_a 和 some_button 和 Activity_B .当some_button点击Activity_a,Activity_b会出现。在 Activity_b 中,我尝试使用 retrofit2[=45 获取 JSON_OBJECT =] 并在 recyclerview 中显示数据。
第一次一切顺利,在 Activity_a 中单击 some_button 后, Activity_b 会出现在 recyclerView 中的数据列表中。 但是如果我从 Activity_B 返回并再次尝试单击 Activity_a 的 some_button 并且屏幕仍然黑屏并显示以下错误。
原因:com.google.android.apps.gsa.shared.exception.GsaIOException:
错误代码:393238 |缓冲区溢出,无可用space.
这个有线问题让我失去了所有的时间,如果有人之前遇到过同样的问题或对此有任何想法,请帮助我。
Activity_A.java
@Override
public void onClick(View view) {
if (view.getId() == R.id.fab) {
Intent activityIntent = new Intent(this, Activity_B.class);
startActivity(activityIntent);
}
}
Activity_B.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_message);
toolbarAndViewInitialization();
/** Create handle for the RetrofitInstance interface*/
GetMessageDataService service = RetrofitInstance.getRetrofitInstance().create(GetMessageDataService.class);
/** Call the method with parameter in the interface to get the notice data*/
Call<MessageList> call = service.getMessageData();
/**Log the URL called*/
Log.wtf("URL Called", call.request().url() + "");
materialDialog.show();
call.enqueue(new Callback<MessageList>() {
@Override
public void onResponse(Call<MessageList> call, Response<MessageList> response) {
ArrayList<Message> noticeList = response.body().getMessageArrayList();
initDataToRecyclerView(noticeList);
materialDialog.hide();
}
@Override
public void onFailure(Call<MessageList> call, Throwable t) {
Toast.makeText(MessageActivity.this, "Something went wrong...Error message: " + t.getMessage(), Toast.LENGTH_SHORT).show();
materialDialog.hide();
}
});
}
RetrofitInstance.java
public class RetrofitInstance {
private static Retrofit retrofit;
private static final String BASE_URL2 = "https://someurl.com/";
/**
* Create an instance of Retrofit object
*/
public static Retrofit getRetrofitInstance() {
retrofit = new Retrofit.Builder()
.baseUrl(ApisUtils.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
return retrofit;
}
public static Retrofit getRetrofitInstance2() {
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL2)
.addConverterFactory(GsonConverterFactory.create())
.build();
return retrofit;
}
}
问题已解决!!
在我的例子中,这个问题是由于 for 循环 中的愚蠢错误引起的。即使在按下后退按钮后,for 循环也会继续将数据放入 array_list 并增加内存缓冲区大小。