CodeBuster
I hate code!
Profile
Posts: 26
Reg: Jan 04, 2012
Bedford, TX
10,260
03/15/12 07:52 PM (13 years ago)

Android v1.5 Problems - Several

I'm having a few problems with getting the Android version of my apps to run properly. They work fine on the iPhone but I need a little help to get these running. First problem was the 'Wheel of Death' progress graphic never leaving the screen. <<<<Solution: This one is cured thanks to this forum. Commenting out a showProgress worked. BT_screen_customHTML.java (line 132) and BT_screen_customURL.java (line 132). Thank you Fred! >>>> Second problem is with Google Maps. The world map shows but the zoom never happens and the pins don't drop. Apple version works fine with same data. I strongly suspect this problem relates to #4 below since a cookie is supposed to be stored which is passed to the map location screen to generate the map items.<<<<Status: buzztouch uses a technique to access the map items that does not send a cookie up to the server. In this instance, a cookie is needed. Will research more.>>>> Third problem is not getting a Javascript confirm dialog to show up. I need that to confirm deletion of some data. I suspect a relationship with problem #4 - Javascript not working properly in the current setup. Some searching leads me to believe I need to be using webChromeClient in addition to WebView or install some sort of bridge between them. I found this ... ------------------------------------------------------ One should use a WebChromeClient to get these alerts and the functionality can be overwritten using the onJsAlert() method. Hope this helps! WebView wv = new WebView(this); wv.setWebChromeClient(new WebChromeClient() {@Override public boolean onJsConfirm(WebView view, String url, String message, JsResult result) { //Required functionality here return super.onJsConfirm(view, url, message, result); } } add this code in the onCreate of your WebViewActivity. This will solve your problem. ----------------------------------------------- ... at http://code.google.com/p/android/issues/detail?id=752#c12 but alas, where is my WebViewActivity in the buzzTouch scheme of things. <<<<Resolved for V1.5: For Android V1.5 the following seems to work: In BT_screen_webView, add the following to the import list: import android.webkit.WebChromeClient; Around line 120 in BT_screen_webView.java you will find a line that reads: webView.setWebViewClient(new WebViewClient(){ Before this line insert: webView.setWebChromeClient(new WebChromeClient()); Both javascript alerts and confirms work. Did not test prompt. As a tip, hold your cursor over 'WebView' in the definition of webview just above the inserted line mentioned above for a great insight into how WebView works and what is needed. For cross device application support, I would suggest that the buzzTouch webview in android should be constructed in such a way as to be equivalent in function to that found in IOS including Javascript support and HTTP cookie handling.>>>>> Fourth problem is not being able to set cookies from a redirected URL. That is, the URL in the custom URL page is a.php which redirects to b.php which tries to set a cookie. Apple version works fine with same data. This appears to be the cause of #2 above. Fifth problem is the button on the right side of the navigation bar comes up light gray with white lettering which makes it impossible to read. What is the best way to go about making cosmetic color changes like this since most of the background color preferences defined in the screen seem to be ignored?<<<<Solution: I dug into the code and changed the background color of the button to DarkGray.>>>> Sixth problem is that the graphics used for the menu-list are very tiny compared to those on the iPhone. How do I adjust the size of those icons or do I need to use different ones on the Android than on the iPhone? <<<<Solution: I used larger graphics on the Android than on the iPhone.>>>> Seventh problem is not being able to find the refresh content button to refresh changes made from the control panel. How do I refresh an Android app like I can with the iPhone app? <<<<Fixed: Use Menu button on phone. Thanks Fred.>>>> Eighth problem is getting my HTC Thunderbolt hooked up to my pc like I had the iPhone hooked up to the Mac to see the traffic going back and forth between the devices. I could not get the emulator to work, so I gave up. I'm installing HTC Sync which I hope will let Eclipse and the Android talk. Is there a better way to get those two talking to assist in debugging?<<<<Solution: Do as raveyd says below. Add HTC Sync. Device shows up when starting Run/As Android App. Can't be added with the emulator builder. Be sure to have debuggable set to true in the manifest.>>>> Thanks ahead of time for any help on these problems. This forum has been helpful before and your help would be greatly appreciated. If you want to see the apps in their current state, I can post their web addresses.
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
03/15/12 08:20 PM (13 years ago)
Seventh problem is not being able to find the refresh content button to refresh changes made from the control panel. How do I refresh an Android app like I can with the iPhone app? Devices menu button Click it when your at the apps homescreen Fred
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
03/15/12 08:24 PM (13 years ago)
Sixth problem is that the graphics used for the menu are very tiny compared to those on the iPhone. How do I adjust the size of those icons or do I need to use different ones on the Android than on the iPhone? Adjust the menu button icons graphics may/should work On small devive 65 will give you 4l buttons across 90 three across Play around with it. Fred
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
03/15/12 08:31 PM (13 years ago)
Fifth problem is the button on the right side of the navigation bar comes up light gray with white lettering which makes it impossible to read. What is the best way to go about making cosmetic color changes like this since most of the background color preferences defined in the screen seem to be ignored? I not certain (poor memory, need upgrade) but I think you can replace the image used. Go to assets > BT_images If you see the image you can replace it. Just be sure to use the same file name & type. red_dot.png remains red_dot.png even if it's now a yellow dot. Fred
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
03/15/12 08:37 PM (13 years ago)
Eighth problem is getting my HTC Thunderbolt hooked up to my pc like I had the iPhone hooked up to the Mac to see the traffic going back and forth between the devices. I could not get the emulator to work, so I gave up. I'm installing HTC Sync which I hope will let Eclipse and the Android talk. Is there a better way to get those two talking to assist in debugging? Unless your using the debug consol to find problems just export signed .apk and refresh. Most Android users quickly learn that there's no need or advantage to have the device connected. Fred
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
03/15/12 11:54 PM (13 years ago)
Hi @CodeBuster, I think you've stumbled on one drawback of design once for two platorms, and that's that iPhone renders the same design differently than Android does. For my apps, in all cases, I have had to create two different apps - one for iOS, and one for Android. The issue becomes that when you make adjustments for one platform, they show up on the other platform, and it may not always be what you were expecting. The only way to make this work, that I've found, is to create individual apps. Mark
 
