Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 1    Views: 84

Patrickmotox
Aspiring developer
Profile
Posts: 89
Reg: Dec 10, 2013
Cameron Park, C...
7,090
04/18/14 01:26 PM (10 years ago)

handleBackButton

edit 1. Figured it out. Dont need help any longer. hee hee.... I need some help. Android. If anyone knows. In the BT_activity_host is this reference to the back button. How to use it in a plugin, but I am confused. What are supposed use in the current plugin to handle this button. What I would like is all the plugins to use the back button as normal and for a specific plugin to ignore the back button. Are we calling something here???? any help much appreciated. use reflection to trigger a handleBackButton method in the current plugin...not all plugins implement this method...but can if it's needed. In most cases the handleBackButton method should "go back" by popping the current fragment off the stack with: getActivity().getFragmentManager().popBackStackImmediate(); java.lang.reflect.Method backMethod = null; try{ backMethod = currentFragment.getClass().getMethod("handleBackButton"); }catch(SecurityException e){ BT_debugger.showIt(activityName + ":onBackPressed. EXCEPTION (0): " + e.toString()); }catch(NoSuchMethodException e){ BT_debugger.showIt(activityName + ":onBackPressed. Current fragment does not have an "onBackPressed" method implemented"); } //fire the handleBackButton method if we found it... if(backMethod != null){ try{ backMethod.invoke(currentFragment); }catch(Exception e){ BT_debugger.showIt(activityName + ":onBackPressed. EXCEPTION (1): " + e.toString()); } } } } // } Never mind....... Figured it out...... finally... hee hee.
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
04/18/14 05:08 PM (10 years ago)
Now you can tell us the whole solution! Please do ... :-)
 

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.