android .setText报错,找了很多答案还是不知道原因

android .setText出错,找了很多答案还是不知道原因
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#C7EDCC" >

    <TextView
        android:id="@+id/text1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="text1"
        android:textSize="30sp"
        android:textColor="#8B3A3A"
        android:gravity="right"
        android:layout_marginTop="15px"
         />
    <TextView 
        android:id="@+id/text2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
    android:layout_marginTop="10dip"
    android:textColor="#000000"
    android:textSize="19sp"
        android:text="text2"
        />

</LinearLayout>
public class MainActivity extends Activity {
private TextView myTxt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//----------------------------
 myTxt = (TextView) findViewById(R.id.text2);
 myTxt.setText("ajfijwofjowiejfoiewoi");
//----------------------------
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
------解决方案--------------------


/**
 * A placeholder fragment containing a simple view.
 */
public static class PlaceholderFragment extends Fragment {

public PlaceholderFragment() {
}
private TextView myTxt;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container,
false);
 myTxt = (TextView) rootView.findViewById(R.id.text2);
 myTxt.setText("Hello World!");
return rootView;
}
}