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

The Archive Base Latest Questions

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

I am making an application in which I have to change the position of

  • 0

I am making an application in which I have to change the position of the selected item in list view to first position and set other items one position less than current How can i do this.
Can any body suggest me some tutorial or any suggestion.

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

    Use Adapter, and arraylist on item click remove the item from that position. out it at the 0th position and use notifyDataSetChanged to reaarange the listview

    Example

    import java.util.ArrayList;
    
    import android.app.ListActivity;
    import android.content.Context;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.AdapterView;
    import android.widget.AdapterView.OnItemClickListener;
    import android.widget.ArrayAdapter;
    import android.widget.ListView;
    
    public class Main_Screen extends ListActivity implements OnItemClickListener{
        ArrayAdapter arrayAdapter = null;
        /** Called when the activity is first created. */
        Context context = null;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            penList.add("MONT Blanc");
            penList.add("Gucci");
            System.out.println("...1...");
            arrayAdapter = new ArrayAdapter<String>(this,
                    android.R.layout.simple_list_item_1, penList);
            arrayAdapter.add("last by adapter");
    
    
            setListAdapter(arrayAdapter);
            penList.add("Last By list");
            arrayAdapter.add("last by adapter2");
    
            getListView().setTextFilterEnabled(true);
            ListView lv = getListView();
            this.registerForContextMenu(lv);
    
            lv.setOnItemClickListener(this);
    
    
        }
    
    
    
        static ArrayList<String> penList   = new ArrayList<String>();
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            // TODO Auto-generated method stub
            String str = penList.get(arg2);
            penList.remove(arg2);
            penList.add(0, str);
            arrayAdapter.notifyDataSetChanged();
        }
    
    
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making one project in which use of map-view is required. I have
I am making an application which will have an interface similar to Photoshop: multiple
I am thinking of making an (initially) small Web Application, which would eventually have
I'm making a web application in which certain pages are login-protected. I have created
I am making an android application which has a main activity and several other
I am making one Html application. I have number of images in my folder.I
Hey, so I have been making an application which sends weekly notifications at user-specified
I am making an application which has j2me in client side and dotnet on
I am making an application which is a user interface to access 2 types
I'm making an application which uses MANY images. The application gets the images from

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.