Aplication stops working (Android emulator)

You must Login before you can answer or comment on any questions.

Hi a am trying to make an RSS reader for android... everything looks good, the application shows the lists of rss feeds but when i try to open one of them i get this error:

Sorry The application RSSreadr has stopped unexpectedly. Please try again.

FORCE CLOSE

This is the log error:

[ERROR][TiApplication( 297)] (main) [41579,50137] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.twoappguys.com/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: uriString; Titanium 2.1.2,2012/08/24 14:46,ed7f777 [ERROR][TiApplication( 297)] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.twoappguys.com/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: uriString [ERROR][TiApplication( 297)] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) [ERROR][TiApplication( 297)] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) [ERROR][TiApplication( 297)] at android.app.ActivityThread.access$2300(ActivityThread.java:125) [ERROR][TiApplication( 297)] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) [ERROR][TiApplication( 297)] at android.os.Handler.dispatchMessage(Handler.java:99) [ERROR][TiApplication( 297)] at android.os.Looper.loop(Looper.java:123) [ERROR][TiApplication( 297)] at android.app.ActivityThread.main(ActivityThread.java:4627) [ERROR][TiApplication( 297)] at java.lang.reflect.Method.invokeNative(Native Method) [ERROR][TiApplication( 297)] at java.lang.reflect.Method.invoke(Method.java:521) [ERROR][TiApplication( 297)] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) [ERROR][TiApplication( 297)] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) [ERROR][TiApplication( 297)] at dalvik.system.NativeStart.main(Native Method) [ERROR][TiApplication( 297)] Caused by: java.lang.NullPointerException: uriString [ERROR][TiApplication( 297)] at android.net.Uri$StringUri.<init>(Uri.java:420) [ERROR][TiApplication( 297)] at android.net.Uri$StringUri.<init>(Uri.java:410) [ERROR][TiApplication( 297)] at android.net.Uri.parse(Uri.java:382) [ERROR][TiApplication( 297)] at ti.modules.titanium.ui.widget.webview.TiUIWebView.setUrl(TiUIWebView.java:271) [ERROR][TiApplication( 297)] at ti.modules.titanium.ui.widget.webview.TiUIWebView.processProperties(TiUIWebView.java:207) [ERROR][TiApplication( 297)] at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:893) [ERROR][TiApplication( 297)] at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:442) [ERROR][TiApplication( 297)] at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:434) [ERROR][TiApplication( 297)] at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:412) [ERROR][TiApplication( 297)] at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:528) [ERROR][TiApplication( 297)] at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:205) [ERROR][TiApplication( 297)] at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:111) [ERROR][TiApplication( 297)] at ti.modules.titanium.ui.ActivityWindowProxy.handleMessage(ActivityWindowProxy.java:93) [ERROR][TiApplication( 297)] at android.os.Handler.dispatchMessage(Handler.java:95) [ERROR][TiApplication( 297)] at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:365) [ERROR][TiApplication( 297)] at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:350) [ERROR][TiApplication( 297)] at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:235) [ERROR][TiApplication( 297)] at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:262) [ERROR][TiApplication( 297)] at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:187) [ERROR][TiApplication( 297)] at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:612) [ERROR][TiApplication( 297)] at ti.modules.titanium.ui.TiUIActivityWindow.windowCreated(TiUIActivityWindow.java:142) [ERROR][TiApplication( 297)] at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:31) [ERROR][TiApplication( 297)] at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:361) [ERROR][TiApplication( 297)] at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:434) [ERROR][TiApplication( 297)] at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:22) [ERROR][TiApplication( 297)] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) [ERROR][TiApplication( 297)] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) [ERROR][TiApplication( 297)] ... 11 more [ERROR][AndroidRuntime( 297)] FATAL EXCEPTION: main [ERROR][AndroidRuntime( 297)] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.twoappguys.com/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: uriString [ERROR][AndroidRuntime( 297)] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) [ERROR][AndroidRuntime( 297)] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) [ERROR][AndroidRuntime( 297)] at android.app.ActivityThread.access$2300(ActivityThread.java:125) [ERROR][AndroidRuntime( 297)] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) [ERROR][AndroidRuntime( 297)] at android.os.Handler.dispatchMessage(Handler.java:99) [ERROR][AndroidRuntime( 297)] at android.os.Looper.loop(Looper.java:123) [ERROR][AndroidRuntime( 297)] at android.app.ActivityThread.main(ActivityThread.java:4627) [ERROR][AndroidRuntime( 297)] at java.lang.reflect.Method.invokeNative(Native Method) [ERROR][AndroidRuntime( 297)] at java.lang.reflect.Method.invoke(Method.java:521) [ERROR][AndroidRuntime( 297)] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) [ERROR][AndroidRuntime( 297)] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) [ERROR][AndroidRuntime( 297)] at dalvik.system.NativeStart.main(Native Method) [ERROR][AndroidRuntime( 297)] Caused by: java.lang.NullPointerException: uriString [ERROR][AndroidRuntime( 297)] at android.net.Uri$StringUri.<init>(Uri.java:420) [ERROR][AndroidRuntime( 297)] at android.net.Uri$StringUri.<init>(Uri.java:410) [ERROR][AndroidRuntime( 297)] at android.net.Uri.parse(Uri.java:382) [ERROR][AndroidRuntime( 297)] at ti.modules.titanium.ui.widget.webview.TiUIWebView.setUrl(TiUIWebView.java:271) [ERROR][AndroidRuntime( 297)] at ti.modules.titanium.ui.widget.webview.TiUIWebView.processProperties(TiUIWebView.java:207) [ERROR][AndroidRuntime( 297)] at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:893) [ERROR][AndroidRuntime( 297)] at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:442) [ERROR][AndroidRuntime( 297)] at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:434) [ERROR][AndroidRuntime( 297)] at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:412) [ERROR][AndroidRuntime( 297)] at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:528) [ERROR][AndroidRuntime( 297)] at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:205) [ERROR][AndroidRuntime( 297)] at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:111) [ERROR][AndroidRuntime( 297)] at ti.modules.titanium.ui.ActivityWindowProxy.handleMessage(ActivityWindowProxy.java:93) [ERROR][AndroidRuntime( 297)] at android.os.Handler.dispatchMessage(Handler.java:95) [ERROR][AndroidRuntime( 297)] at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:365) [ERROR][AndroidRuntime( 297)] at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:350) [ERROR][AndroidRuntime( 297)] at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:235) [ERROR][AndroidRuntime( 297)] at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:262) [ERROR][AndroidRuntime( 297)] at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:187) [ERROR][AndroidRuntime( 297)] at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:612) [ERROR][AndroidRuntime( 297)] at ti.modules.titanium.ui.TiUIActivityWindow.windowCreated(TiUIActivityWindow.java:142) [ERROR][AndroidRuntime( 297)] at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:31) [ERROR][AndroidRuntime( 297)] at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:361) [ERROR][AndroidRuntime( 297)] at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:434) [ERROR][AndroidRuntime( 297)] at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:22) [ERROR][AndroidRuntime( 297)] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) [ERROR][AndroidRuntime( 297)] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) [ERROR][AndroidRuntime( 297)] ... 11 more

