单击Tab(ActivityGroup)时java.lang.NullPointerException

时间:2014-09-10 07:15:57

标签: java android tabs tabview activitygroup

我有2班电话和dialpad.java。在手机类我有5行,当你点击线路时,dialpad.java类将打开。我想在单个标签中运行multiActivities

我有主页选项卡,在主页选项卡中,当我点击主页选项卡中的拨号盘活动时显示电话活动,所以我使用ActivityGroup来执行此操作。但我面临的问题是当拨号活动打开时我选择程序关闭的其他选项卡。出现NullPointerException。

Phone.java

public class Phone extends ActivityGroup 
{
public void ShowDialPad(int nFreeLineNo, String sPhoneNo) 
   {
       Intent intent = new Intent(Phone.this , DialPad.class);

    //   intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
       intent.putExtra("LineNo", nFreeLineNo);
       intent.putExtra("PhoneNo", sPhoneNo);

       contentView("Activity", intent);

    //   startActivity(intent);
   }
public void contentView(String id, Intent newIntent) 
    {
        View obj_view = getLocalActivityManager().startActivity(id, newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();

        this.setContentView(obj_view);

    }
}

这些是错误

09-10 12:13:17.031: E/AndroidRuntime(6227): FATAL EXCEPTION: main
09-10 12:13:17.031: E/AndroidRuntime(6227): java.lang.RuntimeException: Unable to stop activity {com.vax.dev.lib/com.vax.dev.lib.Tab_Activity}: java.lang.RuntimeException: Unable to stop activity {com.vax.dev.lib/com.vax.dev.lib.AccountSIP}: java.lang.NullPointerException
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3090)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3144)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.ActivityThread.access$1200(ActivityThread.java:127)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1194)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.os.Looper.loop(Looper.java:137)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.ActivityThread.main(ActivityThread.java:4512)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at java.lang.reflect.Method.invokeNative(Native Method)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at java.lang.reflect.Method.invoke(Method.java:511)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:984)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:751)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at dalvik.system.NativeStart.main(Native Method)
09-10 12:13:17.031: E/AndroidRuntime(6227): Caused by: java.lang.RuntimeException: Unable to stop activity {com.vax.dev.lib/com.vax.dev.lib.AccountSIP}: java.lang.NullPointerException
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:2820)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.ActivityThread.performStopActivity(ActivityThread.java:2743)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:184)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.LocalActivityManager.dispatchStop(LocalActivityManager.java:577)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.ActivityGroup.onStop(ActivityGroup.java:82)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1177)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.Activity.performStop(Activity.java:4603)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3085)
09-10 12:13:17.031: E/AndroidRuntime(6227):     ... 11 more
09-10 12:13:17.031: E/AndroidRuntime(6227): Caused by: java.lang.NullPointerException
09-10 12:13:17.031: E/AndroidRuntime(6227):     at com.vax.dev.lib.AccountSIP.onStop(AccountSIP.java:270)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1177)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.Activity.performStop(Activity.java:4603)
09-10 12:13:17.031: E/AndroidRuntime(6227):     at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:2817)

0 个答案:

没有答案