title: How to solve inconvertable types cannot cast "Android.support.v4.app.fragment" to "packagename"
body: <p>I am creating an android application that consists of navigation drawer in android studio.
  I am getting an error called inconvertable types cannot cast <strong>"How to solve inconvertable types cannot cast "Android.support.v4.app.fragment" to "packagename""</strong> please helpme howto solve this.
  This is my activity_main.java</p>
  
  <pre><code>package sample.lakshman.com.sampleltester;
  
  import android.content.Intent;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.ActionBarActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.support.v7.widget.Toolbar;
  import sample.lakshman.com.sampleltester.Fragment_navigation;
  
  
  
  
  public class MainActivity extends ActionBarActivity {
      public Toolbar toolbar;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          toolbar = (Toolbar) findViewById(R.id.tool_bar);
          setSupportActionBar(toolbar);
  
  
          Fragment_navigation drawer_navigation = (Fragment_navigation)getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);
          drawer_navigation.setUp((DrawerLayout)findViewById(R.id.drawer_layout),toolbar);
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
          if(id==R.id.navigation_item)
          {
              Intent sub = new Intent(MainActivity.this,Subactivity.class);
              startActivity(sub);
          }
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>This is my main_activity.xml</p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/drawer_layout"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          &gt;
  
          &lt;include
              android:id="@+id/tool_bar"
              layout="@layout/tool_bar" /&gt;
      &lt;/RelativeLayout&gt;
      &lt;fragment
          android:id="@+id/fragment_navigation_drawer"
          android:layout_width="250dp"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          app:layout="@layout/fragment_fragment_navigation"
          android:name="sample.lakshman.com.sampleltester.Fragment_navigation"
          tools:layout="@layout/fragment_fragment_navigation" /&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>