You have to use onActivityCreated method to use that:
In your class, just do:
public class FragmentMain extends Fragment {
public FragmentMain() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_main,container, false);
return view;
}
}
And immediately after that, use the onActivityCreated method:
Here's the code:
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
TextView textView = (TextView) getActivity().findViewById(R.id.fragment_main_textview);
Button x = (Button) getActivity().findViewById(R.id.deneme);
x.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent firstpage= new Intent(getActivity(),FragmentWizard.class);
getActivity().startActivity(firstpage);
}
});
}
Hope this works..:)