I got stuck a few days ago and I don't seem to make any headway so
hopefully someone can help me.

I want to set a key in my settings after the click of a button, but I
can't add a keylistener to the View.OnClickListener or to the View
arg0. Then I made it like this:

bUP2.setOnClickListener(new View.OnClickListener() {
          public void onClick(View arg0) {
                        Toast.makeText(Keyinput.this, "Give key Player 2 UP",
Toast.LENGTH_LONG).show();
                        View.OnKeyListener vok = new View.OnKeyListener() {
                        public boolean onKey(View v, int keyCode, KeyEvent 
event) {
                                        System.out.println("------------------> 
onKey "+keyCode);
                                        editor.putInt("UP2", keyCode);
                                        editor.commit();
                                        return true;
                                }
                         };
                        arg0.setOnKeyListener(vok);
          }
});

Do I have to focus to the new View somehow? Or is there a simpeler
solution?

Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to