WebView not working on Android

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

Hi am making an RSS Feed reader and everything looks good, the app loads the feeds but when i click on one of them it shows the content with HTML tags, for example a bold text it shows it like this: <b> Text </b>

This is my code:

var url="http://arturodiaz.net/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:"http://arturodiaz.net/feed/"
        });
        rssTab.open(webwin);
    });
};
 
xhr.send();

showweb.js

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

— asked 10 months ago by israel vazquez
2 Comments
  • I haven't had any issues like this with webviews on Android. What's the URL that you're trying to load?

    — commented 10 months ago by Shannon Hicks

  • url is the property of the webview,it basically represent the url value that you want to show on your webview,For more information,Please go through the appcelerator documentaton.

    Thanks.

    — commented 10 months ago by pankaj Goyal

Your Answer

Think you can help? Login to answer this question!