Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Error occurred when opening a tab group

$
0
0

I got a null exception when switching from login view to a tabgroup (my home screen).

This is my index.xml

<Alloy>
    <TabGroup id="tabGroup">
        <Require src="home" id="tabHome" />
        <Require src="account" id="tabAccount" />
    </TabGroup>
</Alloy>
This is my index.js
var accountService = require('accountService');
 
Alloy.Globals.tabGroup = $.tabGroup;
 
if (! accountService.isLoggedIn()) {
    var loginController = Alloy.createController('login');
    loginController.getView().open();
} else {
    $.tabGroup.open();
    $.tabGroup.setActiveTab(0); 
}
And in my login.js, there is a function to check if login succeeds. If yes, switch to my home screen (tabHome)
function loginActionSuccessCallback(success){
    log.info("User " + user.shopper.email + " logged in.");
 
    $.loginForm.close();
    $.loginForm = null;
    log.error("============================ 1");
    Alloy.Globals.tabGroup.open();  
        log.error("============================ 2");
        Alloy.Globals.tabGroup.setActiveTab(0);
        log.error("============================ 3");
}
Here is the error I got:
[INFO] :   [10/2/2014 15:26:29] User user@example.com logged in.
[ERROR] :  [10/2/2014 15:26:30] ============================ 1
[WARN] :   dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41a78898)
[ERROR] :  TiApplication: (main) [31124,31124] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.4.0,2014/09/25 16:42,b54c467
[ERROR] :  TiApplication: java.lang.NullPointerException
[ERROR] :  TiApplication:   at android.content.ComponentName.<init>(ComponentName.java:75)
[ERROR] :  TiApplication:   at android.content.Intent.<init>(Intent.java:4134)
[ERROR] :  TiApplication:   at ti.modules.titanium.ui.TabGroupProxy.handleOpen(TabGroupProxy.java:300)
[ERROR] :  TiApplication:   at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:88)
[ERROR] :  TiApplication:   at ti.modules.titanium.ui.TabGroupProxy.handleMessage(TabGroupProxy.java:104)
[ERROR] :  TiApplication:   at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR] :  TiApplication:   at android.os.Looper.loop(Looper.java:137)
[ERROR] :  TiApplication:   at android.app.ActivityThread.main(ActivityThread.java:5419)
[ERROR] :  TiApplication:   at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR] :  TiApplication:   at java.lang.reflect.Method.invoke(Method.java:525)
[ERROR] :  TiApplication:   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
[ERROR] :  TiApplication:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
[ERROR] :  TiApplication:   at dalvik.system.NativeStart.main(Native Method)
I am using Titanium 3.4 and Android 4.3.

Could anyone help to give any hint here? Thanks a lot!


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>