peterj
Apple Fan
Profile
Posts: 113
Reg: Jun 19, 2011
location unknow...
6,630
09/25/13 06:30 AM (12 years ago)

Android 3.0 - remove or hide BTM Search plug-in from app?

I have an app that uses the BTM Search plug in. Works great on iOS, but is not supported on Android. I'm using tabs, so the Search is accessed from a tab. Is there a way to remove or hide so the tab doesn't show? In earlier versions of BT code, I was able to delete the java and XML files for the plug-in, and the tab perfectly disappeared. In 3.0, I can't find any java or XML files in my project related to the search, so I'm not sure how to hide it.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
09/25/13 07:42 AM (12 years ago)
I don't have a definitive answer, but if you're willing to try fooling around with the code, I have a suggestion. Most of the setup of your tabs is done in your BT_activity_host.java file. If I were trying to hide a particular tab, I would figure out which tab it was (#0-4) and around line 424, 'after' the tab setup has been done and 'before' the "} else { // not using tabs" statement, adding the instruction: actionBar.removeTab(int); //<-- Where int is the number of the tab postion (0-4) Always save a safe unaltered copy of your code in case of emergency ;) Cheers! -- Smug
 
peterj
Apple Fan
Profile
Posts: 113
Reg: Jun 19, 2011
location unknow...
6,630
like
09/25/13 07:51 AM (12 years ago)
Thanks for the response Smug! I'm going to try that to see how it goes I got brave and tried something different, but I don't know if it's a good practice. I looked in the BT_activity_host.java file and found where the tabs are created. It's a for loop that runs code to create the tab, and runs once for the range of tabs I have. My search tab happened to be last, so where it had said for(int t = 0; t < my app_appDelegate.rootApp.getTabs().size; t++)() I changed it to for(int t = 0; t < 3; t++) because I have 3 tabs before the Search tab. So now the loop just runs 3 times, and stops short of drawing the Search tab I have no plugin for. It ended up working, but I don't know if this is a bad practice - sort of hard-coding the counter. I know it wouldn't be a good solution if I end up creating more tabs, but it does work, and I don't have plans for more tabs...
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
09/25/13 07:57 AM (12 years ago)
Nothing is bad practice if it always works, lol! If your search tab is the last tab, then what you have done is perfect, and shouldn't be an issue. Cheers! -- Smug
 
peterj
Apple Fan
Profile
Posts: 113
Reg: Jun 19, 2011
location unknow...
6,630
like
09/25/13 08:01 AM (12 years ago)
Thanks! Your way worked too, although I had to change it to actionBar.removeTabAt(int) to make it work (had to add "At"). Eclipse did a neat thing: when I entered actionBar.removeTab(int), it showed an X, and when I hovered over the underlined code, it suggested to change to actionBar.removeTabAt(int). So I did and it fixed it. I thought that was neat.
 

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.