android - Fix decimal numbers -
now i;m receiving gps location data android application, , send labview.
however, decimal number of gps location value changes due location.
i want fix decimal number such 7
for example, 32.33333 need 32.333330
how can declare value?
here gps value part
private class mylocationlistener implements locationlistener { private string gps2; @override public void onlocationchanged(location loc) { if (loc != null) { /* 화면의 상단에 위치한 textview에 위도, 경도를 출력함*/ gps.settext("la:"+loc.getlatitude()+", lo:"+loc.getlongitude()); gps2 = gps.gettext().tostring(); main.getinstance().sendmessage(gps2); } } @override public void onproviderdisabled(string provider) { // todo auto-generated method stub } @override public void onproviderenabled(string provider) { // todo auto-generated method stub } @override public void onstatuschanged(string provider, int status, bundle extras) { // todo auto-generated method stub } }
try doing way
numberformat numberformat = new decimalformat("#.000000"); gps.settext("la:"+numberformat.format(loc.getlatitude())+", lo:"+numberformat.format(loc.getlongitude()));
Comments
Post a Comment