I have created several databases, and I am trying to allow the user to view the information from all databases. In the code below, you can see that I am opening, grabbing info from, and closing each database. The problem is that it is only showing me information from the first database called, and putting that into both TextViews. I cannot seem to find a way around this or why it is happening. Any suggestions?
public class SQLView extends Activity {
protected void onCreate(Bundle savedInstanceState){
//TODO
super.onCreate(savedInstanceState);
setContentView(R.layout.sqlview);
ViewAbsData();
ViewBicepsData();
}
public void ViewAbsData(){
//list ab exercises in database
TextView tvAbs = (TextView)findViewById(R.id.absDatabaseView);
AbsDatabase absinfo = new AbsDatabase(SQLView.this);
try {
absinfo.open();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String absdata = absinfo.getData();
absinfo.close();
tvAbs.setText(absdata);
}
public void ViewBicepsData(){
//list biceps exercises in database
TextView tvBiceps = (TextView)findViewById(R.id.bicepsDatabaseView);
BicepsDatabase bicepsinfo = new BicepsDatabase(SQLView.this);
try {
bicepsinfo.open();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String bicepsdata = bicepsinfo.getData();
bicepsinfo.close();
tvBiceps.setText(bicepsdata);
}
}
One database is more than enough. Constructed properly the tables will provide efficient relational access to the data.