In my Android application, I used the custom view to load as a view of an activity. Want to know if the user clicks on the menu button or not? The following code will explain the scenario.
My custom view class: My problem is that I do not want to capture this incident from the activity class, I want to capture it from the visual category, but when I press the Menu key try it,
Public class libraryHomeview linerLayout tool is expanded OnKeyListener {// variable dec goes here. Public LibraryHomeview (Context reference, AttributeSet attrs) {super (references, attrs); Init (references, attrs); } Override public private in init (context insert, AttributeSet at) {// custom view implementation goes here ...} @ (see V, int kikod, key event event) {if (keycode == KeyEvent.KEYCODE_MENU ) {Log. D (TAG, "KeyEvent.KEYCODE_MENU"); Back true; }}
OnKey () method.Any help ??
public boolean ons (int keycode, keyEvent Event) {if (keycode == KeyEvent.KEYCODE_MENU) {// do something ...} right back; } // Tudo Auto-generated Constructor Stub Set Focusable (True); }
Comments
Post a Comment