title: How to access a button from in a another layout in a Fragment
body: <p>i am trying to get a button from another layout in fragment.this fragment have another inflate another layout.i get a java.lang.NullPointerException. how to solve this problem?</p>
  
  <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      final View view = inflater.inflate(R.layout.add_to_cart_display, container, false);
  
  
      myAdapter=new MyAdapter(getActivity());
  
      Button remove=(Button) view.findViewById(R.id.remove_cart_items);
      RecyclerView recyclerView=(RecyclerView)view.findViewById(R.id.recyclerView);
      recyclerView.setHasFixedSize(true);
      ch=new CartHelper(getActivity());
      recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
      rc=new RCadapter(getDataset());
      recyclerView.setAdapter(rc);
  
  
  
      return view;
  
  
  }
  </code></pre>
  
  <p>from above pgm the remove button not in the add_cart_display xml file. it locate in another layout file. here i am accessing this button.it give the following error.</p>
  
  <blockquote>
    <p>10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
    E/AndroidRuntime: FATAL EXCEPTION: main 10-31 12:38:20.484
    13886-13886/com.infizoom.infishopping E/AndroidRuntime: Process:
    com.infizoom.infishopping, PID: 13886 10-31 12:38:20.484
    13886-13886/com.infizoom.infishopping E/AndroidRuntime:
    java.lang.NullPointerException 10-31 12:38:20.484
    13886-13886/com.infizoom.infishopping E/AndroidRuntime:     at
    com.infizoom.infishopping.add_cart_class.onStart(add_cart_class.java:75)
    10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
    E/AndroidRuntime:     at
    android.app.Fragment.performStart(Fragment.java:1724) 10-31
    12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:<br>
    at
    android.app.FragmentManagerImpl.moveToState(FragmentManager.java:918)
    10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
    E/AndroidRuntime:     at
    android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
    10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
    E/AndroidRuntime:     at
    android.app.BackStackRecord.run(BackStackRecord.java:698) 10-31
    12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:<br>
    at
    android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
    10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
    E/AndroidRuntime:     at
    android.app.FragmentManagerImpl$1.run(FragmentManager.java:443) 10-31
    12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:<br>
    at android.os.Handler.handleCallback(Handler.java:808) 10-31
    12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:<br>
    at android.os.Handler.dispatchMessage(Handler.java:103) 10-31
    12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:<br>
    at android.os.Looper.loop(Looper.java:193) 10-31 12:38:20.484
    13886-13886/com.infizoom.infishopping E/AndroidRuntime:     at
    android.app.ActivityThread.main(ActivityThread.java:5341) 10-31
    12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:<br>
    at java.lang.reflect.Method.invokeNative(Native Method) 10-31
    12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:<br>
    at java.lang.reflect.Method.invoke(Method.java:515) 10-31 12:38:20.484
    13886-13886/com.infizoom.infishopping E/AndroidRuntime:     at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
    10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
    E/AndroidRuntime:     at
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641) 10-31
    12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:<br>
    at dalvik.system.NativeStart.main(Native Method)</p>
  </blockquote>
  
  <p>add_to_cart_display.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_marginTop="@dimen/abc_action_bar_default_height_material"
  android:layout_height="match_parent"&gt;
  &lt;android.support.v7.widget.RecyclerView
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/recyclerView"
      android:layout_width="fill_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity"
      /&gt;
  </code></pre>
  
  <p></p>
  
  <p>Remove Button inside the CardView</p>