CodeBuster
I hate code!
Profile
Posts: 26
Reg: Jan 04, 2012
Bedford, TX
10,260
like
03/15/12 11:57 PM (13 years ago)
@GoNorthWest I think you're right. In the future I will most likely build separate apps. For this one though, seems to me that I'm not doing anything too special except in the Custom URL arena with redirects. I've already accepted the significant difference in appearance between the apps - that was an unexpected surprise. But the functionality is all there and the apps are so close that if it can be pulled off, it shows some interesting capabilities for buzzTouch - write once and run many places. Very compelling.
 
CodeBuster
I hate code!
Profile
Posts: 26
Reg: Jan 04, 2012
Bedford, TX
10,260
like
03/16/12 12:14 AM (13 years ago)
@Fred, thanks for the tip on #7. I'm sure that's written somewhere and I just missed it. I got the Back key all right but this one escaped me till now. I don't think I'm clear on what you mean for #6, the menu-list icons. Are you saying that I need to use different icons or is there a way to scale up the 32x32px icons I'm using on the iPhone? On #5, bad background for the right navigation button, I looked at BT_images but nothing stood out. I guess I'll have to dig into the code where they display that and see if I can make some changes. For #8, that's what I've been doing - export the .apk and upload it to a server and download it from there. I miss seeing the buzzTouch trace traffic between the devices, though. Thanks for your help.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
03/16/12 12:21 AM (13 years ago)
@CodeBuster, Yep, write once and run in many places is very compelling. The limitation that I've run into, and which causes me to create two different apps, is that not all the functionality I need exists for both platforms in the same buzztouch version. So, gotta write twice. If you need help setting up an emulator, check out this document : http://www.buzztouch.com/resources/Setting_Up_Your_Android_Development_Environment_v1.3.pdf There's some step-by-step info there. Feel free to ping me if you want to work through it. It's really not all that hard (though there are some pain points for sure). Finally, regarding #6, you can only specify the icon sizes in general in your app. So, if they have to be different for the different platforms, then I think you have to create different apps. I may be wrong on this, but that's how it seems to work to me. Mark
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
03/16/12 06:30 AM (13 years ago)
Regarding #6: I thought you had two apps. You can specify icon size but it'll be difficulty with just one. Fred
 
CodeBuster
I hate code!
Profile
Posts: 26
Reg: Jan 04, 2012
Bedford, TX
10,260
like
03/16/12 02:13 PM (13 years ago)
@Fred, actually there are 4 apps - two iPhone apps that are complete and two matching Android apps that I'm working on. I'll just have to find some bigger icons to use for android and put them in the BT_images folder. I fear I'm missing something related to screen resolution when I do that though.
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
03/16/12 02:24 PM (13 years ago)
Just to be clear that makes 4 buzztouch apps in the control panel, correct? Fred
 
CodeBuster
I hate code!
Profile
Posts: 26
Reg: Jan 04, 2012
Bedford, TX
10,260
like
03/16/12 02:31 PM (13 years ago)
No, that means 2 buzzTouch apps in the control panel. I select the appropriate device, either iPhone or Android when I request a source code download. That's worked so far except for the few problems I've described here. Just download and complile/export and it works. They look different but act pretty much the same.
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
03/16/12 03:17 PM (13 years ago)
That a very difficult act to complete. Image layout is difficult. Problems #2-4 are probably related to using naming conventions that work in iOS but not Android. Fred
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
03/17/12 04:31 PM (13 years ago)
@Fred, I use my HTC (Wildfire) for debugging. All I did was set my phone for debugging (Menu > Settings > Applications > Development > Tick 'USB Debugging'), plugged it in, fired up the emulator in eclipse and it detected my device - no other settings needed. As you've got an HTC, it might be an easy set up for you too.
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
03/17/12 04:59 PM (13 years ago)
@raveyd, CodeBuster has the HTC, I appreciate the info also. Any insight into problems #2 -4 Fred
 
CodeBuster
I hate code!
Profile
Posts: 26
Reg: Jan 04, 2012
Bedford, TX
10,260
like
03/18/12 07:27 PM (13 years ago)
@raveyd, thanks for the tip on getting the HTC to work directly with Eclipse. Makes debugging much easier.
 
CodeBuster
I hate code!
Profile
Posts: 26
Reg: Jan 04, 2012
Bedford, TX
10,260
like
04/10/12 12:45 PM (13 years ago)
Item #3, no javascript, was resolved as follows: For Android V1.5 the following seems to work: Add to the import list in BT_screen_webView: import android.webkit.WebChromeClient; Around line 120 in BT_screen_webView.java you will find a line that reads: webView.setWebViewClient(new WebViewClient(){ Leave the above line in place and before that line insert: webView.setWebChromeClient(new WebChromeClient()); Both javascript alerts and confirms work. Did not test prompts. As a tip, hold your cursor over 'WebView' in the definition of webview in BT_screen_webview just above the inserted line mentioned above for a great insight into how WebView works and what is needed. For cross device application support, I would suggest that the buzzTouch webview in android should be constructed in such a way as to be equivalent in function to that found in IOS including Javascript support and HTTP cookie handling.
 

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.