Note that there are some explanatory texts on larger screens.

plurals
  1. POAttemp to re-open an already closed object android.database.sqlite
    primarykey
    data
    text
    <p>i have a Main activity which has a list view. the listview items are loaded with LoaderManager.</p> <p>when i click an item in the listview i open another activity that shows more information (with "startActivityForResult")</p> <p>the problem is :</p> <p>when i go back(using the return key on) from the activity that shows information to the main activity and then click again i get an exception - Attempt to re-open an already closed object.</p> <p>but if i go back from that activity(that shows more information) with a Button that i made there(which is actually "finish()") to the main activity and then cllick again then i get no exception</p> <p>anyone knows what is the problem?</p> <p>Thanks !</p> <pre><code>private void display_listview() { // create an adapter from the SimpleCursorAdapter dataAdapter = new SimpleCursorAdapter( this, R.layout.row_invite_layout, null, columns, to, 0); // Assign adapter to ListView listView.setAdapter(dataAdapter); //Ensures a loader is initialized and active. getSupportLoaderManager().initLoader(0, null, this); //add implementation to listview item click listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Cursor cursor = (Cursor) listView.getItemAtPosition(position); IInvite invite = LoadFromCursor(cursor); cursor.close(); mUpdateFlag = true; if(!mTrashFlag) // Trash Can is turned off { Intent intent = new Intent(getApplicationContext(), InviteViewActivity.class); intent.putExtra("invite",(Invite)invite); startActivityForResult(intent, INVITE_REQUEST_ID); } else // Trash Can is turned on { getContentResolver().delete(InviteContentProvider.CONTENT_URI, SQLdataHelper.KEY_ROWID+"="+invite.getID(), null); ExtraDelete(invite); getSupportLoaderManager().getLoader(0).forceLoad(); } } }); } @Override public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor data) { // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) dataAdapter.swapCursor(data); } @Override public void onLoaderReset(Loader&lt;Cursor&gt; loader) { dataAdapter.swapCursor(null); } @Override public Loader&lt;Cursor&gt; onCreateLoader(int id, Bundle args) { String[] projection = { SQLdataHelper.KEY_ROWID, SQLdataHelper.INVITE_CLIENT_ID, SQLdataHelper.INVITE_CREATION_DATE, SQLdataHelper.INVITE_NAME, SQLdataHelper.INVITE_NOTE, SQLdataHelper.INVITE_REQUESTED_DATE, SQLdataHelper.INVITE_TOTAL_PRICE, SQLdataHelper.INVITE_STATUS }; CursorLoader cursorLoader = new CursorLoader(this, InviteContentProvider.CONTENT_URI, projection, null, null, null); return cursorLoader; } </code></pre> <p>UPDATE: FIXED IT. i added this method to my main activity..</p> <pre><code>@Override public void onResume() { super.onResume(); getSupportLoaderManager().getLoader(0).forceLoad(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload