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

  • SEARCH
  • Home
  • 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 9170481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:01:33+00:00 2026-06-17T16:01:33+00:00

I have to navigate to another activity on image click in listview item from

  • 0

I have to navigate to another activity on image click in listview item from adapter class.
here is my adapter class:

 public class RestaurantAdapter extends BaseAdapter {

    private Activity activity;
    private ArrayList<String> rest,location,id;
    private static LayoutInflater inflater=null;
    public ImageLoader imageLoader; 
    Context c;
    public RestaurantAdapter(Activity a,Context context, ArrayList<String> restaurants, ArrayList<String> location2 ,ArrayList<String> restid) {
       activity = a;
        rest=restaurants;
        location=location2;
        id=restid;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      //  imageLoader=new ImageLoader(activity.getApplicationContext());
 c=context;
    }

    public int getCount() {
        return rest.size();
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }



    public View getView(final int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.listview_layout, null);
        vi.setClickable(true);
        vi.setFocusable(true);
        TextView text=(TextView)vi.findViewById(R.id.txt);;
        TextView f=(TextView)vi.findViewById(R.id.cur);;
        TextView r=(TextView)vi.findViewById(R.id.resid);;
        ImageView image=(ImageView)vi.findViewById(R.id.list_image);
       text.setText(rest.get(position));
       f.setText(location.get(position));
       r.setText(id.get(position));
       image.setOnClickListener(new View.OnClickListener() {

          @Override
          public void onClick(View view) {


                Intent intent=new Intent(c,UserSettings.class);
                intent.putExtra("id",id.get(position) );
                intent.putExtra("resname", rest.get(position));
                intent.putExtra("location", location.get(position));
                c.startActivity(intent);
          }



        });




        return vi;
    }

but it gives me exception on this line

c.startActivity(intent);

any suggestions??

  • 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-17T16:01:34+00:00Added an answer on June 17, 2026 at 4:01 pm

    Use the activity context instead..

    activity.startActivity(intent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Friends I am using intent to navigate from one activity to another.How ever the
I have created programme in which we navigate from table view to a simple
What i have here is a simple webview activity that when loaded it auto
In my application, I have specified a second activity that can be launched from
I have an Activity that plays some audio from within a ListActivity . The
I have a certain UI element, which when clicked should navigate to another URL.
Greeting, I have problem stopping FLVPlaypack component when I navigate from one frame to
I have a toast message that runs on button-click. I have another button that
I am trying to call __doPostBack from within JavaScript and then navigate to another
If I have an Activity which is in the foreground and I navigate to

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.