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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:18:24+00:00 2026-05-18T07:18:24+00:00

i have listview the fisrt time i when i click to row it open

  • 0

i have listview the fisrt time i when i click to row it open the context menu then i override the oncontextitemselected

public boolean onContextItemSelected(MenuItem item) {
    switch(item.getItemId()) {

        case CALL_ID:
        {
        AdapterContextMenuInfo info2 = (AdapterContextMenuInfo) item.getMenuInfo();

        String phone=mDbHelper.getPhone(info2.id);
        String toDial="tel:"+phone.toString();

        startActivity(new Intent(Intent.ACTION_DIAL,Uri.parse(toDial)));
        return true;
        }
    }
    return super.onContextItemSelected(item);
}

this do correctly but when i

public boolean onMenuItemSelected(int featureId, MenuItem item) {
        switch(item.getItemId()) {
        case CALL_ID:
        {
        AdapterContextMenuInfo info2 = (AdapterContextMenuInfo) item.getMenuInfo();

        String phone=mDbHelper.getPhone(info2.id);
        String toDial="tel:"+phone.toString();

        startActivity(new Intent(Intent.ACTION_DIAL,Uri.parse(toDial)));
        return true;
        }
        return super.onMenuItemSelected(featureId, item);
    }
}

the app crashed can u show me the difference between 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-18T07:18:25+00:00Added an answer on May 18, 2026 at 7:18 am

    Try this:

    context_menu.xml (res/menu/context_menu.xml)

    <?xml version="1.0" encoding="utf-8"?>
    <menu
      xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:id="@+id/call"
              android:title="CALL" />
    </menu>
    

    Context Menu:

    @Override
        public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
            super.onCreateContextMenu(menu, v, menuInfo);
            info = (AdapterView.AdapterContextMenuInfo)menuInfo;
            MenuInflater inflater = getMenuInflater();
            inflater.inflate(R.menu.context_menu, menu);
        }   
     @Override
        public boolean onContextItemSelected(MenuItem item) {
            switch (item.getItemId()) {
    
            case R.id.call: 
    
                String phone="555-555-555";
                String toDial="tel:"+phone.toString();
    
                Uri uri = Uri.parse(toDial);
                Intent it = new Intent(Intent.ACTION_DIAL, uri);  
                startActivity(it);  
    
            return true;
    
            default:
                return super.onContextItemSelected(item);
            }
        }
    

    AndroidManifest.xml

    <uses-permission  android:name="android.permission.CALL_PHONE"></uses-permission>
    

    That should work.

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

Sidebar

Related Questions

I have a listview <ListView Name=listView2> <ListView.View> <GridView> <!-- First Column --> <GridViewColumn Width=105
I have ListView that has the following EditItemTemplate: <EditItemTemplate> <tr style=> <td> <asp:LinkButton ID=UpdateButton
I have ListView in my project which has ListItems as in the form of
I have ListView that uses a GridView to display several columns of data. Two
I have ListView which is saving all data to database. For adding i have
I have a ListView that is set up with a MinHeight and a MaxHeight.
I have a ListView with a GridView with 3 columns. I want last column
I have a ListView on my checkout page with an ItemTemplate which build up
I have a listview with lists lines of an invoice (Which are editable), each
I have a ListView that I am populating with items from an ObservableCollection .

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.