I'm very new to programming. I have a program that has lots and lots of methods that run consecutively to each other. My application freezes until its done calculating. I want to put everything in AsyncTask but I'm having a really hard time understanding how it works.
This is what I have so far as a separate java file.
import android.os.AsyncTask;
public class ConvertToStringToIntt extends AsyncTask<String, Void, Integer> {
@Override
protected Integer doInBackground(String... timeString) {
String time = timeString;
time = time.replace(":","");
int value = -2;
try {
value = Integer.parseInt(time);
} catch (NumberFormatException e) {
Message.message(this, "String time could not be converted to int");
}
return value;
}
}
This method basically takes in a String of time and returns it as an int. But I am getting an error in String time = timeString
;
says:
Incompatible types Required: java.lang.String Found: java.lang.String[]
I don't know what that means. Any help would be great, and thank you.