I'm having a little trouble switching views and wondering anyone can help. Basically the initial view is a ListActivity. On this view the user can press the menu button which triggers a database call and when the result comes back (either a number or a null) I require the view to be altered to one of two views (a numberview and a nullview so to speak).
I've had some success by doing -
Intent myIntent = new Intent(this, numberview.class);
this.startActivity(myIntent);
Now this works however I can't see a way to pass the number retrieved from the database into the开发者_开发知识库 new view.
I also tried to use the PopUpWindow class but to no avail, all the examples I found only had examples for the Activity (not ListActivity) and some of the mentioned methods don't exist. Can I get some help/advice at all please?
Try this:
Intent myIntent = new Intent(this, numberview.class);
myIntent.putExtra("number", num);
this.startActivity(myIntent);
....
And in your second activity:
Integer number = getIntent().getExtra("number");
精彩评论