I would like to add a “Help” screen to my app using the options menu, and have it include a button to “Returen” back to the original view.
I have the written the “onOptionsItemSelected” routine(or is it a method?) using “swithch & case” to check for which menu button was pressed. When the “help” button is pressed, I would like a new view to pop up showing the text I have typed in myhelp.xml file located in the R.layout folder. The myHelp.xml file includes a button named “quithelp” to return the user back to the main program (or is it the class?)
I don’t understand two things: how to switch to the myhelp.xml view when the menu button is pressed, and how to return back to the main menu when the “Return” button is pressed.
I’ve experimented with LayoutInflator, getLayoutInflator,setFeatureInt based on some poor examples I found on the net, and now I’m just simply confused as to how best do such a simple task.
You should create an HelpActivity activity which displays your Help information and in the button click handler call startActivity and pass it the information on your HelpActivity. The design model followed in Android is using a bunch of small, reusable activities. A help information Activity would be a reusable activity for many of your apps, so try to isolate it into a reusable piece of code.
Think of the new activity as a standalone app, which just opens and displays the contents of your help file. When you have built the activity, just launch it from the button event logic using startActivity.