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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:40:08+00:00 2026-05-31T08:40:08+00:00

I have a baseAdapter class that adds data to a Gridview. Please is there

  • 0

I have a baseAdapter class that adds data to a Gridview.
Please is there a way to sort the list before it is added to the Adapter?

Comm_AppsList=new ArrayList<Appis_Infos>();
    Comm_AppsList.add(new Appis_Infos(BitmapFactory.decodeResource(com_res, R.drawable.skype), "Skype","com.skype.raider"));
    Comm_AppsList.add(new Appis_Infos(BitmapFactory.decodeResource(com_res, R.drawable.yahoomessenger),"Messenger","com.yahoo.mobile.client.android.im"));
    Comm_AppsList.add(new Appis_Infos(BitmapFactory.decodeResource(com_res, R.drawable.whatsappm),"WhatsApp","com.whatsapp"));
    Comm_AppsList.add(new Appis_Infos(BitmapFactory.decodeResource(com_res, R.drawable.yahoomail),"Mail","com.yahoo.mobile.client.android.mail"));

  Com_gridview.setAdapter(new CommAppis_Adapter(this, Comm_AppsList));

And here is the BaseAdapter

   class CommAppis_Adapter extends BaseAdapter{
private Context AIcontext;
private List<Appis_Infos>AdList;

CommAppis_Adapter(Context Aicontext, List<Appis_Infos> aDlist){
AIcontext=Aicontext;
AdList=aDlist;
}

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

@Override
public Object getItem(int it_position) {
    // TODO Auto-generated method stub
    return AdList.get(it_position);
}

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

@Override
public View getView(int Vposition, View Aview, ViewGroup Vparent) {
    // TODO Auto-generated method stub
    Appis_Infos appsData=AdList.get(Vposition);
    Comm_Viewholder holder=null;

    if(Aview==null){
        LayoutInflater apps_inflater=LayoutInflater.from(AIcontext);
        Aview=apps_inflater.inflate(R.layout.comm_appis, null);
        holder=new Comm_Viewholder();

        holder.apps_icons=(ImageView)Aview.findViewById(R.id.comm_imageview);
        holder.apps_name=(TextView)Aview.findViewById(R.id.comm_tvName);


        Aview.setTag(holder);
    }else{
        holder=(Comm_Viewholder)Aview.getTag();
    }

    holder.apps_icons.setImageBitmap(appsData.getIcon());
    holder.apps_name.setText(appsData.getName());

    return Aview;
}

}

Please how do I sort (Programmatically because my List is very long.I just croped it) these items before I add them.

  • 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-31T08:40:09+00:00Added an answer on May 31, 2026 at 8:40 am

    First of all you can define your own Comparator object:

    Comparator<Appis_Infos> myComparator = new Comparator<Appis_Infos>() {
        public int compare(Appis_Infos obj1,Appis_Infos obj2) {
            return obj1.getName().compareTo(obj2.getName());
        }
     };
    

    and then call the Collections.sort method:

    Collections.sort(Comm_AppsList, myComparator);
    

    If you need to compare in case invariant mode use the compareToIgnoreCase method instead of compareTo.

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

Sidebar

Related Questions

I have a ListView with a custom list adapter (that extends BaseAdapter). My list
I have created a class of type BaseAdapter that is populated with buttons -
I have create a class that extends BaseAdapter . At the same time, tt
I have implemented an adapter for my ListView which extends BaseAdapter. My list items
I have Vector of elements that i set into BaseAdapter subclass and this adapter
BACKGROUND: I have a GridView based on a fairly complex Adapter class which extends
I have a GridView that uses an adapter to set ImageViews and when I
I have a custom adapter that visualize each row in the list of Orders.
I have class Myadapter extends BaseAdapter.in Myadapter i changed the MyListView data then call
I have a list view whose adapter is in a different class in a

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.