M0286_Libro Curso

Android

Button btsearch = (Button) findViewById(R.id. btsearch ); btsearch.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { writeSignalGPS(); } }); } private void setCurrentLocation(Location location) { currentLocation = location; } private void writeSignalGPS() { DialogInterface.OnCancelListener dialogCancel =

new DialogInterface.OnCancelListener() {

public void onCancel(DialogInterface dialog)

{

Toast.makeText(

getBaseContext(), getResources().getString(R. Toast. LENGTH_LONG ).show();

string. gps_signal_not_found ),

handler.sendEmptyMessage(0);

}

}; pd = ProgressDialog.show(this,

this.getResources().getString(R.string.

search ), this

.getResources().getString(R.

string. search_signal_gps ),

true, true, dialogCancel);

Thread thread = new Thread(this); thread.start();

} public void run() {

mLocationManager

=

(LocationManager)

getSystemService(Context. LOCATION_SERVICE );

180

Made with FlippingBook - Online catalogs