I have these lines of code , which i want to use inside `getview()` method of `CustomAdapter` . 

```
 new AsyncTask<Void, Void, Void>() {
                @Override
                protected Void doInBackground(Void... params) {
                    try {
                        final MobileServiceList<User> result =
                                mUser.where().field("name").eq(currentItem.getTo()).select("designation").execute().get();
                        int counter=
                                mUser.where().select("designation").execute().get().getTotalCount();
                        for (User item : result) {
                            // Log.i(TAG, "Read object with ID " + item.id);
                            desig[0] = item.getDesignation();
                            Log.v("FINALLY DESIGNATION IS", desig[0]);

                        }

                    } catch (Exception exception) {
                        exception.printStackTrace();
                    }
                    return null;
                }

                @Override
                protected void onPostExecute(Void aVoid) {
                    super.onPostExecute(aVoid);
                    // gb.setDesignation(desig[0]);

                    designation.setText(desig[0]);

                }
            }.execute();

```

This is my AsyncTask code which , I am using to populate custom listview .This piece of code keeps on running , I don't know how many times. But at the end it is giving me right results after so many updates on TextView (`designation`). This is not only degrading the performance of my application but also showing multiple updates on TextView before reaching to result.

I am getting data in `desig[0]` variable , have a look on my code .

Data is coming from azure But don't worry if you are not an azure guy . Just help me on Java part.

**QUESTION**

My question is how can use `Async task` inside `getview()` method . Do i have to make functions , which i can call latter . Data is coming from azure But don't worry if you are not an azure guy . Just help me on Java part. plzz help