I'm beginner to java and android, and i'm currently working on a project in which i have situation of using fragment within a fragment,and i have written a program (mentioned below) from which i am facing an app crash.

main fragment:

```
public class Register extends Fragment implements OnClickListener {
    FragmentManager manager = getChildFragmentManager();
    ImageButton newReg;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View register = inflater.inflate(R.layout.register, container, false);
        // TODO Auto-generated method stub
        newReg = (ImageButton) register.findViewById(R.id.newreg);
        newReg.setOnClickListener(this);
        return register;
    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        Fragment details = new Details();
        FragmentTransaction transaction = manager.beginTransaction();
        transaction.add(details, "adada");
        transaction.commit();
    }

}

```

nested fragment:

```
public class Details extends Fragment {
    EditText firstN,lastN,Phone,Email;
    Button Confirm;
 @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    View details=inflater.inflate(R.layout.register_details, container, false);
    return details;
}
}

```

Logcat output:

```
    08-22 15:30:32.907: D/OpenGLRenderer(31032): Enabling debug mode 0
08-22 15:30:35.095: D/AndroidRuntime(31032): Shutting down VM
08-22 15:30:35.095: W/dalvikvm(31032): threadid=1: thread exiting with uncaught exception (group=0x41674d40)
08-22 15:30:35.099: E/AndroidRuntime(31032): FATAL EXCEPTION: main
08-22 15:30:35.099: E/AndroidRuntime(31032): Process: com.example.apeonomy, PID: 31032
08-22 15:30:35.099: E/AndroidRuntime(31032): java.lang.IllegalStateException: No activity
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1049)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1853)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.app.Fragment.performActivityCreated(Fragment.java:1714)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:908)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.app.BackStackRecord.run(BackStackRecord.java:684)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.os.Handler.handleCallback(Handler.java:733)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.os.Handler.dispatchMessage(Handler.java:95)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.os.Looper.loop(Looper.java:136)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at android.app.ActivityThread.main(ActivityThread.java:5086)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at java.lang.reflect.Method.invokeNative(Native Method)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at java.lang.reflect.Method.invoke(Method.java:515)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
08-22 15:30:35.099: E/AndroidRuntime(31032):    at dalvik.system.NativeStart.main(Native Method)

```