I got rid of the AlertDialog, and modified my code to use the
ThemeDialog approach. I made sure that I added the attribute
android:theme="@android:style/Theme.Dialog"  to the Android Manifest
file for my application. However I get the same problem. If I comment
out the code in the onWindowFocusChanged then the CountDown Activity
display, but of course it does not change. A couple of times the
screen displayed correctly when the code was uncommented. However it
only displayed for screen that showed up before when the code was
commented out. I think is some sort of cached screen for faster
access, so I don't get my hopes up.

Do you guys have any other ideas? On a lighter note, The display of
the dialog is much fast now than before when I was callling
AlertDialog.Builder.

Thanks,

Skooer


On Dec 30, 5:00 am, Skooter Columbo <[email protected]> wrote:
> yea, i was using the AlertDialog, and I used the AlertDialog.Builder
> to create it. I will try what you suggested.
>
> Thanks,
>
> Skooter :-)
>
> On Dec 30, 3:38 am, "RAJENDIRAN SUNDARRAJAN-CPB738"
>
>
>
> <[email protected]> wrote:
> >  Hi..
>
> > Yes you are correct that the Launch timeout expiry gives the wake lock.
> > In AlertDialogs the "screen becoming black" depends on the way you
> > create it ..
> > Please refer the topic "Opening a New Screen"  
> > fromhttp://code.google.com/android/kb/commontasks.html. Make sure if you
> > are using the third option of creating a dialog then the attribute
> > android:theme="@android:style/Theme.Dialog" need to be added in the
> > manifest xml of that activity using the dialog.
>
> > - Sundar
>
> > -----Original Message-----
> > From: [email protected]
>
> > [mailto:[email protected]] On Behalf Of Skooter
> > Columbo
> > Sent: Tuesday, December 30, 2008 2:47 PM
> > To: Android Developers
> > Subject: [android-developers] Screen Goes Black Between Activities, and
> > Next Activity never shows up.
>
> > From my MainActivity the user can click a button that shows a dialog.
> > From this dialog the user can set the number of minutes and number of
> > seconds from a custom Timer component, and click a start button. When
> > they click start, this is the OnClickListener that gets invoked.
>
> >    public void onClick(DialogInterface dialog, int whichButton) {
> >         AlertDialog alertDialog = (AlertDialog)dialog;
> >         Timer timer = (Timer)alertDialog.getWindow().findViewById
> > (R.id.timer);
>
> >         Intent intent = new Intent(MainActivity.this,CountDown.class);
> >         intent.putExtra(KEY_MINUTES, timer.getMinutes());
> >         intent.putExtra(KEY_SECONDS, timer.getSeconds());
> >         startActivity(intent);
> >         //startActivityForResult(intent, ACTIVITY_COUNT_DOWN);
> >    }
>
> > As you can see it is sent to the CountDown activity. What is supposed to
> > happen is the minutes and seconds that the user selected from the dialog
> > are displayed on the CountDown screen, and they begin to count down and
> > an explosion sound is played when zero is reached. What is really
> > happening, For some reason the screen goes black, and nothing is
> > displayed, however the explosion is played 30 seconds later if user
> > selected 30 seconds. The CountDown Activity has two methods onCreate and
> > onWindowFocusChanged. OnCreate is used to set up the view and
> > onWindowFocusChanged is used to count down and update the view as each
> > second pasts. I put the count down code in the  onWindowFocusChanged
> > because it there is no user intervention except to watch the time count
> > down, and according to the android documentation this is the best
> > indicator that the activity is visible to the user.http://
> > code.google.com/android/reference/android/app/
> > Activity.html#onWindowFocusChanged(boolean). See my code below.
>
> >    protected void onCreate(Bundle savedInstanceState) {
> >        super.onCreate(savedInstanceState);
> >        setContentView(R.layout.count_down);
>
> >        //instantiate the components
> >        mMinutesText = (TextView)findViewById(R.id.count_down_minutes);
> >        mSecondsText = (TextView)findViewById(R.id.count_down_seconds);
> >        cancelButton = (Button)findViewById(R.id.count_down_cancel);
>
> >        Bundle extras = getIntent().getExtras();
> >        mMinutes = extras.getInt(KEY_MINUTES);
> >        mMinutesText.setText(mMinutes);
>
> >        mSeconds = extras.getInt(KEY_SECONDS);
> >        mSecondsText.setText(mSeconds);
>
> >        cancelButton.setOnClickListener(new View.OnClickListener() {
> >             public void onClick(View view) {
> >                 mIsCountingDown = false;
> >         setResult(RESULT_OK,new Intent());
> >         finish();
> >             }
> >         });
> > }
>
> > @Override
> > public void onWindowFocusChanged(boolean hasFocus){
> >     super.onWindowFocusChanged(hasFocus);
> >     if(hasFocus){
> >         countDown(mMinutes,mSeconds);
> >         if(mMinutes == 0 && mSeconds == 0){
> >         MediaPlayer mp = MediaPlayer.create(this, mSound);
> >         mp.start();
> >         }
>
> >         Intent mIntent = new Intent();
> >         setResult(RESULT_OK,mIntent);
> >         finish();
> >      }
> > }
>
> > Here are logs from LogCat. I am wondering if this "Launch timeout has
> > expired, giving up wake lock!" is the problem. If this is the problem
> > then what is causing it
>
> > 12-30 02:40:31.926: INFO/ActivityManager(53): Displayed activity
> > com.android.myapp/.CountDown: 14992 ms
> > 12-30 02:41:40.408: INFO/ActivityManager(53): Starting activity:
> > Intent { comp={com.android.myapp/com.android.myapp.CountDown} (has
> > extras) }
> > 12-30 02:41:50.454: WARN/ActivityManager(53): Launch timeout has
> > expired, giving up wake lock!
> > 12-30 02:41:50.549: WARN/ActivityManager(53): Activity idle timeout for
> > HistoryRecord{43524f10 {com.android.myapp/ com.android.myapp.CountDown}}
> > 12-30 02:42:00.166: INFO/ActivityManager(53): Displayed activity
> > com.android.myapp/.CountDown: 19743 ms
>
> > Any guidance someone can provide would be very helpful.
>
> > Skooter :)- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to