Discussion Forums  >  Uncategorized

Replies: 4    Views: 502

Zoid66
Lost but trying
Profile
Posts: 176
Reg: Oct 26, 2010
USA
1,760
11/11/10 11:42 AM (15 years ago)

HTML and Breadcrums

A few of the sites I link to do not have any bread crums such as if they expect the user to go back to the previous page they hit the back key on the phone. With in the app it takes them back to the 'main' screen. Any ideas has anyone got around this?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/11/10 12:29 PM (15 years ago)
This is a hassle and something I too struggle with. The idea was that the app creator would own the HTML page they used and be able to create their own back / forward buttons or whatever. Not in the nav bar but in the html itself. Because you don't control the HTML you're using, you won't be able to do this. For Android, they user can always use the main nav back button to Go Back, the one next to the home button on the hardware itself. This means the back button in the title bar could try to navigate back in the web-view and not back to the main menu. Like a browser back button. Three deep would need three back taps to return to menu. Tapping the Hardward button on the phone will always go back. To try this....in the Screen_CustomUrl.java file, inside the src directory, find the code for the back-button, it should look something like this: //back button.. ImageButton btnBack = (ImageButton) findViewById(R.id.btnBack); btnBack.setOnClickListener(new OnClickListener() { public void onClick(View v) { finish(); } }); Finish just means close the view and return to the menu. You could try something like this insde the publicVoid onClick(View v) block... if(browser.canGoBack()){ browser.goBack(); }else{ finish(); } The new back button code would then be like: //back button.. ImageButton btnBack = (ImageButton) findViewById(R.id.btnBack); btnBack.setOnClickListener(new OnClickListener() { public void onClick(View v) { if(browser.canGoBack()){ browser.goBack(); }else{ finish(); } } }); I'm not at my desk and just did this quickie. You may have to Google for the proper syntax or experiment a little.
 
Zoid66
Lost but trying
Profile
Posts: 176
Reg: Oct 26, 2010
USA
1,760
like
11/11/10 06:36 PM (15 years ago)
I added the code no errors but still worked as if no code was there... It just takes me back to the 'main' menu screen. I will keep at it and try a few more things. If something pops up thanks in advance.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/12/10 12:29 AM (15 years ago)
Are you sure you're working with the right Class file. It should be Screen_CustomURL.java if you are using a CustomURL screen. If you are using CustomHTML or CustomText then it's a different class file. I'm a bit behind on other projects and will look into this when I can. If you get it figured out first - let us know.
 
Zoid66
Lost but trying
Profile
Posts: 176
Reg: Oct 26, 2010
USA
1,760
like
11/12/10 07:13 AM (15 years ago)
I had to go back and refresh my emulator. Yes this works! Thanks..
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.