[Solved] Extract a number from a string getting number format exception


You need to get the result by using substring method as below

    String total_points = potential_points.getText();
    int startIndex=total_points.indexOf(":")+2;
    int endIndex=total_points.length();
    String result=total_points.substring(startIndex,endIndex);
    int no=Integer.parseInt(result);

Simplified the above code as below

    String result=total_points.substring(total_points.indexOf(":")+2,total_points.length());
    int no=Integer.parseInt(result);

15

solved Extract a number from a string getting number format exception