I am using following code as Cusotm Array adapter of a ListView in android
In View new MyAsyncTask(url, callback); will be run again and again, How can i make it so that the query to the server will be performed only once.
@Override
        public View getView(int position, View convertView, ViewGroup parent) 
        {       
            final Question question = quesions.get(position);
            final OpenionUser myUser = question.getUser();
            View view = convertView;
            ViewHolder viewHolder = new ViewHolder();
            if (convertView == null)
            {
                view = inflator.inflate(R.layout.question_adapter_layout, parent, false);
                viewHolder.firstPhotoPercent  = (TextView) view.findViewById(R.id.firstPhotoProgressText);
                viewHolder.secondPhotoPercent = (TextView) view.findViewById(R.id.secondPhotoProgressText);
                viewHolder.comments = (LinearLayout) view.findViewById(R.id.commentsListView);      
                viewHolder.profilePic = (ImageButton) view.findViewById(R.id.profile);
                viewHolder.leftPic = (ImageButton) view.findViewById(R.id.photo1);
                viewHolder.rightPic = (ImageButton) view.findViewById(R.id.photo2);
                viewHolder.firstPhotoBg = (RelativeLayout) view.findViewById(R.id.firstPhotoProgress);
                viewHolder.secondPhotoBg = (RelativeLayout) view.findViewById(R.id.secondPhotoProgress);
                view.setTag(viewHolder);
            }
            else
                viewHolder = (ViewHolder) view.getTag();
    //      //imageLoader.displayImage(myUser.getProfilePicture(), viewHolder.profilePic, options);
    //      
            viewHolder.username.setText(myUser.getUserName());
            viewHolder.question.setText(question.getQuestion());
            imageLoader.displayImage(question.getRightThumbnailLink(), viewHolder.rightPic, options);
            imageLoader.displayImage(question.getLeftThumbnailLink(), viewHolder.leftPic, options);
            String url = String.format(Constants.GET_QUESTION_COMMENTS, 
                        question.getId(),
                        0,
                        2);
            ResponseCallback callback = new ResponseCallback() 
            {
                @Override
                public void onSuccess(HttpResponse response) 
                {
                    try {
                            JSONObject obj = new JSONObject(Utilities.convertStreamToString(response.getEntity().getContent()));
                            JSONArray array = obj.getJSONArray("comments");
                            ArrayList<Comment> comments = new ArrayList<Comment>();
                            for (int i = 0; i < array.length(); i ++)
                            {
                                Comment comment = Utilities.getCommentFromJSON(array.getJSONObject(i));
                                comments.add(comment);                          
                            }
                            addFeaturedViews(comments, viewHolder.comments);
                    } catch (IllegalStateException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
                @Override
                public void onFailure(HttpResponse exception) 
                {
                }
            };
            new MyAsyncTask(url, callback);
 
     
     
     
     
    