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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:10:27+00:00 2026-05-30T03:10:27+00:00

I have create a class that extends BaseAdapter . At the same time, tt

  • 0

I have create a class that extends BaseAdapter. At the same time, tt need to have have a click function for each button of each row. However, onListItemClick() need a ListActivity extension. I use implements but it report an error as "ListActivity cannot be resolved to a type". How I can solve this problem?

package panda.com.db;

import java.util.List;
import java.util.Map;

import android.content.Context;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;



public class MyAdapter extends BaseAdapter implements ListActivity{

        private LayoutInflater mInflater;
        private List<Map<String, String>> mData;

        @Override
        protected void onListItemClick(ListView l,View v, int position,long id){
           Log.v("MyListView4", (String)mData.get(position).get("TITLE"));
        }

        public MyAdapter(Context context, List<Map<String, String>> m){
            this.mInflater = LayoutInflater.from(context);
            mData=m;
        }

        public final class ViewHolder{
            public TextView id;
            public TextView title;
            public TextView isbn;
            public TextView publisher;
            public Button viewBtn;
        }

        @Override
        public int getCount() {
            // TODO Auto-generated method stub
            return mData.size();
        }

        @Override
        public Object getItem(int arg0) {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public long getItemId(int arg0) {
            // TODO Auto-generated method stub
            return 0;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            // TODO Auto-generated method stub
            ViewHolder holder=null;

            if(convertView == null){
                holder=new ViewHolder();

                convertView = mInflater.inflate(R.layout.vlist, null);
                holder.title = (TextView)convertView.findViewById(R.id.TITLE);
                holder.id = (TextView)convertView.findViewById(R.id.ID);
                holder.isbn = (TextView)convertView.findViewById(R.id.ISBN);
                holder.publisher = (TextView)convertView.findViewById(R.id.PUBLISHER);
                holder.viewBtn = (Button)convertView.findViewById(R.id.view_btn);
                convertView.setTag(holder);
            }else{
                holder=(ViewHolder)convertView.getTag();
            }

            //holder.img.setBackgroundResource((Integer)mData.get(position).get("img"));
            holder.title.setText((String)mData.get(position).get("TITLE"));
            holder.id.setText((String)mData.get(position).get("ID"));
            holder.isbn.setText((String)mData.get(position).get("ISBN"));
            holder.publisher.setText((String)mData.get(position).get("PUBLISHER"));
            holder.viewBtn.setGravity(Gravity.RIGHT);
            holder.viewBtn.setOnClickListener(new View.OnClickListener(){

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    new DbActivity().showInfo();
                }
            });
            return convertView;
        }

    }
  • 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-30T03:10:29+00:00Added an answer on May 30, 2026 at 3:10 am

    You wouldn’t have the BaseAdapter implement ListActivity… that is kinda weird.

    Instead, you’d have something like:

    public class MyActivity extends ListActivity implements OnClickListener {
    
        @Override
        public void onCreate(){
    
            ListView lv = getListView();
            lv.setOnItemClickListener(this);
            MyAdapter adapter = new MyAdapter(getApplicationContext(), null);
            // Replace null with your application data, in whichever way you choose to pass it.
            lv.setAdapter(adapter);
    
        }
    
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // do something
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this class that have a function to load other classes and create
Does anyone have a working class or function to create the hashed email that
I have create a class MyConnection that extends NSURLConnection. I have implemented some delegate
I have class that extends AsyncTask class and I create instance of this class
I have a custom button class called ImageButton that extends JButton. In it i
I am trying to create a class that implements the IUnknown interface. I have
I have written an apex class that will create a PDF quote and attach
I have create my own NSOpenGLView class, right now the data that i want
I have created a button CSS class that uses background images with different positions
I have created a class of type BaseAdapter that is populated with buttons -

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.