title: Replacing toolbar title by icon
body: <p>Hello all I have an activity with three fragments.When the app launches it directly displays my activity with activity Name.and on clicking to fragments inside navigation drawer the toolbar title changes.Now I just want to replace the Toolbar title just of Activity with icon. for this I used setlogo.However I wish to make the icon visible just at the first time when the app launches.I mean when I select fragment I should be able to replace the icon by fragment name.</p>
  
  <p>this is my code of activity.Please help</p>
  
  <pre><code>package com.example.user.educationhunt;
  
  import android.app.Activity;
  import android.app.Dialog;
  import android.content.Intent;
  import android.content.res.Configuration;
  import android.net.ConnectivityManager;
  import android.net.NetworkInfo;
  import android.net.Uri;
  import android.os.AsyncTask;
  import android.support.design.widget.NavigationView;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentTransaction;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.ActionBarDrawerToggle;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.support.v7.widget.Toolbar;
  import android.util.Log;
  import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  import com.example.user.educationhunt.fragment.NearMe;
  import com.example.user.educationhunt.fragment.Register;
  import com.example.user.educationhunt.fragment.Search;
  import com.example.user.educationhunt.fragment.Settings;
  import com.example.user.educationhunt.pojos.feedbackData;
  
  import org.apache.http.HttpResponse;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.methods.HttpPost;
  import org.apache.http.entity.StringEntity;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.json.JSONObject;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  
  public class EduHunt extends AppCompatActivity {
      private DrawerLayout mDrawer;
      private Toolbar toolbar;
      private NavigationView nvDrawer;
      private ActionBarDrawerToggle drawerToggle;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_edu_hunt);
  
          toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          toolbar.setLogo(R.mipmap.edutext);
  
          mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
  
          nvDrawer = (NavigationView) findViewById(R.id.nvView);
          setupDrawerContent(nvDrawer);
  
          // Find our drawer view
          mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
          drawerToggle = setupDrawerToggle();
  
          // Tie DrawerLayout events to the ActionBarToggle
          mDrawer.addDrawerListener(drawerToggle);
  
          FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
          tx.replace(R.id.flContent, new Search());
          tx.commit();
  
  
      }
  
      private ActionBarDrawerToggle setupDrawerToggle() {
          return new ActionBarDrawerToggle(this, mDrawer, toolbar, R.string.drawer_open, R.string.drawer_close);
      }
  
      private void setupDrawerContent(NavigationView navigationView) {
          navigationView.setNavigationItemSelectedListener(
                  new NavigationView.OnNavigationItemSelectedListener() {
                      @Override
                      public boolean onNavigationItemSelected(MenuItem menuItem) {
                          selectDrawerItem(menuItem);
                          return true;
                      }
                  });
      }
  
      public void selectDrawerItem(MenuItem menuItem) {
          // Create a new fragment and specify the fragment to show based on nav item clicked
          Fragment fragment = null;
          Class fragmentClass;
          switch (menuItem.getItemId()) {
              case R.id.search:
                  fragmentClass = Search.class;
                  break;
              case R.id.settings:
                  fragmentClass = Settings.class;
                  break;
              case R.id.register:
                  fragmentClass = Register.class;
                  break;
              case R.id.nearme:
                  fragmentClass = NearMe.class;
                  break;
              default:
                  fragmentClass = Search.class;
          }
  
          try {
              fragment = (Fragment) fragmentClass.newInstance();
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          FragmentManager fragmentManager = getSupportFragmentManager();
          fragmentManager.beginTransaction().replace(R.id.flContent, fragment).commit();
  
          menuItem.setChecked(true);
          setTitle(menuItem.getTitle());
          mDrawer.closeDrawers();
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          if (drawerToggle.onOptionsItemSelected(item)) {
              return true;
          }
          switch (item.getItemId()){
              case R.id.our_team:
                  final Dialog dialog=new Dialog(this);
                  dialog.setContentView(R.layout.activity_our_team);
                  dialog.show();
                  return true;
              case R.id.feedback:
                  startActivity(new Intent(EduHunt.this,SendFeedback.class));
                  return true;
  
          }
          return super.onOptionsItemSelected(item);
      }
  
  
      @Override
      protected void onPostCreate(Bundle savedInstanceState) {
          super.onPostCreate(savedInstanceState);
          drawerToggle.syncState();
      }
  
      @Override
      public void onConfigurationChanged(Configuration newConfig) {
          super.onConfigurationChanged(newConfig);
          // Pass any configuration change to the drawer toggles
          drawerToggle.onConfigurationChanged(newConfig);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.education_hunt, menu);
          return true;
      }
  }
  </code></pre>
  
  <p>this is my toolbar.xml</p>
  
  <pre><code>&lt;android.support.v7.widget.Toolbar
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/toolbar"
      android:layout_height="wrap_content"
      android:layout_width="match_parent"
      android:fitsSystemWindows="true"
      android:minHeight="?attr/actionBarSize"
      app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
      android:background="?attr/colorPrimaryDark"&gt;
  &lt;/android.support.v7.widget.Toolbar&gt;
  </code></pre>