I followed the Android Room with a View tutorial and I was successfully able to recreate the tutorial app. All of my code can be found in that tutorial. The only difference with my app now is my MainActivity is a webView and then when the user clicks on a button in the toolbar, they're taken to the Room with a View app functionality exactly how it is in the tutorial. So essentially I just added another activity beforehand.
I've tried using the methods getAllWords() and getAlphabetizedWords() associated with LiveData and dumped the results into the Logcat, but they always come out in a hash-like string (Ex: Word@6f2f356). I'm trying to get the exact value of the word I'm pulling from the Room database.
I have 2 issues currently:
I'd like to select all of the words in the Room database table from the MainActivity.
After selecting all terms from the table, I'd like to write them all to a text file or CSV.
In my MainActivity I'm using the function below to send the user to the start of the Room with a View tutorial functionality (WordList). My WordList class is the equivalent to the tutorial's MainActivity. Within this WordList class, I've tried using getAllWords() and it returns the terms in a hash-like state.
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.nix_menu_back:
onBackPressed();
break;
case R.id.nix_menu_forward:
onForwardPressed();
break;
case R.id.nix_menu_refresh:
nixWebView.reload();
break;
case R.id.nix_string_list:
nixWebView.reload();
Intent intent = new Intent(this, WordList.class);
startActivity(intent);
break;
}
return super.onOptionsItemSelected(item);
}
Can someone please explain to me how to select all terms in the Room database and output them in a readable format to Logcat and an internal text file?
Any help is appreciated, and my sincerest apologies if this is a repeat! I've checked around SO and the only question I found related to my situation didn't cover this situation.
I'm happy to provide more code if asked. Thank you everyone!