Switching between views

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Switching between views

Postby cheops2006 » Wed Feb 17, 2010 1:27 pm

Hi,

I have a game running on a surfaceview, however at some point I need to request input for a player name, how do I switch views.

I created an xml layout file with a basic textbox for input so that the keyboard can be used but when I try and switch to that view, I get calledfromwrongthread exception how would I go about doing this?

Thanks

Adrian.
cheops2006
Freshman
Freshman
 
Posts: 2
Joined: Wed Feb 17, 2010 1:24 pm

Top

Postby mrco » Thu Feb 18, 2010 1:17 pm

Do you use threads?
mrco
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Jan 15, 2010 11:31 am
Location: 2V Software

Postby cheops2006 » Thu Feb 18, 2010 3:38 pm

Hi,

Yes I do use threads

Ade.
cheops2006
Freshman
Freshman
 
Posts: 2
Joined: Wed Feb 17, 2010 1:24 pm

Postby P1000 » Thu Feb 18, 2010 11:32 pm

You could just show a dialog box over top of the SurfaceView, but if you want to fully replace the SurfaceView, I would use a ViewFlipper. Put the SurfaceView in as one child, and then put another View in as the second child and then you can easily switch between them. You can even do animated transitions between them very easily.
P1000
Junior Developer
Junior Developer
 
Posts: 12
Joined: Fri Feb 12, 2010 5:59 am

Postby mrco » Fri Feb 19, 2010 8:57 am

cheops2006 wrote:Hi,

Yes I do use threads

Ade.

Looks like you try to show view from non-UI thread. This problem you can solve with using AsyncTask or Handler objects. Here the sample threads_-_the_progress_bar_and_post-thread_action-t3876.html
mrco
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Jan 15, 2010 11:31 am
Location: 2V Software

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests