Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class MyAsyncTask extends AsyncTask<Void, Void, Cursor> {
@Override
protected Cursor doInBackground(Void... params) {
DatabaseHelper helper = new DatabaseHelper(MainActivity.this);
return helper.getReadableDatabase().rawQuery("SELECT * FROM myTable", null);
}
@Override
protected void onPostExecute(Cursor cursor) {
super.onPostExecute(cursor);
Toast.makeText(
MainActivity.this,
"Count: " + cursor.getCount(),
Toast.LENGTH_SHORT
).show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.