Skip to content

Instantly share code, notes, and snippets.

@barmgeat
Created September 16, 2018 00:43
Show Gist options
  • Save barmgeat/bf6846cafce2b74cc66e2c5071923274 to your computer and use it in GitHub Desktop.
Save barmgeat/bf6846cafce2b74cc66e2c5071923274 to your computer and use it in GitHub Desktop.
public class MainActivity extends AppCompatActivity {
Cursor cursor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Define a projection that specifies which columns from the database
// you will actually use after this query.
String[] projection = {
Words._ID,
Words.COLUMN_WORD,
Words.COLUMN_WORD_T,
Words.COLUMN_WORD_T2
};
cursor = getContentResolver().query(DeutchVContract.CONTENT_URI,
projection,
null,
null
);
ListView wordList = findViewById(R.id.wordsListView);
WordCursorAdapter adapter = new WordCursorAdapter(this, cursor);
wordList.setAdapter(adapter);
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment