Hi everyone. I am creating an Android app that will act as a front end for viewing reports. I have created an Activity that requests a list of available reports from the server. What I am trying to do is get that activity to add a button for each feed listed in the list of reports (contained in a Vector). This is the code I have so far:
this.layout.addview is where I am trying to add the new buttons. The information for the buttons is stored in reportList, a string array containing the label for the button, and the id code for the report that needs to be handled by the click handler.
I have been able to find ways to add finite buttons through XML and hard coding, but not arbitrary buttons. Any advice or suggestions would be greatly appreciated.
Code:
// Check for an error
if (feedHandler.success()) {
// Get the data from the handler
infoView.setText("Document Loaded. Please select a report.");
infoView.append("\n");
Vector<String[]> reportList = feedHandler.getReports();
// Cycle through the list of reports, and output the results
for (Enumeration<String[]> e = reportList.elements(); e.hasMoreElements();) {
String[] reportInfo = (String[]) e.nextElement();
this.layout.addView(new Button(this));
}
} else {
infoView.setText(feedHandler.getError());
}
this.layout.addview is where I am trying to add the new buttons. The information for the buttons is stored in reportList, a string array containing the label for the button, and the id code for the report that needs to be handled by the click handler.
I have been able to find ways to add finite buttons through XML and hard coding, but not arbitrary buttons. Any advice or suggestions would be greatly appreciated.