Android Programming Tutorials

(Romina) #1
Getting More Active

args);
}

public String getName(Cursor c) {
return(c.getString( 1 ));
}

public String getAddress(Cursor c) {
return(c.getString( 2 ));
}

public String getType(Cursor c) {
return(c.getString( 3 ));
}

public String getNotes(Cursor c) {
return(c.getString( 4 ));
}
}

Extra Credit................................................................................................


Here are some things you can try beyond those step-by-step instructions:



  • Have the database hold a URL for the restaurant's Web site. Update
    the UI to collect this address in the detail form. Launch that URL


via startActivity() via an option menu choice from the restaurant
list, so you can view the restaurant's Web site.


  • Add an option menu to delete a restaurant. Raise an AlertDialog to


confirm that the user wants the restaurant deleted. Delete it from
the database and refresh the list if the user confirms the deletion.

Further Reading.........................................................................................


You can read up on having multiple activities in your application, or linking


to activities supplied by others, in the "Launching Activities and Sub-


Activities" chapter of The Busy Coder's Guide to Android Development.


133
Free download pdf