0

I want to use the android floating action button (FAB) on my webview as a share action button >> to share current url to ( facebook - whatsapp ....etc )

here is the code

public class MainActivity extends AppCompatActivity
    implements NavigationView.OnNavigationItemSelectedListener {

//initializing webview
private WebView mwebView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });

1 Answers1

0

This Works for me ..

How to activate "Share" button in android app?

also check this if you want to use ( action bar buttons ) for sharing and refresh

Set sharing intent using icon in action bar

Community
  • 1
  • 1