title: Open an activity from a Fragment in Android
body: <p>Whenever I use or implement <code>onClickListner</code> in <code>Fragment</code>, the application crashes. I have tried all the methods like implementing the fragment class using on click in XML but the application crashes all the time. Please help me with this. I don’t even write anything in the <code>onClick</code> override method and still, the application crashes.</p>
  
  <pre><code>Button btn_edit;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
       View rootView=inflater.inflate(R.layout.multi_frag,container,false);
       btn_edit=(Button)rootView.findViewById(R.id.edit);
       btn_edit.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
  
           }
       });
       return inflater.inflate(R.layout.activity_account,container,false);
   }
  </code></pre>