Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

How to get tableview row data when being clicked for Android?

$
0
0

As shown in the following code, I am trying to use the data of a tableview when a row in the tableview is clicked. It will open a new page and display the corresponding data contained in the row. Like a contact book.

When running in iOS Simulator, the d works well and I can get the string. However, when running in Android Emulator, the d turns out to be undefined when I print it by Ti.API.info. In both case the t works well.

Could anyone show me how I can fix the problem with Android? Thanks!

var tableview = Titanium.UI.createTableView({
    data : data,
});
tableview.addEventListener('click', function(e) {
    if (e.row.title) {
        var t = e.row.title;
        var d = e.row.detail;
    }
});
data is parsed from a JSON like this:
[
    { "title": "my name", "detail": "my detail"},
]

Viewing all articles
Browse latest Browse all 7655

Trending Articles



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