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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:52:11+00:00 2026-05-26T05:52:11+00:00

I can seen to understand what I am doing wrong here. public void onCreateContextMenu(ContextMenu

  • 0

I can seen to understand what I am doing wrong here.

public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)menuInfo;
    Map<String, String> data = (Map<String, String>) getListView().getItemAtPosition(info.position);
    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    String admin = preferences.getString("Admin", null);
    String user_ids = preferences.getString("userID", null);
    menu.setHeaderTitle("Options");
    menu.add(0, profile, 0, "Show Profile");
if (admin.equals("Admin")){ 
    menu.add(0, add, 0, "Add Friend");
    menu.add(0, pm, 0, "Send PM");
    menu.add(0, warn, 0, "Send Warning");       
    menu.add(0, edit, 0, "Edit Post");
    menu.add(0, delete, 0, "Delete Post");
    menu.add(0, block, 0, "Block User");
}else if (data.get("pid").equals(user_ids)){
    menu.add(0, edit, 0, "Edit Post");
}else{
    menu.add(0, add, 0, "Add Friend");
    menu.add(0, pm, 0, "Send PM");
    menu.add(0, warn, 0, "Send Warning");       
    menu.add(0, block, 0, "Block User");
}
 }

It errors out to

            view.showContextMenu();

But if I comment out the IF ELSE statements it works. Confused.

  • 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-26T05:52:12+00:00Added an answer on May 26, 2026 at 5:52 am

    May be you write

    return super.onContextItemSelected(item);

    at ending of last if else condition.
    and more you can see these links. Link1, Link2 and Link3

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

Sidebar

Related Questions

i have seen some example of doing it but i still can't understand and
We have several areas where code like this can be seen public Map extractData(ResultSet
I have created a drop down with jQuery that can be seen here by
I have created a jQuery animation that can be seen by clicking the Preview
How do you precompile WCF code so that the WCF code can't be seen
Looking at tooltip support in Flex, I've seen you can apply colors and styles
Can I somehow disable spell-checking on HTML textfields (as seen in e.g. Safari)?
Has anyone seen this before - and can anything be done about it? This
I can't remember exactly where I've seen this strange `1 (single-tick and the number
I've seen somewhere but can not remember. How to get a SQL string 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.