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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:01:30+00:00 2026-06-07T17:01:30+00:00

I am new in Android developing, and my question is about what is the

  • 0

I am new in Android developing, and my question is about what is the best way to provide options for listview items?
On the Bada OS, you can slide any listview item horizontally away, and access the options for that item.
http://horrorcoding.altervista.org/developing-on-bada-2-0-%E2%80%93-how-to-use-listcontextitems-in-a-listviewgroupedlistview/

But this does not exist on Android. So how to do it?
My main activity has a listview, if you click on an item, it opens a new activity with the details of the clicked item.

But on the main activity, you should be able to delete or edit any item.
So my ideas:

idea1:
I put a small edit icon on the top-right corner of the item, and when user click on this, I display QuickAction with Edit/Delete options.
http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
If user clicks on other part of the item, just open the details activity.

idea2:
I use contextmenu for long-press on the item. But this option is “invisible” for the users, so how can they know that they can do a long-press on the items?

What do you think?

  • 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-06-07T17:01:32+00:00Added an answer on June 7, 2026 at 5:01 pm

    The usual method is to create a context menu for the list (activated by a long click on a list item).

    And the “long press for context menu” is an Android standard. Any user is aware of it, no need to provide an indicator (IMO). Since you are making an Android app, I would stick with the Android convention. 🙂

    It sounds like you know how to implement it, but in case you dont…

    First, you register your list for a context menu:

    ...
    setListAdapter(lists);
    registerForContextMenu(getListView());
    

    Then you provide code ot create the context menu (you can create it from an XML resource too, but I don’t have an example of that handy):

    @Override
    public void onCreateContextMenu(ContextMenu menu, View v,
            ContextMenuInfo menuInfo) {
        super.onCreateContextMenu(menu, v, menuInfo);
        menu.setHeaderTitle("Item Operations");
        menu.add(0, v.getId(), 0, "Edit Item");
        menu.add(0, v.getId(), 0, "Delete Item");
    }
    

    Then you provide the code to handle the options in the menu:

    @Override
    public boolean onContextItemSelected(MenuItem item) {
        AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
                .getMenuInfo();
        if (item.getTitle() == "Edit Item") {
            mRowId = info.id;
            DialogFragment_Item idFragment = new DialogFragment_Item();
            idFragment.show(getFragmentManager(), "dialog");
        } else if (item.getTitle() == "Delete Item") {
            mDbHelper.deleteItem(info.id);
            return true;
        }
        return super.onContextItemSelected(item);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A new question about android and services. Currently I'm developing a App that should
I am new to developing for android. I have a question regarding some best
I am new to android and developing a navigation based application for android.My question
I have been developing Android application, and I have one question - ListView uses
I'm new to android programming and i have a question I'm developing an alarm
I'm new to android developing, so i apologise if this is a simple/noob-ish question,
I am not sure the best way to ask this question. I am new
Hello i am new in android and i am developing one application in which
I am very new to android and I am developing this app which allows
I'm new to android development. I'm developing an application for android 4.0.3 devices, in

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.