android - openOptionsMenu() not working -


Well, tried many ways to solve this problem but nothing ... I via menu item I want to open the options menu from

  package com.example.tachles; Import android.content.Intent; Import android.net.Uri; Importroid.os.Bundle; Import android.view.Menu; Import android.view.MenuInflater; Import android.view.MenuItem; Import android.view.View; Import android.view.View.OnClickListener; Import android.widget.ImageView; Import android.widget.ShareActionProvider; Override public null at public class main activity animation activity (private share actionprovider mShareActionProvider; image view history, contact, information, share; @Create {bundle saved instanestate} {super.Nocrat (savedinstenstate); setContentView (R.layout .activity_main); History = (image view) Find VVBIID (RID imageV2); history.setOnClickListener (New View.OnClickListener) {public void onClick (see v) {History of Intro = New Intent (getApplicationContext ( ), HistoryMenu.clas s; startActivity (history);}}); contact = (ImageView) findViewById (R.id.imageView8); contact.setOnClickListener (New OnClickListener) {public void onClick (see v) {string recepientEmail = "mirnax.info @ gmail.com "; intent = new intent (Intent.ACTION_SENDTO); intent.setData (Uri.parse (" mailto: "+ recepientEmail)); initiality (intent);}}); info = (ImageView) findViewById ( R.id.imageView9); info.setOnClickListener (New View.OnClickListener () {public void onClick (see v) {intent info = new intent (getApplicationContext (), Odot.class); startActivity (info);}}); } // menu @ override public boolean on cret option menu (menu menu) {MenuInflater inflater = getMenuInflater (); Inflater.inflate (R. menu.actionbar, menu); // get ActionProvider for later use in mShareActionProvider = (ShareActionProvider) menu.findItem (R.id.action_share) .getActionProvider (); / ** Setting a Share Intent * / mShareActionProvider.setShareIntent (getDefaultShareIntent ()); Return super.Connect option menu (menu); } Private Intent is the Definition Shareentant () {intention intended = new intent (Intent.ACTION_SEND); Intent.setType ("text / plain"); Intentkputeshtr (Intent.akstro_sbjekt, "× × × ?? × ?? '× × × × × × × × × × × × × × × × × × × × × × × × × × × × × × × × × × ?? × ?? × ?? × ?? × ×? ×? × × × ×? × ?? × × × × ¨ × ?? × ×? × × × × ""); Intentkputeshtr (Intent .EXTRA_TEXT, "https://play.google.com/store/apps/details?id=com.tachles"); intend to return;} public void option (menu item items) {MainActivity.this.openOptionsMenu ();} public void (eg Menuitm item) {switch (Aitet. Aitimaidi ()) {case Arkaid.akshn_ like: Uri uri = Uri. PRS ( "https://m.facebook.com/tachles.mirnax?_rdr") ; Intent = new intent (Intent.ACTION_VIEW, uri); startActivity;}}}   

He has also tried in such a way and it does nothing ...

Please help ... no errors, no logcat ... "post -text "itemprop =" text ">

Use the Override method to create a context menu view.

  Override public null at @revercideContentContextMenu (context menu menu, view v , Context menuinfo menuinfo) {super. Menu.add (0, 1, 0, "Menu 1"); Menu.add (0, 2, 0, "Menu 2"); menu.add (0, 3, 0, "menu 3"); }   

Use the override method to handle the click listener in your activity code. In

  @Override public boolean on Conteksaitim selected (MenuItem item) {switch (item.getItemId ()) {case 1: // break your code here; Case 2: // Break your code here; Case 3: // Break your code here; Default: Break; }   

Simply registerForContextMenu (yourButton) in your onCreateView () ; and execute onClickListener () YourClassName.this.openContextMenu (v);

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -