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 6106519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:05:17+00:00 2026-05-23T14:05:17+00:00

I have implemented a BaseAdapter and binded that BaseAdapter to my ListView. The Layout

  • 0

I have implemented a BaseAdapter and binded that BaseAdapter to my ListView. The Layout for each row of the ListView contains an ImageButton. How do i bind that ImageButton to a click listener and then use that ImageButton to call a new activity.

  • 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-05-23T14:05:18+00:00Added an answer on May 23, 2026 at 2:05 pm

    here is a sample adapter class.

    import java.util.ArrayList;
    
    import android.content.Context;
    import android.content.Intent;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.view.View.OnClickListener;
    import android.widget.BaseAdapter;
    import android.widget.Button;
    import android.widget.TextView;
    import android.widget.Toast;
    
    import com.amazon.mp3.AlbumDetail.Details;
    
    
    
    public class CustomListAdapter extends BaseAdapter {
    private  ArrayList<Details> allElementDetails;
    private Context con; 
    private LayoutInflater mInflater;
    String temp;
    public CustomListAdapter(Context context, ArrayList<Details> results) {
        allElementDetails = results;
        mInflater = LayoutInflater.from(context);
        con=context;
    }
    public int getCount() {
        return allElementDetails.size();        
    }
    public Object getItem(int position) {
        return allElementDetails.get(position);
    }
    public long getItemId(int position) {
        return position;
    }
    public View getView(final int position, View convertView, ViewGroup parent) 
    {
                        //select ur xml file
        convertView = mInflater.inflate(R.layout.listview_elements, null);
    
        TextView textview1 = (TextView) convertView.findViewById(R.id.TextView01);
        TextView textview2 = (TextView) convertView.findViewById(R.id.TextView02);
        TextView textview3 = (TextView) convertView.findViewById(R.id.TextView03);
        Button buy=(Button)convertView.findViewById(R.id.buy_song_button);
        buy.setOnClickListener(new OnClickListener() {
    
            public void onClick(View v) {
    
            Intent intent=new   Intent(con,Buy_song.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    
             con.startActivity(intent);
    
    
            }
                else
                    Toast.makeText(con,"Not available for purchase", Toast.LENGTH_SHORT).show();
    
            }
        });
    
        if(allElementDetails.get(position).songname.contains("&amp;"))
        {
      temp=allElementDetails.get(position).songname.replace("&amp;", "and");
        textview1.setText(temp);
        }
        else
        textview1.setText(allElementDetails.get(position).songname);
    
        textview2.setText(allElementDetails.get(position).runtime);
        if(allElementDetails.get(position).price.startsWith("$"))
        textview3.setText(allElementDetails.get(position).price);
        else
               textview3.setText("Album only");
        return convertView;
    }    
    
    }
    

    Look for the buy button in this adapter.

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

Sidebar

Related Questions

I have a ListView that uses a customized adapter, but I can't click on
I have implemented an adapter for my ListView which extends BaseAdapter. My list items
I have a custom adapter that visualize each row in the list of Orders.
I have implemented a python webserver. Each http request spawns a new thread. I
I have implemented Section Indexer for an Adapter class which extends BaseAdapter. Now for
I have implemented Authlogic. I believe that this isn't an authlogic specific quesetion. Assume
I am trying to update the ListView with timer . I have implemented the
When overriding the baseadapter on an android listview, you have to implement this method
I have listView in which I inflate a row contain textview and button now
I have a custom list view implemented with Baseadapter. My dataset includes a string

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.