KeyEvent and GLSurfaceView

by Mike » Sat, 28 Nov 2009 07:30:43 GMT


Sponsored Links
 Hi,

as soon as there's a GLSurfaceView in use, no other views receive any
KeyEvents.
MotionEvents however, are still working as expected.
Is there a way to prevent GLSurfaceView from swallowing all KeyEvents?

--



KeyEvent and GLSurfaceView

by Jack Palevich » Sat, 28 Nov 2009 09:10:47 GMT


 I don't think you have fully identified the problem you are
experiencing. If you read the source for GLSurfaceView, you will see
that it does nothing special to handle KeyEvents. So the problem you
are having is probably unrelated to GLSurfaceView.




--


Sponsored Links


KeyEvent and GLSurfaceView

by Lance Nanek » Sat, 28 Nov 2009 09:59:24 GMT


 Are you sure that the view you are expecting to receive key events has
focus?




--



KeyEvent and GLSurfaceView

by sixones » Sat, 28 Nov 2009 21:53:36 GMT


 If your catching the events on GLSurfaceView then return false to
indicate that the event has not been handled yet (otherwise the event
wont bubble), if not try disabling focusable and focusableInTouchMode.






--



Other Threads

1. URLEncoder encode/decode

Hi,
I want to use the URLEncoder/URLDecoder class (java.net.URL...) in an
application and the methods : encode(String s, String enc)/decode(String s,
String enc), but I don't know what can be the value of the String argument
enc?
I want to encode/decode in the "x-www-form-urlencoded" MIME content type.
Thank you for your help.
Michal

--~--~---------~--~----~------------~-------~--~----~

2. I found the way how to SmsReceiver invoke my Application

public class MyActivity extends Activity
{

        public static MyActivity myactivity;

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        myactivity = this;

        // Check whether MyActivity is not launched by History (long press on
home)
        // if launched by History it may be get the un-wanted parameters had
been set by SmsReceiver before
        int flag = getIntent().getFlags();
        flag = flag & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY;
        if (flag != Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)
        {
                //Get parameter had put by SmsReceiver
                Bundle bundle = getIntent().getExtras();
                if (bundle != null)
                        {
                        String smsbody = (String) bundle.getString("SMS");
                        if (smsbody != null)
                        {
                                //Do some thing with smsbody
                        }
                }
        }
}

public class SmsReceiver extends BroadcastReceiver
{

        MyActivity myactivity;

        @Override
        public void onReceive(Context context, Intent intent)
        {
                myactivity = MyActivity.myactivity;

                //---get the SMS message passed in---
                Bundle bundle = intent.getExtras();
                SmsMessage[] msgs = null;
                String str = "";
                if (bundle != null)
                {
                        //---retrieve the SMS message received---
                        Object[] pdus = (Object[]) bundle.get("pdus");
                        msgs = new SmsMessage[pdus.length];
                        for (int i=0; i<msgs.length; i++){
                        msgs[i] = SmsMessage.createFromPdu((byte[])pdus
[i]);
                        str += "SMS from " + msgs[i].getOriginatingAddress
();
                        str += " :";
                        str += msgs[i].getMessageBody().toString();
                        str += "\n";
                        if (i == msgs.length-1)
                        {
                                address = msgs[i].getOriginatingAddress();
                                Msg = msgs[i].getMessageBody().toString();
                        }
                }

                //---display the new SMS message---
                try
                {
                        // if MyActivity is running either Frontground or 
Background
                        context.startActivity(myactivity.getIntent()); // just 
for in case
MyActivity is Background

                        /* Do some thing with myactivity.xxxx or 
myactivity.yyyy()  */

                }
                catch (Exception e) //in case myactivity had been closed
                {
                        //Launch new myactivity with parameter SMS = str;
                        Intent i = new Intent(context, aContext.getClass());
                        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        i.putExtra("SMS", str);
                        context.startActivity(i);
                }
        }
}
--~--~---------~--~----~------------~-------~--~----~

3. aidl remote service call namespace question

4. how to set tab in TabHost?

5. How to get phyaddr from MemoryHeapPmem??

6. Avoid phone locking

7. Change in font color