Question

I have a tabhost with 2 tabs inside my main activity, for the 2nd tab i added a list view intent as content. Everything is working fine. Now I have overriden onCreateDialog() method in the list view (2nd tab's), when i made a call to showDialog(MY_DIALOG); method onCreateDialog() is getting called but I'm getting a warning in the LogCat like

"WARN/InputManagerService(58): Window already focused, ignoring 
focus gain of:  com.android.internal.view.IInputMethodClient$Stub$Proxy@44ee6948"

Can anybody help me how to show the dialog box inside tabhost's activity.

//edit

protected Dialog onCreateDialog(int id) {
Log.v(Constants.LOGTAG, " " +CLASSTAG+ " onCreateDialog(): +++ START +++");
AlertDialog.Builder builder = new AlertDialog.Builder(this);        
switch (id) {
    case DIALOG_MY_TYPES: {
        Log.v(Constants.LOGTAG, " " +CLASSTAG+ " onCreateDialog(): DIALOG_MY_TYPES");
        CharSequence[] items = {"option1", "option2", "option3"};
        builder.setTitle("Select").setItems(items,
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int item) {
                    Log.d(CLASSTAG, "item selected = " + item);
                    dialog.cancel();
                }
            }).setNegativeButton("Cancel",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    Log.d(Constants.LOGTAG, " "+CLASSTAG+" Cancel button is clicked");
                    dialog.cancel();
                }
            }); 
    }

}//switch
alert = builder.create();
Log.v(Constants.LOGTAG, " " +CLASSTAG+ " onCreateDialog(): +++ END +++");
return super.onCreateDialog(id);                
}

Thanks in advance. -Nehatha

Was it helpful?

Solution

Change return super.onCreateDialog(id); to return alert;. I assume some other part of your Activity is calling showDialog(int). If not, then you'll either want to do so, or call the show method on the returned Dialog from onCreateDialog(id).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top