First off, if this is a dumb question, I apologize ahead of time but I cannot seem to find what I need through searching online so I figured I would just ask...
Secondly as a little background info... I'm quite new to Android Development, and actually Java in general. No formal training or prior experience till about a month ago when I decided to give it a try. I am self teaching myself as I go through websites such as this one and a book I found for development of Android apps.
Okay, I am attempting to develop myself an app for school to keep a list of all my classes, and assignments for each of them. I have the DB created, the page to add a class through edit text and have the list view setup to populate from the DB. So what I am looking for now is how to make it so when I click on a class from the list view it will open a page that is specific to that class.
I'm unsure of what I am looking for would be generally referred to or called so I'm struggling trying to search for examples. I know you can create a dialog and am assuming it is generally the same coding wise but having to background I am lost since I don't know what to look for.
If this wasn't specific enough of a description of what I am looking for please let me know where I开发者_运维问答 need to clarify my question.
Take care,
JoshSo what I am looking for now is how to make it so when I click on a class from the list view it will open a page that is specific to that class.
There are no "pages" in Android. I assume you are referring to an "activity" when you say "page".
You use startActivity()
to have one activity start another. startActivity()
takes an Intent
identifying the activity you want to start. One of the things you can put on an Intent
are "extras" -- think of these as being akin to GET parameters you might put on a link in a Web app. Your list-of-classes activity can put some identifier of the class in an Intent
extra for the Intent
used with startActivity()
. The show-the-class activity can use getIntent()
to retrieve the Intent
, then get the extra value out of the Intent
, to determine what to display.
as mentioned you can use a second activity which displays the class contetn http://www.androidcompetencycenter.com/2009/03/tutorial-how-to-start-a-new-activity/ http://www.warriorpoint.com/blog/2009/05/24/android-how-to-switch-between-activities/
you can also use a dialog http://developer.android.com/guide/topics/ui/dialogs.html
I would create a second view which shows the class and then call the setContent method of the activity in other words switching between the views
精彩评论