1. Are you ready for the Galaxy S20? Here is everything we know so far!

Accessing Toolbar in fragment - Marshmallow

Discussion in 'Android Development' started by Talha Hasan Zia, Feb 10, 2016.

  1. Talha Hasan Zia

    Thread Starter

    I want to access toolbar to get text from EditText child of toolbar. I cannot directly access it, so i tried to get toolbar first.

    I have tried several codes nothing is giving me toolbar.

    Toolbar toolbar =(Toolbar) getActivity().findViewById(R.id.toolbar);

    AppCompatActivity act =(AppCompatActivity) getActivity();
    Toolbar toolbar =(Toolbar) act.getSupportActionBar().getCustomView();

    1. Download the Forums for Android™ app!



Share This Page