Search Results

Search found 1 results on 1 pages for 'bamsbamx'.

Page 1/1 | 1 

  • How do I insert this subclass into my code?

    - by BamsBamx
    This is a very noob question so I hope you can help me with this... This is my built code: public class PantallaOpciones extends PreferenceActivity { private SharedPreferences preferences; @Override public void onCreate(Bundle savedInstanceState) { preferences = PreferenceManager.getDefaultSharedPreferences(this); findPreference("speechkeycode").setOnPreferenceClickListener(keycodedialog); Preference.OnPreferenceClickListener keycodedialog = new Preference.OnPreferenceClickListener(){ public boolean onPreferenceClick(Preference preference){ keycodedialog(); return false; }}; } private void keycodedialog(){ final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.keycodedialog); dialog.setTitle("Speech keycode"); final TextView keypresstext = (TextView) findViewById(R.id.keypresstext); Button savekeycode = (Button) dialog.findViewById(R.id.btnsavekeycode); savekeycode.setOnClickListener(new OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); Button resetkeycode = (Button) dialog.findViewById(R.id.btnresetvalue); resetkeycode.setOnClickListener(new OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } Okay, now I want to add this code to dialog: public boolean onKeyDown(int keyCode, KeyEvent event) { //SOME STUFF return super.onKeyDown(keyCode, event); } So I want to listen to a keypress when dialog is opened and show the keycode of hardware press by using textview.settext()... The question is: how do I insert public boolean onKeyDown into the dialog??? Thanks in advance!! :)

    Read the article

1