this is the fragmentOne.java
package piestudio.opinion;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.view.MenuItem;
/**
* Created by jene on 7/4/2016.
*/
public class FragmentOne extends Fragment{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener(){
public boolean onNavigationItemSelected(MenuItem Item){
int id = Item.getItemId();
if( id == R.id.toi) {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
FragmentOne FragmentOne = new FragmentOne();
FragmentManager.beginTransaction()
.add(R.id.content_frame,FragmentOne,"Times of India")
.commit();
drawer.closeDrawer(navigationView);
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
});
}
}
i am getting these errors
Error:(19, 64) error: cannot find symbol method findViewById(int) Error:(27, 54) error: cannot find symbol method findViewById(int) Error:(29, 32) error: non-static method beginTransaction() cannot be referenced from a static context Error:(37, 54) error: cannot find symbol method findViewById(int)