我正在尝试设置一个名为“GetIntents”的 Intent 助手类。我的问题是,如何从活动中调用我的 GetIntents 助手类?
这是我的 GetIntents 助手类:
public class GetIntents extends Intent {
public static Intent i;
public static String username = i.getExtras().getString("uid");
public static String password = i.getExtras().getString("pwd");
public static String firstName = i.getExtras().getString("firstName");
public static String lastName = i.getExtras().getString("lastName");
public static String lastLatitudeUpdate = i.getExtras().getString("lastLatitudeUpdate");
public static int checkedin = i.getExtras().getInt("checkedin");
public static int Minute = i.getExtras().getInt("Minute");
public static int Hour = i.getExtras().getInt("Hour");
}
现在我不确定如何从我的活动中调用它。到目前为止,我已经尝试过:
GetIntents intent = new GetIntents();
intent.getIntent();
我也尝试了其他几种方法,但没有运气。关于我可以尝试什么的任何建议?
我的日志:
06-21 11:26:18.249: D/AndroidRuntime(8978): Shutting down VM
06-21 11:26:18.249: W/dalvikvm(8978): threadid=1: thread exiting with uncaught exception (group=0x40015578)
06-21 11:26:18.253: E/AndroidRuntime(8978): FATAL EXCEPTION: main
06-21 11:26:18.253: E/AndroidRuntime(8978): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.jetdelivery.mobile/com.jetdelivery.mobile.screen1}: java.lang.NullPointerException
06-21 11:26:18.253: E/AndroidRuntime(8978): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
06-21 11:26:18.253: E/AndroidRuntime(8978): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
06-21 11:26:18.253: E/AndroidRuntime(8978): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-21 11:26:18.253: E/AndroidRuntime(8978): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
06-21 11:26:18.253: E/AndroidRuntime(8978): at android.os.Handler.dispatchMessage(Handler.java:99)
06-21 11:26:18.253: E/AndroidRuntime(8978): at android.os.Looper.loop(Looper.java:130)
06-21 11:26:18.253: E/AndroidRuntime(8978): at android.app.ActivityThread.main(ActivityThread.java:3687)
06-21 11:26:18.253: E/AndroidRuntime(8978): at java.lang.reflect.Method.invokeNative(Native Method)
06-21 11:26:18.253: E/AndroidRuntime(8978): at java.lang.reflect.Method.invoke(Method.java:507)
06-21 11:26:18.253: E/AndroidRuntime(8978): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
06-21 11:26:18.253: E/AndroidRuntime(8978): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
06-21 11:26:18.253: E/AndroidRuntime(8978): at dalvik.system.NativeStart.main(Native Method)
06-21 11:26:18.253: E/AndroidRuntime(8978): Caused by: java.lang.NullPointerException
06-21 11:26:18.253: E/AndroidRuntime(8978): at com.jetdelivery.mobile.GetIntentHelper.getDataModel(GetIntentHelper.java:9)
06-21 11:26:18.253: E/AndroidRuntime(8978): at com.jetdelivery.mobile.screen1.<init>(screen1.java:66)
06-21 11:26:18.253: E/AndroidRuntime(8978): at java.lang.Class.newInstanceImpl(Native Method)
06-21 11:26:18.253: E/AndroidRuntime(8978): at java.lang.Class.newInstance(Class.java:1409)
06-21 11:26:18.253: E/AndroidRuntime(8978): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-21 11:26:18.253: E/AndroidRuntime(8978): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
06-21 11:26:18.253: E/AndroidRuntime(8978): ... 11 more