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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:55:45+00:00 2026-05-25T14:55:45+00:00

I have a ListFragment Activity. I want to create a method for onItemClickedLongPress, so

  • 0

I have a ListFragment Activity.

I want to create a method for onItemClickedLongPress, so that when the user does this. a menu pops up. I am familiar with creating the menu.

So if some one would please, give me further instructions on how to set Override the longpress in a ListFragment activity?

  • 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-25T14:55:45+00:00Added an answer on May 25, 2026 at 2:55 pm

    edit: this sample shows how to show something other then system menu fx. QuickAction from https://github.com/lorensiuswlt/NewQuickAction

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        //.......
        registerForContextMenu(getListView());
    }
    
    @Override
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
        super.onCreateContextMenu(menu, v, menuInfo);
        AdapterView.AdapterContextMenuInfo amenuInfo = (AdapterView.AdapterContextMenuInfo) menuInfo;
        Object item = getListAdapter().getItem(amenuInfo.position);
        //item could be Cursor/String/YourObject it depends on Adapter
        //show popup fx. QuickAction from https://github.com/lorensiuswlt/NewQuickAction
        QuickAction qa = new QuickAction(getActivity());
        qa.setAnimStyle(QuickAction.ANIM_AUTO);
        qa.show(amenuInfo.targetView);
    }
    

    EDIT:
    This ansewer is not good
    … why i did this such strange method? because eclipse intellisense did not propmt "good" setOnLongClickListener for ListView (since ListView has at least 2 setOnLongClickListener methods … one from View and second from AdapterView class) … the easiest way is let your ListFragment implement AdapterView.OnItemLongClickListener and then in onViewCreated add code getListView().setOnLongClickListener(this);

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

Sidebar

Related Questions

I want to test the functionality of an activity that contains a ListFragment ,
I want to override the onAttach() http://developer.android.com/reference/android/app/Fragment.html#onAttach(android.app.Activity ) method of a ListFragment from the
I have create a listfragment and a button which looks like as follows (
I have a ListView in a ListFragment that is populated via a database query.
In my app I have a FragmentActivity that implements ListFragment.OnSelectedListener. The ListFragment uses a
I have a fragment view that needs replacement with another fragment. When the ListFragment
My Custom Adapter that extends SimpleCursorAdapter for my ListFragment does not display the items
My app is using a ListFragment on left side that the user can use
In my tablet application I want to create a fragment that displays information based
Hello I have a problem with the onListItemClick Method on a ListFragment. I have

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.