javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
03/11/12 03:14 PM (13 years ago)

HOW TO: Fix BTM Advanced Menu to work with ALL Android Phones & Graphics

This guide is especially useful if you already have an iPhone app that uses the BuzzTouchMods Advanced Menu, and you are porting the app to Android. This fix prevents the need for you to create new, appropriately sized header images, and allows the BTM plugin to work on all Android phones (even those with large screens), which it natively does not. This simple guide assumes you have the app launching, and operational. It aims to fix some of the bugs, mainly that images don't load on large devices (which is most decent android phones). If you do not have the app running, and the menus working, please post below and we'll see what we can do. So, to get the header images working on ALL android phones: ------------------- (1) Go to BT_Device.java. (2) Press CONTROL + F to search the file. In the SEARCH box, enter " if(this.deviceWidth > 600){ " without the quotes. In the REPLACE box, enter " if(this.deviceWidth > 1000){ ", again, without the quotes. (3) Save the file. (4) Now, navigate to the file "BT_screen_menuListSimpleAdvanced". (5) Using CONTROL + F, find the snippet of code including "headerImageHeight = Integer.parseInt(BT_strings.getStyleValueForScreen(this.screenData, "headerImageHeightSmallDevice", "0")); " (6) Comment out the two lines "headerImageHeight..." and "headerImageWidth..." (7) Just above where you commented out the lines, copy in the following code: headerImageHeight = 200; headerImageWidth = 550; Basically, this change disables the app from pulling the image size from the app, and allows you to set your own image sizes. This is especially important if you are using the same BT App for iPhone as Android, as the two use different image size ratios. If you do not have an iPhone app using the same BT app, then you can skip this step (step 7). (8) Now, you must tell the app to fill the entire region you specified above with the graphic. This eliminates you from having to create new, custom sized graphics, if you already created them for the iPhone. Do a search in the same file for the following code snippted: headerImageView.setScaleType(ImageView.ScaleType.CENTER); Replace CENTER); in the last portion of that line with FILL_XY); ----------------------------------------------- Easy! This now converts your iPhone header images to Android 100% working header images. NB: A basic understanding of coding may be required to port your app across from iPhone to Android if it uses the BTM Advanced Menu. The steps above are relatively easy- the hardest bit of your port will be eliminating all of the errors. A further tutorial will be available soon.
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
03/11/12 05:02 PM (13 years ago)
Excellent, Fred
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/11/12 05:11 PM (13 years ago)
Cheers, Fred.
 
Goro
Apple Fan
Profile
Posts: 14
Reg: Jan 04, 2012
Sydney
140
like
03/14/12 01:35 AM (13 years ago)
Hi Javooooo, I had errors by followed your instruction number (8). Do you mean by replace CENTER to FILL_XY? headerImageView.setScaleType(ImageView.ScaleType.CENTER); headerImageView.setScaleType(ImageView.ScaleType.FILL_XY); Please help, thanks
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/14/12 01:40 AM (13 years ago)
Hi Goro, Yes, that's what I meant. Just replace CENTER with FILL_XY. I'll edit the post and clarify that.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/14/12 01:42 AM (13 years ago)
So, to clarify once again, that section of code would become: //setup header imageView. It's hidden until the image is set... RelativeLayout.LayoutParams hdrLp = new RelativeLayout.LayoutParams(headerImageWidth, headerImageHeight); hdrLp.addRule(RelativeLayout.CENTER_HORIZONTAL); if(headerImageTopPos > 0){ hdrLp.setMargins(0, headerImageTopPos, 0, 0); } headerImageContainer.setLayoutParams(hdrLp); headerImageView.setMinimumHeight(500); headerImageView.setMinimumWidth(900); headerImageView.setScaleType(ImageView.ScaleType.FIT_XY); headerImageView.setVisibility(View.INVISIBLE); //find the image...
 
Goro
Apple Fan
Profile
Posts: 14
Reg: Jan 04, 2012
Sydney
140
like
03/14/12 01:46 AM (13 years ago)
Thanks for your prompt response. Eclipse comes up with red cross error right next to the code. FILL_XY also comes with red line underneath. Is anything i did wrong?
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/14/12 01:49 AM (13 years ago)
:O Works fine for me... Hmm.... Is it in caps? What does Eclipse suggest you replace it with (usually it gives "quick fixes"). Can you copy me the code from: //setup header ImageView... to //find the image... like I did above, so I can compare the two? Cheers. I generally find that sometimes Eclipse has a little tanty over nothing, so copy the entire line, then delete it, then paste it back in. Generally works for any unexplainable errors i have!
 
