2

I am adding a construct data from my data fetch with a double variable. and i have an error retrieve upon my data. just check my codes :)

my parameter:

 Double xtop,xbot,yleft,yright,alat,alon;

      public void constData{
        //myLocation
        lati =  cursor2.getString(cursor2.getColumnIndex
        (DatabaseHelper.LATITUDE));
        longi = cursor2.getString(cursor2.getColumnIndex
        (DatabaseHelper.LONGITUDE));

       //myDestination
        alat=Double.valueOf(userList.get(position).getLatitude());                                         
        alon=Double.valueOf(userList.get(position).getLongitude());

         //I have problem on adding data here:
         xtop=(alat)+(0.0000100);
         xbot=(alat)-(0.0000100);
         yleft=(alon)+(0.0000100);
         yright=(alon)-(0.0000100);

       //LogData
      Log.d("alot",""+lati);
                Log.d("alot",""+longi);
                Log.d("alot",""+alat);
                Log.d("alot",""+alon);
                Log.d("alot",""+xbot);
                Log.d("alot",""+xtop);
                Log.d("alot",""+yright);
                Log.d("alot",""+yleft);
          }

and this is the result on my log cat:

enter image description here

the xtop/xbot/yright/yleft data is not in decimal. thank you for the help. :)

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

1 Answers1

2

i was found the answer, it is need to be convert and ive use this one since my fix value with a decimal places of 7

           DecimalFormat df = new DecimalFormat("#");
                df.setMaximumFractionDigits(7);

now it is working... ps. thanks for the one who help me with this thing :)