次のコードは、N1で問題なく動作します。しかし、時間から、私は私のユーザーからCrashReportを取得する時に:閉じるカーソル/ AsyncTaskにアクセス
"android.database.StaleDataException: Access closed cursor
at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:217)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:41)
at android.database.CursorWrapper.getString(CursorWrapper.java:135)
at at.mikemitterer.android.partnerzodiacs.PartnerZodiacsView.setRelationInfo(PartnerZodiacsView.java:456)
at at.mikemitterer.android.partnerzodiacs.PartnerZodiacsView.setReleationInfoAfterPostExecute(PartnerZodiacsView.java:449)
at at.mikemitterer.android.partnerzodiacs.PartnerZodiacsView.access$10(PartnerZodiacsView.java:447)
at at.mikemitterer.android.partnerzodiacs.PartnerZodiacsView$5.onPostExecute(PartnerZodiacsView.java:440)
at at.mikemitterer.android.partnerzodiacs.PartnerZodiacsView$5.onPostExecute(PartnerZodiacsView.java:1)
at android.os.AsyncTask.finish(AsyncTask.java:417)
at android.os.AsyncTask.access$300(AsyncTask.java:127)
コード部分がある:それは私に再現できないと述べて
public void updateRelationInfoAsync() {
new AsyncTask<Void, Void, Void>() {
private Cursor cursorRelation = null;
@Override
protected Void doInBackground(final Void... voids) {
try {
cursorRelation = ProviderQueries.getInstance().getRelationByID(PartnerZodiacsView.this, firstRelationUID, secondRelationUID);
}
catch (final RelationNotSetException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(final Void result) {
super.onPostExecute(result);
setReleationInfoAfterPostExecute(cursorRelation);
cursorRelation = null;
}
}.execute();
}
private synchronized void setReleationInfoAfterPostExecute(final Cursor cursorRelation) {
if (cursorRelation != null && (!cursorRelation.isClosed())) {
setRelationInfo(cursorRelation);
setRatings(cursorRelation);
cursorRelation.close();
}
}
private void setRelationInfo(final Cursor cursor) {
maininfo.setText(cursor.getString(cursor.getColumnIndex(RelationDAO.Colums.DESCRIPTION)));
final String name = cursor.getString(cursor.getColumnIndex(RelationDAO.Colums.RELATIONNAME));
AnalyticsUtils.getInstance(this).trackPageView("/relationdisplayed?name=" + URLEncoder.encode(name));
}
私は、このエラーの原因がわかりませんN1とエミュレータが、より重要なことに、私はCursor.isClosed