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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:49:18+00:00 2026-05-28T03:49:18+00:00

Hi i have a tab activity which show a list of items (ListView) .

  • 0

Hi i have a tab activity which show a list of items(ListView). This listview has a button in each row. I am handling this button clickListener in my custom adapter class which extends the BaseAdapter class. Now what i want is when i click on this button the item should be remove from the listview and listview should get a refresh. How to do this?

ok I think my code can explain it

 public View getView(final int position,  View convertView, ViewGroup parent)
{
    ViewHolder holder;

    final ActivityManager am = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);

    if(convertView==null) 
    {
             convertView = mInflater.inflate(R.layout.list_item, null);
             holder = new ViewHolder();
 //     holder.appSize = (TextView)convertView.findViewById(R.id.app_size);

              holder.appName = (TextView)convertView.findViewById(R.id.app_name);
              holder.app_icon = (ImageView)convertView.findViewById(R.id.app_icon);
              holder.button = (Button)convertView.findViewById(R.id.uninstall);
              if(kill_OR_uninstall)
              {

                       holder.button.setOnClickListener(new OnClickListener() {

                            public void onClick(View v) {

                       Intent intent = new Intent(Intent.ACTION_DELETE);
                       intent.setData(Uri.parse("package:"+package_names.get(position)));
                       context.startActivity(intent);



                     }
                    });
              }

              else
              {
                       holder.button.setText("End");
                       holder.button.setOnClickListener(new OnClickListener() {

                        public void onClick(View v) {
                        am.restartPackage(package_names.get(position));

                        }
                    });

              }

      convertView.setTag(holder);

    }

    else
    {       
                     holder = (ViewHolder) convertView.getTag();   
    }

     holder.appName.setText((String)app_details.get(position).get(APP_NAME));
     holder.app_icon.setImageDrawable((Drawable)app_details.get(position).get(APP_ICON));
  //   holder.appSize.setText(app_details.get(position).get(APP_SIZE)+ " KB");



     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-28T03:49:18+00:00Added an answer on May 28, 2026 at 3:49 am

    Based on the position of the row that was click remove an item from the Collection that is backing the Adapter example :

    myArrayList.remove(position);
    

    then notify the list that the data is changed using :

    adapter.notifyDataSetChanged();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tabs as views in my activity. Each tab represents a ListView
I have a tabhost with two tabs. Each tab has his own activity. My
I have created an application having tab activity which in turn has 5 different
I have this app which consists of three tabs. The first tab has a
I have one list activity which populates when I click on one tab, the
I have a Tabhost which is my main activity. When a tab is clicked
I have a tabActivity which has 3 tabs and 3 different activities in each
Hi i have Tab activity(Chapter,subject) and database. i need to show the chapter_table content
I have a tab setup as an Activity extension using API8 max. In this
I have a TabbedView Activity with 3 tabs. Currently, only the 1st tab has

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.