comment accéder aux éléments de l'INTERFACE utilisateur dans le parent de l'activité de fragment

parent de l'activité mise en page

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".LockerCodeActivity" >

    <LinearLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </LinearLayout>

    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:id="@+id/ctrlActivityIndicator"
        android:indeterminateOnly="true"
        android:keepScreenOn="false"
     />

    <TextView
        android:id="@+id/tv_results"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="" />

</RelativeLayout>

Gonfler le fragment dans le parent de l'activité de la fonction onCreate

FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    Fragment scannerFragment = new ScanFragment();
    fragmentTransaction.add(R.id.fragment_container, scannerFragment);
    fragmentTransaction.commit();

Fonctionne très bien jusqu'à maintenant... maintenant, comment puis-je cacher la barre de progression?
C'est ce que j'ai essayé

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_scan, container, false);

    ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.ctrlActivityIndicator);
    progressBar.setVisibility(View.INVISIBLE);
    return view;
    }

J'obtiens une exception de pointeur null

InformationsquelleAutor Matt | 2013-01-24