I think I've found a small bug, probably related to the WindowManager
and possibly introduced in doughnut.

It happens when displaying an alertDialog, with a certain type and
amount of text in it, and then switching to landscape mode, when in
full screen. It's actually so specific, I doubt many people will
encounter it, but it just so happens that I did and it took a while to
figure out, so here's how to reproduce it:

If I start in landscape mode with my AlertDialog, everything works
fine. It's only when I change to landscape mode at run time from
portrait mode while my AlertDialog is displayed do I see the bug: once
in landscape, the status bar appears briefly, then dissapears leaving
the AlertDialog slightly mispositioned (sometimes the status bar never
goes away). The WindowManager also moans in the logs: "Layout repeat
aborted after too many iterations" a few times.

The text that is in the AlertDialog matters, I've distilled it as much
as I can:
#1 - there needs to be at least one line of text that is long enough
to wrap when in protrait mode AND
#2 - there need to be enough lines of text to fill up the vertical
space available in the default AlertDialog when displayed in portrait
mode so that the internal scroll thing is triggered

I'm using a G1 (1.6) and unfortunately I haven't been able to test in
my 1.5 emulator as it refuses to go into landscape.

This code reproduces the error:

For the activity Class:

public class LandscapeTest extends Activity implements
DialogInterface.OnClickListener {

        private AlertDialog.Builder alertBuilder = null;
        private AlertDialog alertDialog = null;

        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags
(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                                        
WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.main);



        alertBuilder = new AlertDialog.Builder(this);
        alertBuilder = alertBuilder.setTitle("About");
        alertBuilder = alertBuilder.setMessage("To reproduce error:
text needs to both be long enough to wrap at least once (like this
line),\n" +
                        "AND consist of\n" +
                        "enough lines\n" +
                        "to fill up\n" +
                        "the vertical space\n" +
                        "of the alert dialog\n" +
                        "when in portrait mode.\n" +
                        "It also helps if it's Monday\n" +
                        "(not really)");
        alertBuilder = alertBuilder.setNeutralButton("OK", this);
        alertDialog = alertBuilder.create();
        alertDialog.show();

        }

        public void onStop(){
           super.onStop();

           if(alertDialog!=null){
                   alertDialog.dismiss();
                   alertDialog = null;
           }
           if(alertBuilder!=null){
                   alertBuilder = null;
           }

        }

        public void onClick(DialogInterface dialog, int which) {
        }

}


main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
</LinearLayout>

--~--~---------~--~----~------------~-------~--~----~
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