Orientation change and setRender

by qwesthead » Fri, 20 May 2011 15:38:29 GMT

Sponsored Links
 I've a region on an activity that uses GLSurfaceView. When the
Activity is resumed, I call the setRenderer and then the content of
the screen. They work fine. But, the problem arise when I change
orientation (configurationChange.) Upon orientation change, I need to
change the layout. After orientation change, surfaceChanged is getting
called. However, even when I call GLSurfaceview.requestrender,
Renderer.onDrawFrame is not getting called.
What are all the things I need to do when there is an orientation


Other Threads

1. getting control value from within a dialog

i've got an AlertDialog (here's a snippet)

AlertDialog.Builder builder.setPositiveButton("OK", new
                                    public void onClick(DialogInterface dialog, 
int id)

once the user clicks ok - i'd like to get a value of the control
the dialog (my layout)

because of scoping i can't user builder or the alertdialog.

how can i get the value of the control from within the onClick()


2. Using ListView in AlertDialog

I am trying to add 2 listviews to an alertdialog to select 2 separate

I am getting the following error

11-04 18:52:29.094: WARN/WindowManager(584): Attempted to add window
with non-application token WindowToken{436ad8b0 token=null}.

11-04 18:52:29.113: DEBUG/AndroidRuntime(896): Shutting down VM
11-04 18:52:29.125: WARN/dalvikvm(896): threadid=3: thread exiting
with uncaught exception (group=0x4000fe70)

11-04 18:52:29.153: ERROR/AndroidRuntime(896): Uncaught handler:
thread main exiting due to uncaught exception

11-04 18:52:29.263: ERROR/AndroidRuntime(896):
android.view.WindowManager$BadTokenException: Unable to add window --
token null is not for an application

Code to generate Dialog is below:

protected Dialog onCreateDialog(int id) {

          AlertDialog.Builder builder = new AlertDialog.Builder(Scales.this);
                builder.setTitle("Select Key");
                builder.setItems(rootNote, new DialogInterface.OnClickListener()
                {public void onClick(DialogInterface dialog, int item)

                tv.setText("Root Note: "+rootNote[item]);
                Note = rootNote[item];

                AlertDialog alertDialog = builder.create();

          AlertDialog.Builder builder;
          AlertDialog alertDialog;
          Context mContext = getApplicationContext();
          LayoutInflater inflater = (LayoutInflater)
          View layout = inflater.inflate(R.layout.select_dialog, (ViewGroup)

          builder = new AlertDialog.Builder(mContext);

          ListView noteList = (ListView) layout.findViewById(R.id.notesel);
          ListView accList = (ListView) layout.findViewById(R.id.accsel);

          ArrayAdapter adapter1 = new ArrayAdapter(this, R.layout.list_item,


          ArrayAdapter adapter2 = new ArrayAdapter(this, R.layout.list_item,

          noteList.setOnItemClickListener(new ListView.OnItemClickListener(){

                public void onItemClick(AdapterView<?> arg0, View arg1,int
position, long arg3) {

                        NoteSelected = rootNote[position];

          accList.setOnItemClickListener(new ListView.OnItemClickListener(){

                public void onItemClick(AdapterView<?> arg0, View arg1,int
position, long arg3) {

                        AccSelected = accs[position];

          alertDialog = builder.create();

   return alertDialog;

Code crashes on return of alertDialog.
Any ideas as to what the adding window with non-application token



3. When is the appropriate time to use separate processes?

4. Please help to test my app on "HTC wildfire".

5. sendBroadcast in IntentServicenot non-re-entrant?

6. USB tethering option missing from settings view

7. Adding table row by inflating does not take table's settings