if the field is empty I send the error message where wrong public class localizza extends Activity {
private EditText latitudine; private EditText longitudine; private Button btnlocalizza; private static ProgressDialog pd; private Thread trovaerrore; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.onCreate(savedInstanceState); super.onCreate(savedInstanceState); setContentView(R.layout.localizza); latitudine = (EditText) findViewById (R.id.widget30_latitudine); longitudine = (EditText) findViewById (R.id.widget31_longitudine); btnlocalizza = (Button) findViewById (R.id.mymap2_btn_localizza); btnlocalizza.setOnClickListener(new OnClickListener() { public void onClick(View v) { pd = ProgressDialog.show(localizza.this, "Localizzo", "la tua posizione", true, false); trovaerrore = new Thread() { public void run(){ try { Intent myMap = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse("geo:0,0?q=http://www.boole.it/kml/ generale.kml"); myMap.setData(uri); startActivity(Intent.createChooser(myMap, "mymap2")); Thread.sleep(1500); } catch (Exception e) { } mostraindirizzo.sendEmptyMessage(0); } }; trovaerrore.start(); } }); } private Handler mostraindirizzo = new Handler() { @Override public void handleMessage(Message msg) { pd.dismiss(); if (latitudine.getTextSize() == -1) { Dialog locationError = new AlertDialog.Builder( localizza.this).setIcon(0).setTitle( "Errore").setPositiveButton(R.string.ok, null) .setMessage( "Input non trovato.") .create(); locationError.show(); } } }; } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---