UnhandledException321:
He inicializado una variable doble y quieren mostrarlo en una TextView.
El nombre de la variable está subrayado en rojo.
He tratado de analizar en una cadena, pero no funcionó.
public class MainActivity extends AppCompatActivity {
Location currentloc = new Location("currentloc");
double currlat = 0.0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView gpsbox = (TextView) findViewById(R.id.gpsView);
try {
currlat = currentloc.getLatitude();
} catch(Exception e) {
Toast.makeText(this, "Hello, an exception was just thrown but I catched it. " + e.toString(), Toast.LENGTH_SHORT).show();
}
gpsbox.setText(currlat);
setContentView(R.layout.activity_main);
}
}
noureldien Mohamed:
usted tiene que parth esto a String
String.valueOf(currlat);
Espero que funcione con usted.