I convert the whole number that the user enters to hour / minutes / seconds as follows
int time = Integer.parseInt(minutos.getText().toString().trim()) * 60 * 1000;
i.putExtra("tiempo",time);
startService(i);
And as you see that number I send it to a service and it executes it, the problem is that if I use it within a Asynctask
it throws the following error in the logcat:
java.lang.NumberFormatException: For input string: "" at java.lang.Integer.parseInt (Integer.java:533)
Inside my asyn I have it in the following way:
@Override
protected void onPostExecute(String result) {
pdLoading.dismiss();
if(result.equalsIgnoreCase(""))
{
int time = Integer.parseInt(minutos.getText().toString().trim()) * 60 * 1000; // esta es la linea del problema
i.putExtra("tiempo",time);
startService(i);
Toast.makeText(getApplicationContext(),"Comienza la cuenta.",Toast.LENGTH_SHORT).show();
The funny thing that if I get this function out of async
works perfect.