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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:16:04+00:00 2026-05-29T23:16:04+00:00

I have overrode the getView() method in ArrayAdapter . I was wondering if there

  • 0

I have overrode the getView() method in ArrayAdapter. I was wondering if there was a way to keep the check box functionality when overriding getView()?

With my current implementation, it only shows the image and the text on each row. It no longer shows the checkboxes that were there before overriding.

Below is my code:

public class ShortcutsArrayAdapter extends ArrayAdapter<ResolveInfo> {

    private final Activity context;
    private final List<ResolveInfo> objects;
    private PackageManager pm = null;

    public ShortcutsArrayAdapter(Activity context, int textViewResourceId,
            List<ResolveInfo> objects, PackageManager pm) {
        super(context, textViewResourceId, objects);
        this.context = context;
        this.objects = objects;
        this.pm = pm;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater inflator = context.getLayoutInflater();
        View rowView = inflator.inflate(R.layout.rowlayout, null, true);
        TextView textView = (TextView) rowView.findViewById(R.id.label);
        ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
        textView.setText(objects.get(position).loadLabel(pm));
        try {
            imageView.setImageBitmap(((BitmapDrawable) pm.getApplicationIcon(objects.get(position).activityInfo.applicationInfo.packageName)).getBitmap());
        } catch (NameNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return rowView;
    }

}

And here is how i am creating the adapter:

    appList = getApplicationList();
    setListAdapter(new ShortcutsArrayAdapter(this, android.R.layout.simple_list_item_multiple_choice, appList, pm));
    getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

Here is the row layout xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:orientation="horizontal" >  

    <ImageView 
        android:id="@+id/icon"
        android:layout_width="40dp"
        android:layout_height="40dp"/>

    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/label"
        android:text="@+id/label"/>

</LinearLayout>
  • 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-29T23:16:05+00:00Added an answer on May 29, 2026 at 11:16 pm

    Why don’t you call super.getView() and after that do some of the custom stuff you want to do?
    In any case, I don’t see why the checkbox shouldn’t show. Maybe it is hidden behind another component. Have you checked the layout? Try moving it before or after the text box.

    You may need a checkbox in your row_layout.xml. Something like the following:

    <CheckBox
            android:id="@+id/check"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginLeft="4px"
            android:layout_marginRight="10px" >
        </CheckBox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting an error when overriding my getview method. This is what I
I have list view [text view and check box controlls] with more data. I
I have list view [text view and check box controlls] with more data. I
I have a base recipe class and I am using a datacontext. I overrode
I have implemented a ToString() override method for my class in my Webservice and
i have the following method in a usercontrol protected override void Render(HtmlTextWriter writer) {
If I have a view (and its controller) and I override the willAnimateRotationToInterfaceOrientation method
I have a class that extends View. I override the onDraw method and allow
I have a custom list adapter: class ResultsListAdapter extends ArrayAdapter<RecordItem> { in the overridden
I have a listview with a custom arrayadapter that handles about 15 strings. The

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.