Converting a string to an integer on Java / Android

How to convert String into Integer in Android or Java:

 

Note:

String must be a number, other wise there should be an exception.

We can use try catch to handle exception or use following function for proper conversion.

Call above function