Hi,
I have a problem, I want to create an Alert Builder in a thread
started by tha main activity.This Builder should be a multiple
choiche.
The code is:

public class C extends Activity {

        private PrintWriter savedpoint;
        private Context context = this;
        private TextView statusField;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Handler handler=new Handler();

        F thread=new F(this,statusField,handler);
        thread.start();


    }
}


class F extends Thread{

        Context context;
        TextView statusField;
        Handler handler;
        String voto;

        F(Context context,TextView statusField,Handler handler)
{this.context=context;this.statusField=statusField;this.handler=handler;}
        public void run()
        {


                        final CharSequence[] items = {"Ottimo", "Buono",
"Sufficiente","Insufficiente"};

                        String voto="";

                        handler.post(new Runnable(){public void run(){
                                AlertDialog.Builder builder = new 
AlertDialog.Builder(context);
                                builder.setTitle("Pick a color");
                                builder.setSingleChoiceItems(items, -1, new
DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, 
int item) {
                                        
Toast.makeText(context.getApplicationContext(), items
[item], Toast.LENGTH_SHORT).show();

                                    }
                                });
                                AlertDialog alert = builder.create();
                                alert.show();

                        }});

                        statusField.setText(voto);

   }
}

Problem 1: what can I do for doing some actions when a user select one
of the alert choiches?
Problem 2: It seems that the code doesn't stop  when the alert dialog
appears but still run, as a matter of fact the statusField is empty
when appears.
If nothing is possible to do Is there any other way to obtain
something like this working?
THanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to