2014년 12월 15일 월요일

Listpicker backpressed problem

I m working on a map tour, 
It works like this;  screen1 > listpicker1> google maps pages

When I hit back in listpicker menu and it doesnt go to main screen but to a google map page. 

Blocks caps is attached. 

*
im new to ai2.  I'm not sure but i think I need 2 blocks like below, 

" When listpicker1 backpressed
  Do call screen1 open"

*

How can i fix this?

Appreciate if you can direct me




To exit the screen that opened with the ActivityStarter, the simple way to exit to Screen1   is to use the 
Control block   open another screen screenName   ... Screen1     where you put Screen1 in a Text block.  Put these two blocks into the 

when Screen1.BackPressed do event handler.    Then you use the Android's Back Button to return to the main screen.



Thanks Steve.
 
You said, "Put these two blocks into the when Screen1.BackPressed do event handler." 

1- By saying "two blocks" you mean " When listpicker1 backpressed,   Do call screen1 open" right?

If so this is only my wish i dont think there is a way yo create these blocks.

2-  I dont know how to put blocks into handler. that isanother problem of mine. i'm realy fresh : )

3- You said Android's Back Button, I assume that you mean andoid device's back button. right?



You really should read the  AI2 free online eBook  http://www.appinventor.org/book2 ... the links are at the bottom of the Web page before you do much more programming. It teaches how to program with App Inventor Blocks.



some notes:
the screen.backpressed event will not be triggered if you press the back button while you are in the listpicker...so this will not help here
also using the open another screen "Screen 1" block to open Screen1 generally is a bad idea, why see here:http://puravidaapps.com/manager.php
There is only one exception you can do this, and this is if you are using the Tribblehunter method of switching screens  http://puravidaapps.com/tribblehunter.php
but as far as I understand the problem, you only have Screen1 and open Google Maps with the Activity Starter...

coming back to the issue: actually I do not understand it
if you press "back" in the listpicker, you are back in Screen1
if you press back in Google Maps, you are back in your app
see also attached mini example project...
does it work for you as expected in the attached example project?
Taifun




댓글 없음:

댓글 쓰기