I am new to Android App Development. I am try to view my database using a Textview in my activity.
Here is my setText() java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewlogs);
TextView tv = (TextView) findViewById(R.id.tvSqlinfo);
LogsDB info = new LogsDB(this);
info.open();
ArrayList<String> data = info.getData();
info.close();
tv.setText(data);
}
I seem to be getting and error at tv.setText(data);. Stating "The method setText(CharSequence) in the type TextView is not applicable for the arguments (ArrayList)" Then when i do the recommended fix it changes
tv.setText(data)
to
tv.setText((CharSequence) data);
Then when I test the application I get an error stating that it cannot be cast. What do I need to change to be able to view my database in the textview?
Any advice and help would be greatly appreciated. Thanks