Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8922631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:53:27+00:00 2026-06-15T06:53:27+00:00

I am having problem to call onListItemClick() function after execution of onPostExecute(Void result) Below

  • 0

I am having problem to call onListItemClick() function after execution of onPostExecute(Void result)

Below is my code snippet .

package com.myapp.checkoutnhangout;

import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.util.List;

import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class CheckoutNearestPlaces extends ListActivity {
    private String[] placeName;
    private String[] imageUrl;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        new GetPlaces(this,getListView()).execute();
    }

    class GetPlaces extends AsyncTask<Void, Void, Void> {

        Context context;
        private ListView listView;
        private ProgressDialog progressDialog;

        public GetPlaces(Context context , ListView listView) {
            this.context = context;
            this.listView = listView;
        }

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            progressDialog = new ProgressDialog(context);
            progressDialog.setIndeterminate(true);
            progressDialog.setTitle("Loading");
            progressDialog.show();
        }

        @Override
        protected Void doInBackground(Void... params) {
            try {
                findNearLocation();
            } catch (KeyManagementException e) {
                e.printStackTrace();
            } catch (UnrecoverableKeyException e) {
                e.printStackTrace();
            } catch (NoSuchAlgorithmException e) {
                e.printStackTrace();
            } catch (KeyStoreException e) {
                e.printStackTrace();
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);
            progressDialog.dismiss();
            setListAdapter(new ArrayAdapter<String>(context,android.R.layout.simple_list_item_1,placeName));
//          this.listView.setAdapter(new ArrayAdapter<String>(context,android.R.layout.simple_list_item_1,placeName));
        }

        public void onListItemClick(ListView listView , View v , int position , long id){
            System.out.println("position------------"+placeName[position]);
        }

        public void findNearLocation() throws KeyManagementException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException {
            PlacesService placesService = new PlacesService("AIzaSyC3y3fOMTqTkCjNNETQTCKustG7BRk_eVc");

            List<Place> findPlaces = placesService.findPlaces(28.6752, 77.4362, "");

            int findPlacesSize = findPlaces.size();
            placeName = new String[findPlacesSize];
            imageUrl = new String[findPlacesSize];

            for(int index = 0 ; index < findPlacesSize ; index ++) {
                    Place placeDetail = findPlaces.get(index);

//                  System.out.println("name of place : "+placeDetail.getName());
                    placeName[index] = placeDetail.getName();

//                  System.out.println("url of place : "+placeDetail.getIcon());
                    imageUrl[index] = placeDetail.getIcon();
            }
        }

    }
}

Above code use google palce api and display list of locations on the basis of user’s interest .
After that , I want to call onListItemClick() function , so that I can call another activity on each item click.

Any help will be appreciable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:53:30+00:00Added an answer on June 15, 2026 at 6:53 am

    remove

    public void onListItemClick(ListView listView , View v , int position , long id){
                System.out.println("position------------"+placeName[position]);
            }
    

    from class GetPlaces

    and put in CheckoutNearestPlaces

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem with jqGrid. I need to call a function when a
I'm having a problem saving the result of a RPC. Basically the call is
im having problem with getting value of a variable from the ajax-call function getRequest
I'm having a problem with the call to SQLGetDiagRec. It works fine in ascii
I'm having a problem with my ajax call. I'm submitting some info via php
I am having a problem with the service.getDistanceMatrix call. <html> <head> <script type=text/javascript src=http://maps.google.com/maps/api/js?sensor=false>
Having a problem with NSURLConnection, if I create a NSURLConnection and call [connection connectionWithRequest]
i having a problem with a global method called returnDayNumber. If i call the
I am having an interesting problem with using pinvoke in C# to call _snwprintf.
Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.