Screen flip-out on G1

by Kirk » Wed, 29 Apr 2009 02:08:24 GMT


Sponsored Links
 What event in an Activity is called when the screen is flipped out to
expose the keyboard on a G1? I need to save some instance variables,
but it seems like onCreate is being called without onPause, onStop, or
saveInstanceState being called first.

Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~



Screen flip-out on G1

by Yusuf T. Mobile » Wed, 29 Apr 2009 06:21:09 GMT


 Normally the activity is destroyed and recreated when Android detects
rotation, unless you specify that you want your activity to handle
events like turning the phone on its side or the keyboard opening.

It's documented here: 
 http://developer.android.com/reference/android/content/res/Configuration.html 
You can read more about rotation here: 
 http://androidguys.com/?tag=android-rotation 
and  http://www.devx.com/wireless/Article/40792/1763/page/5 

Some tutorials you may come across may be obsolete on one point: there
used to be only the flag keyboardhidden, but Android recently added
hardKeyboardHidden, to handle the case of soft keyboards.

onSaveInstanceState() and onDestroy() should be called before your
activity is killed and revived, I'm not sure why you don't see it.



Yusuf Saib
Android
T  Mobile stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.





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


Sponsored Links


Screen flip-out on G1

by Kirk » Thu, 30 Apr 2009 06:00:37 GMT


 Thanks Yusuf,

I'll take a look at those articles, hopefully they will help!

Kirk




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



Other Threads

1. AlarmManager problems in Milestone

Hi All,

I'm having some strange behavior of wakeup alarms scheduled by
AlarmManager in Motorola Milestone (Droid in US). The thing is that
they don't wake the device as they should. The same piece of code
works fine in Samsung Galaxy and the alarms are fired as they should
fire. In Milesstone when the device is in sleep no alarms are fired
but all the alarms are fired at once when the device wakes up. I also
found out that Milestone doesn't have the /proc/wakelocks file to
check the wake lock info but I'm not sure if that has something to do
with the problem. For this scenario there is no reason to acquire a
wakelock because the AlarmManager acquires it automatically for
lifetime of the OnAlarmReceive. I found some other threads about the
same problem in Droid/Milestone, but does anybody have an idea what is
the problem and is there anyway to solve it.

This is the code that I'm using to test this.

/**
* Broadcast receiver for the device boot
*
*/
public class OnBootReceive extends BroadcastReceiver{

        @Override
        public void onReceive(Context context, Intent intent) {
                Intent i = new Intent(context, OnAlarmReceive.class);
                PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0);
                AlarmManager m =
(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
                m.setRepeating(AlarmManager.RTC_WAKEUP, 
System.currentTimeMillis()
+10000, 5*60*1000, pi);
        }
}

/**
* The alarm receiver
*
**/
public class OnAlarmReceive extends BroadcastReceiver {

        @Override
        public void onReceive(Context context, Intent intent) {
                Log.d("AlarmTester", "Alarm fired " + new Date());

                File log=new File(Environment.getExternalStorageDirectory(),
"AlarmTesterLog.txt");

                try {
                        BufferedWriter out=new BufferedWriter(new
FileWriter(log.getAbsolutePath(),       log.exists()));

                        out.write("Alarm fired " + new Date().toString());
                        out.write("\n");
                        out.close();
                }
                catch (IOException e) {
                        Log.e("AppService", "Exception appending to log file", 
e);
                }
        }
}

-Mika

-- 

2. Djuragan pasar malem udah buka.

Barusan di email ama djuragan pasar malem, judulnya invitation, suruh maen ke 
lapaknya. Dan udah ane coba lancar.
Selamat berbelanja.

:D


Sent from my kenwood TR-9130

-- 
"Indonesian Android Community [id-android]" 

3. OOT : WTS/WTT Nokia E71 Blacksteel

4. Kill/Stop other Services in API 8 (Froyo 2.2)

5. OOT: WTS tour 9630 2nd

6. OOT: pejing Tio Ping

7. how to restore sms?