How To Make A Share Menu Item On Action Bar


In order to add a share menu on action bar. First you needs to make a menu item, that i was showed in the previous post. Now according to previous post add this mymenu.xml file on your main java by below codes.

Now you needs to make  onOptionsItemSelected method according to following code and handle the share option menu by using 
Intent intent=new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
startActivity(Intent.createChooser(intent,"Share With"));

Comments

Popular posts from this blog

How to write bangla language in Android Studio

How to create Switch with SSwitch Control with setOnCheckedChangeListener