If I add a a long double number into EditText, for example 1500000000,
the Textview is displaying the number as 1.5E8. I dont want it to be displayed in this format, I want it to displayed as 150000000. How could I change that?
            Asked
            
        
        
            Active
            
        
            Viewed 169 times
        
    0
            
            
         
    
    
        David Buck
        
- 3,752
- 35
- 31
- 35
 
    
    
        hoabouseif
        
- 31
- 4
- 
                    1Please share your code – Shalu T D Jul 18 '20 at 03:19
2 Answers
0
            
            
        You should use String.valueOf() method, so you get a String representation of the big number. In your case, it will be as below:
textview.setText(String.valueOf(1500000000));
 
    
    
        Shalu T D
        
- 3,921
- 2
- 26
- 37
0
            You should use DecimalFormat  to format it.
        {
            double doubleA = 1500000000;
            DecimalFormat decimalFormat = new DecimalFormat("#.##");
            txtv_test.setText(decimalFormat.format(doubleA)); //show 1500000000
        }
        {
            double doubleA = 1500000000.123;
            DecimalFormat decimalFormat = new DecimalFormat("#.##");
            txtv_test.setText(decimalFormat.format(doubleA)); //show 1500000000.12
        }
        {
            double doubleA = 1500000000.1;
            DecimalFormat decimalFormat = new DecimalFormat("#.##");
            txtv_test.setText(decimalFormat.format(doubleA)); //show 1500000000.1
        }
        {
            double doubleA = 0.12;
            DecimalFormat decimalFormat = new DecimalFormat("#.##");
            txtv_test.setText(decimalFormat.format(doubleA)); //show 0.12
        }
 
    
    
        simon5678
        
- 249
- 1
- 5