Goro
Apple Fan
Profile
Posts: 14
Reg: Jan 04, 2012
Sydney
140
like
03/14/12 02:17 AM (13 years ago)
It works now. Thanks for clarify that. I still have tons of errors to compile this android project. Do we still need to install the Header Image plugin to make this works? I still got lots of errors with other .java files like below. Its like a pattern display errors with all other plugin java files. Weird... BT_screen_settingDevice.java BT_screen_settingLocation.java BT_screen_menuButtons.java BT_screen_menuListSimpleAdvanced.java BT_screen_excelDoc.java BT_screen_pdfDoc.java BT_screen_wordDoc.java BT_screen_pptDoc.java BT_screen_images.java BT_screen_settingLogin.java BT_screen_settingDevice.java BT_screen_map.java BT_screen_customHTML.java BT_screen_customURL.java BT_screen_splash.java
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/14/12 02:21 AM (13 years ago)
Clean your project, and then try deleting the proct from Eclipse and re-adding it- usually fixes everything when I get a billion errors from a mystery problem! Yeah, Android is kinda glitchy imo. What are some of the errors you are getting (reference just one or two of the errors from the error log, no need for all). Sounds like it's not liking your generated java file.
 
Goro
Apple Fan
Profile
Posts: 14
Reg: Jan 04, 2012
Sydney
140
like
03/14/12 03:49 AM (13 years ago)
I know, It's really pain in the ass. Xcode seems to have much less hassle than Android.... It works perfectly from buzztouch, debug free. Some of errors shown in eclipse are zero cannot be resolved or is not a field BT_screen_images.java webView cannot be resolved or is not a field BT_screen_htmlDoc.java The type BT_screen_menuListSimple is already defined BT_screen_menuListSimple.java The public type BT_screen_menuListSimple must be defined in its own file BT_screen_menuListSimpleAdvancedBackup.java openWithButton cannot be resolved or is not a field BT_screen_pdfDoc.java one cannot be resolved or is not a field BT_screen_images.java documentTypeIcon cannot be resolved or is not a field BT_screen_wordDoc.java
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/14/12 03:54 AM (13 years ago)
Oh gawd. I got those errors too. Does it say something about the compiler level, or the /gen file? Speaking of which, can you see a file in /gen? Honestly, the apps don't even look that great on Android to warrant the effort. It looks especially bad in my app as all the headers are different heights, and the fix above sets a static height. So some of my images are distorted etc. Frustrating, I agree! I have an Android device as a phone, but for development Apple is heaven (apart from the review process of course).
 
Goro
Apple Fan
Profile
Posts: 14
Reg: Jan 04, 2012
Sydney
140
like
03/14/12 04:21 AM (13 years ago)
Yes, I can still see some files under /gen Agree, I bet it must be the plugin, it was never mentioned can work with android. Just posted a feedback on buzztouchmods, Hopefully David can come up with some solutions. Or else by remove those plugins become the only option I suppose.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/14/12 04:24 AM (13 years ago)
Hmm.. I'm not at my computer right now (I patrol the forums on my phone, lol) but will check your error out tomorrow our time.
 
Goro
Apple Fan
Profile
Posts: 14
Reg: Jan 04, 2012
Sydney
140
like
03/14/12 04:32 AM (13 years ago)
No pro! thanks for your precious time and help. Take care buddy!
 
Dana T
Aspiring developer
Profile
Posts: 63
Reg: Feb 19, 2012
USA
4,230
like
03/16/12 06:36 PM (13 years ago)
Thanks for this post...really helpful. I'm stuck on step 4 because I dont have this: BT_screen_menuListSimpleAdvanced in my eclipse. I was afraid to look for it and continue elsewhere so that it doesn't mess up other things.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/16/12 06:52 PM (13 years ago)
Dana, Are you using the mod from BuzzTouchMods.com? Have you looked in all the folders?
 
Dana T
Aspiring developer
Profile
Posts: 63
Reg: Feb 19, 2012
USA
4,230
like
03/16/12 07:03 PM (13 years ago)
No, I am not. I was under the impression that it was only necessary for porting from iPhone App...guess not?
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/16/12 10:49 PM (13 years ago)
Nope, you'd need to be using BT 2.0 server and be using the BTM Mod to allow header images on menus in 2.0. Thanks.
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
03/29/12 08:55 AM (13 years ago)
Hi javooooo, wondering if you know how I can use different size icons for large and small devices in Android...I ended up setting device width to 1000 as you suggested and also tweaked the row.xml file for wider menu rows. not the best solution but seems ok...the menu list icons being too small on larger devices is my problem now...thanks for any help!
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/29/12 12:38 PM (13 years ago)
Hey Ian, I wasn't even able to get the icons to show up, so... Sorry I couldn't be of more help!
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
03/29/12 03:11 PM (13 years ago)
No worries, thanks!
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
04/14/12 12:16 PM (13 years ago)
Awesome guide javo! Would you be willing to submit this to BuzzTouchMods.com?
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
04/14/12 04:27 PM (13 years ago)
@MrDavid, I'd definitely be willing! I'd love to help.
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
04/14/12 04:30 PM (13 years ago)
Awesome! We could use all the support we can get for the users who use BTM plugins. You can submit your guide here: http://buzztouchmods.com/submit.php?stype=d (be sure to be logged in!) I'll personally make sure to get it approved instantly :) Also, send me a email: david . shelechi @ gmail . com Take care! David. http://buzztouchmods.com
 

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.