Problems with starting an activity in onStart

Posted by Fizz on Stack Overflow See other posts from Stack Overflow or by Fizz
Published on 2010-04-14T15:12:32Z Indexed on 2010/04/14 15:13 UTC
Read the original article Hit count: 179

Filed under:
|

Hello everyone. I'm trying to start a floating activity from onStart to retrieve some info from the user right when the initial activity begins. I have the following:

@Override
public void onStart(){
    super.onStart();
    callProfileDialog();
}

And callProfileDialog() is just:

private void callProfileDialog(){
    Intent i = new Intent(this, com.utility.ProfileDialog.class);
    startActivityForResult(i, PROFDIALOG);
}

ProfileDialog.class returns a String from an input box. If the result returned is RESULT_CANCELED then I restart the activity.

The problem I'm having is that when the program starts, the screen is just black. If I hit the Back button a RESULT_CANCELED is returned then the initial activity shows as well as the floating activity (since it recalled itself when it got a RESULT_CANCELED). Why can't I get the activities show by calling ProfileDialog.class from onStart()? I got the same result when I called it at the end of onCreate() which is way I switch over to use onStart(). Thanks for the help.

© Stack Overflow or respective owner

Related posts about android

Related posts about activity