public class ayncClass extends AsyncTask<String, Void, String> {
public void onPreExecute(){
}
@Override
protected String doInBackground(String... params) {
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(URL HERE);
try{
HttpResponse responseGiven = client.execute(get);
StatusLine statusLine = responseGiven.getStatusLine();
int statusCode = statusLine.getStatusCode();
if(statusCode == 404){
Toast.makeText(getApplicationContext(), "ERROR", Toast.LENGTH_SHORT).show();
}
} catch(Exception e){
}
return null;
}
public void onPostExecute(...){
super.onPostExecute(s);
}
}
But when I debug and run the app, it does the get the Toast to show up. Is there a way to do actions withing the AsyncTask, while its working?
Thanks!