This is my code:

var url="http://diarioelguardian.com.mx/feed/";
var WindowWidth = Ti.Platform.displayCaps.platformWidth; 
var WindowHeight = Ti.Platform.displayCaps.platformHeight;
var xhr = Titanium.Network.createHTTPClient();
xhr.open('GET',url);
var data = [];
var WindowWidth = Ti.Platform.displayCaps.platformWidth;
Titanium.UI.setBackgroundColor('#000');
 
 
var tabGroup = Titanium.UI.createTabGroup();
 
var rssWindow = Titanium.UI.createWindow({  
    title:'',
    backgroundColor:'#fff'
});
var rssTab = Titanium.UI.createTab({  
    icon:'KS_nav_views.png',
    title:'Rss Feed',
    window:rssWindow
});
 
tabGroup.addTab(rssTab);  
 
tabGroup.open();
 
xhr.onload = function() {
    //Ti.API.info(this.responseText);
    var xml = this.responseXML;
    var channel = xml.documentElement.getElementsByTagName("channel");
    var title = channel.item(0).getElementsByTagName("title").item(0).text;
    rssWindow.title = title;
    var items = xml.documentElement.getElementsByTagName("item");
    for (var i=0;i<items.length;i++) {
        var this_post_title = items.item(i).getElementsByTagName("title").item(0).text;
        var post_link = items.item(i).getElementsByTagName("link").item(0).text;
        var row = Ti.UI.createTableViewRow({height:'auto',width:WindowWidth,top:0,hasChild: true});
        var post_title = Ti.UI.createLabel({
            text: this_post_title,
            textAlign:'left',
            left:0,
            height:40,
            width:'auto',
            top:3,
            color: 'black'
        }); 
        row.add(post_title);
        row.link = post_link;
        data.push(row);         
    }
    var tv = Titanium.UI.createTableView({
        data:data,
        top:0,
        width:WindowWidth,
        height:WindowHeight
    });
    rssWindow.add(tv);
    tv.addEventListener('click',function(e) {
        var webwin = Titanium.UI.createWindow({
            url: 'showweb.js',
            backgroundColor: '#fff',
            myurl: e.rowData.link
        });
        rssTab.open(webwin);
    });
};
 
xhr.send();

— asked 9 months ago by israel vazquez
1 Comment
  • Missing from your question are a number of important pieces of information. I suggest you take a look at the Using Questions and Answers article, specifically the Q&A Question Checklist. The missing information is critical to reproducing problems in a test environment and often indicates other factors that cause the undesirable outcome you are experiencing.

    — commented 9 months ago by Stephen Feather

2 Answers

since the error seems to occur after the click event is fired, don't you think maybe you sould show us the code in showweb.js??

On first look seems to possibly be a problem with your url.

— answered 9 months ago by Stephen Feather
answer permalink
5 Comments
  • Sorry i forgot about that... this is what i have on showweb.js

    var win = Ti.UI.currentWindow;
    var webview = Titanium.UI.createWebView({url:win.myurl});
    win.add(webview);

    — commented 9 months ago by israel vazquez

  • I just figure out that i didnt put a link on myurl but now the problem is that it shows the content but in HTML for example a Paragraph it shows the <p> tag like this <p> This is a text </p>

    — commented 9 months ago by israel vazquez

  • example url please?

    — commented 9 months ago by Stephen Feather

  • Show 2 more comments

What emulator are you using? 2.3 has a bug in the webview and crashes. Is the emulator's bug, not Titanium's. Try to use a different version of android in your emulator.

Your Answer

Think you can help? Login to answer this question!