i'm passing a rootView to setContentView:
root = (FlyOutMenu) this.getLayoutInflater().inflate(R.layout.activity_myLayout, null); setContentView(root); and the layout is defined like :
<com.android.xyz.view.viewgroup.FlyOutMenu.FlyOutMenu xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <RelativeLayout android:id="@+id/RelativeLayoutMain" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/dialog_label_topic" /> <EditText android:id="@+id/dialog_searchbar_topic" android:ems="10" > </EditText> <Button android:id="@+id/dialog_menu_topic" /> <GridView android:id="@+id/gv1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/dialog_searchbar_topic" android:layout_alignParentBottom="true" > </GridView> </RelativeLayout> As you can see, it's a code in a different package in the same application.
I have two packages in my application:
1) com.android.xyz.view.viewgroup.FlyOutMenu 2) con.android.xyz
in my second package in the MainActivity i Override the onKeyDown- method but it never gets invoked.
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { // TODO Auto-generated method stub Log.e("onKeyUp","Fired"); if(keyCode == KeyEvent.KEYCODE_BACK) { Log.e("fired with KeyEvent","true"); RelativeLayout.LayoutParams myLayoutParams = (android.widget.RelativeLayout.LayoutParams) gv.getLayoutParams(); myLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); gv.setLayoutParams(myLayoutParams); } return super.onKeyUp(keyCode, event); } I haven't attached any onFocus listener. The only View which requests Focus is my searchbar in my activity but it also doesn't have a Focus listener.
I tried following:
onKeyDown not always called in Android app
With no result... issue stays the same.
Any help is appreciated.
Does anybody know why this can't be invoked?
Thanks in advance