---
title: "Calling an activity class from Async class"  
description: "Calling an activity class from Async class"  
author: "Anonymous User"  
published: 2015-03-20  
updated: 2015-03-20  
canonical: https://www.mindstick.com/forum/23036/calling-an-activity-class-from-async-class  
category: "android"  
tags: ["android", "synchronization"]  
reading_time: 1 minute  

---

# Calling an activity class from Async class

My [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) is-:

```
private class AsyncCallWS extends AsyncTask<String,
Void, Void> {                 @Override                 protected Void doInBackground(String... params) {                     //Invoke webservice                     vaildUserId = WebService.invokeAuthenticateUserWS(loginUserName,
loginPassword, "AuthenticateUser");}
```

## Replies

### Reply by Manoj Pandey

When an asynchronous task is executed, the task goes through 4 steps:

1. onPreExecute(), invoked on the UI thread before the task is executed.

2. doInBackground(Params...), invoked on the background thread immediately after onPreExecute() finishes executing.

3. onProgressUpdate(Progress...), invoked on the UI thread after a call to publishProgress(Progress...).

4. onPostExecute(Result), invoked on the UI thread after the background computation finishes.

Add following code

```
   protected void onPostExecute(Void result)    {       // TODO Auto-generated method stub       super.onPostExecute(result);       Intent myIntent=new Intent(this, MyActivity.class);       startActivity(myIntent);       finish();   }
```


---

Original Source: https://www.mindstick.com/forum/23036/calling-an-activity-class-from-async-class

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
