Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, I know it's late -I hadn't found this post- , but I had the same problem (though I was just trying to do a To-Do List). I've spent the last three hour trying to figure out what the problem was and looking for possible solutions somewhere on the web. </p> <p>Maybe it could help somebody else anyway, so I'll put it.</p> <p>In my case what worked was this:</p> <p>This is part of my Main Activity with the onCreate method:</p> <pre><code>public class TimeTrackerActivity extends Activity implements LoaderCallbacks&lt;Cursor&gt; { public static final int TIME_ENTRY_REQUEST_CODE = 1; public static final int TIME_EDIT_REQUEST_CODE = 2; private TimeTrackerAdapterDB adapter; private TimeTrackerDatabaseHelper databaseHelper; private ListView listView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //Database Helper databaseHelper = new TimeTrackerDatabaseHelper(this); //ListView that wasn't showing anything -before solving it- listView = (ListView)findViewById(R.id.times_list); //A private method I made for adding a listener to the ListView setListViewListener(listView); this.getLoaderManager().initLoader(0, null, this); } </code></pre> <p>... and moving down to the LoaderCallbacks methods:</p> <pre><code> public Loader&lt;Cursor&gt; onCreateLoader(int id, Bundle args) { CursorLoader loader = new CursorLoader(this, TimeTrackerContentProvider.CONTENT_URI, null, null, null, null); return loader; } public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor cursor) { // I'm initializing my custom adapter here because it requires a cursor if (adapter == null) adapter = new TimeTrackerAdapterDB(this, cursor); else adapter.swapCursor(cursor); //THIS IS WHAT SOLVED IT! listView.setAdapter(adapter); } </code></pre> <p>So, in my case, the reason it wasn't working was because the adapter wasn't being set to the ListView, so my list didn't show anything and the methods newView() and bindView() never got called before.</p> <p>Maybe it could work by setting the adapter to the GridView on your onLoadFinished, once the cursor load has been made.</p> <p>Don't know if it will solve your problem or anyone else's but it worked for me. Hope it helps.</p>
    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.
    1. VO
      singulars
      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