So uh... i have a ViewPager Activity (MasterActivity) with 3 Fragments (Master1Fragment, Master2Fragment, Master3Fragment) which store values in excel file. I have no problem saving the data collected from controls (EditText, Spinner, CheckBox etc) in all 3 fragments (i place the Save Button on third fragment, Master3Fragment) with OnClick Event in 3rd Fragment.
Problem arise when i try to load data from the OnCreate event in the MasterActivity (I suspect it's because the fragments haven't finished created) if that is so, in what event should i put my LoadData Function? I want to load the data automatically when the user open the Activity.
Error generated at here:
...
} else {
    //non empty cells handler
    switch (cn) {
        case 0:
            Master2Fragment.etKrg1.setText((int) c.getNumericCellValue());
            break;
        case 1:
...
Part of LogCat:
08-29 14:31:17.591  12886-12886/com.bakemono.fertilizerchecking.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.bakemono.fertilizerchecking.app, PID: 12886
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bakemono.fertilizerchecking.app/com.bakemono.fertilizerchecking.app.MasterActivity}: java.lang.NullPointerException
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2200)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
        at android.app.ActivityThread.access$800(ActivityThread.java:139)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5105)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.NullPointerException
        at com.bakemono.fertilizerchecking.app.MasterActivity.loadMaster(MasterActivity.java:575)
        at com.bakemono.fertilizerchecking.app.MasterActivity.onCreate(MasterActivity.java:120)
        at android.app.Activity.performCreate(Activity.java:5275)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
 
     
    