使用eclipse编程android时,无论你是使用模拟器还是在调试模式下连接的设备,你都可以轻松地查看Log以查看你编写的自定义消息.
e.g.: Log.i("foo: " + foo);
Run Code Online (Sandbox Code Playgroud)
用方法:
Titanium.API.info("foo: " + foo);
Run Code Online (Sandbox Code Playgroud)
如果我使用模拟器它一切正常,但如果我在设备上部署有一种方式来看INFO?使用TiStudio甚至TiDev
谢谢
设置好内容后如何获得标签的宽度?没有设置初始宽度.
我在表格行中有两个标签,如下所示:
label 1 (label 2)
Run Code Online (Sandbox Code Playgroud)
这里的宽度label 1最初没有设置.随着内容label 1宽度的变化有变化,有时会导致重叠label 2.
现在我的主要目标是label 2动态地设置左边,它不会过度使用label 1.我想这样做如下:
label 1label 2 = width of label 1 + 10如果有任何其他方式请帮助.
这里有一些代码
var win = Titanium.UI.createWindow({
title: 'Cleos',
backgroundImage: 'tablebg.png',
navBarHidden: true,
});
var tableview = Titanium.UI.createTableView({
backgroundColor: 'transparent',
separatorStyle: Ti.UI.iPhone.TableViewSeparatorStyle.NONE,
style: Titanium.UI.iPhone.TableViewStyle.PLAIN
});
win.add(tableview);
var modelData = new Array;
for (i = 0; i <= daga.length - 1; i++) { // `data` as …Run Code Online (Sandbox Code Playgroud) 我想使用Titanium Appcelerator Mobile SDK解析以下JSON
[{"City":null,"Distance":469,"Email":null,"Latitude":0,"Longitude":0,"Name":"Cretin-Derham Hall","PhoneNo":null,"SchoolId":75,"State":null,"Zip":null},{"City":null,"Distance":213,"Email":null,"Latitude":0,"Longitude":0,"Name":"East Ridge","PhoneNo":null,"SchoolId":76,"State":null,"Zip":null},{"City":null,"Distance":26,"Email":null,"Latitude":0,"Longitude":0,"Name":"Hastings","PhoneNo":null,"SchoolId":78,"State":null,"Zip":null},{"City":null,"Distance":116,"Email":null,"Latitude":0,"Longitude":0,"Name":"Stillwater","PhoneNo":null,"SchoolId":81,"State":null,"Zip":null},{"City":null,"Distance":0,"Email":null,"Latitude":0,"Longitude":0,"Name":"White Bear Lake","PhoneNo":null,"SchoolId":82,"State":null,"Zip":null}]
Run Code Online (Sandbox Code Playgroud)
我想解析这个并将所有"Name"值放在TableView/ListView中.谁能帮我 ?
这是我目前的代码:
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function()
{
Ti.API.info('in utf-8 onload for GET');
var schools = eval('(' + this.responseText +')');
};
Run Code Online (Sandbox Code Playgroud)
提前致谢
我被这个问题困住了,我正在调用一个返回 json 响应的 webService。
现在我想从那个响应中获取一个特定的值,但是在互联网上搜索并挣扎了很多之后无法修复它。
这是我的代码:
var xhr = Titanium.Network.createHTTPClient({
onload : function(e) {
Ti.API.info("Received text: " + this.responseText);
alert('success');
},
// function called when an error occurs, including a timeout
onerror : function(e) {
Ti.API.debug(e.error);
alert('error');
},
timeout : 5000
});
var data = {"data":"system.connect"};
xhr.open("POST","http://mytesturl.net/services/json");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
xhr.send("method=system.connect");
Run Code Online (Sandbox Code Playgroud)
响应是这样的:
{"#error":false,"#data":{"sessid":"c4likn6vg33hngbpmobisrsbpcjjmf39","user":{"uid":0,"hostname":"102.119.85.120","roles":{"1":"anonymous user"},"session":"","cache":0}},"#response_code":200}
Run Code Online (Sandbox Code Playgroud)
从上面的响应中我想获取sessid值。什么是正确的方法?
我试图解析已存储在applicationDataDirectory中的本地JSON文件.我只需要从这个文件中获取项目.运行钛的V.2
JSON数据结构如下所示
{
"object_name": [
{
"title": "Burrton",
"value": "Burrton",
"homeof": "Chargers",
"logo": "images/logos/BURRTON.jpg",
"colors": "#cccccc;#a9a9a9",
"links": {
"tsr": "http://www.schurzdigital.com/mfeeds/CollectionFeed.php?site=http%3A%2F%2Fwww.catchitkansas.com&collection=cik_burrton_headlines&title=cik_burrton_headlines&limit=25",
"sports": "www.schurzdigital.com/mfeeds/CollectionFeed.php?site=http%3A%2F%2Fwww.catchitkansas.com&collection=cik_burden_headlines&title=cik_burden_headlines&limit=25",
"videos": "http://www.schurzdigital.com/mfeeds/TividFeedConvert.php?site=http%3A%2F%2Fwww.catchitkansas.com&slug=e9c0b075-3230-4a45-803e-7ccb4b7f754e&title=Top%20videos&limit=25",
"photos": "http://serve.a-feed.com/service/getFeed.kickAction?feedId=1014509&as=8768",
"stats": {
"boys": {
"football": "http://stats.catchitkansas.com/report_fb-schedule_results.php?sport=15&team=763",
"basketball": "http://stats.catchitkansas.com/report_baskb-schedule_results.php?sport=26&team=2946",
"cross country": "http://stats.catchitkansas.com/report_cc-schedule_results.php?sport=13&team=764",
"golf": "http://stats.catchitkansas.com/report_golf-schedule_results.php?sport=16&team=767",
"track": "http://stats.catchitkansas.com/report_trackfield-schedule_results.php?sport=32&team=2948"
},
"girls": {
"volleyball": "http://stats.catchitkansas.com/report_vb-schedule_results.php?sport=22&team=766",
"basketball": "http://stats.catchitkansas.com/report_baskb-schedule_results.php?sport=27&team=2947",
"cross country": "http://stats.catchitkansas.com/report_cc-schedule_results.php?sport=13&team=764",
"golf": "http://stats.catchitkansas.com/report_golf-schedule_results.php?sport=17&team=768",
"track": "http://stats.catchitkansas.com/report_trackfield-schedule_results.php?sport=32&team=2948"
}
}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
我使用的代码来解析文件.
var fileName = 'school_select.json';
var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, fileName);
if (file.exists()) {
var json = file.read();
var jsonObject …Run Code Online (Sandbox Code Playgroud) 当我使用时,我有一个简单的问题
var phone_number='12346789';
Titanium.Platform.openURL('tel:'+phone_number);
it goes to dial pad in android i want it to directly dial the call without prompting the user to press the call button.
Run Code Online (Sandbox Code Playgroud)
我在AndroidManifest.xml中添加了权限
<uses-permission android:name="android.permission.CALL_PHONE" />
Run Code Online (Sandbox Code Playgroud)
但它还没有工作仍然要求用户按下通话按钮.任何人都有这个想法请帮助.
阿里.
我从github下载了钛移动sdk的源代码.我在windows 7中安装了python,scons,jdk和android sdk.我在环境变量中为java,android sdk等设置了路径.但在使用scons进行编译时,会出现以下错误.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Shihab>cd C:\Project\titanium_mobile
C:\Project\titanium_mobile>scons
scons: Reading SConscript files ...
Building MobileSDK version 3.1.0, githash 2d79a72
KeyError: 14:
File "C:\Project\titanium_mobile\SConstruct", line 115:
sdk = AndroidSDK(ARGUMENTS.get("android_sdk", None), 14)
File "C:\Project\titanium_mobile\support\android\androidsdk.py", line 49:
self.set_api_level(api_level)
File "C:\Project\titanium_mobile\support\android\androidsdk.py", line 53:
self.find_platform_dir()
File "C:\Project\titanium_mobile\support\android\androidsdk.py", line 127:
old_style_dir = os.path.join(self.android_sdk, 'platforms', android_api_leve
ls[api_level])
C:\Project\titanium_mobile>
Run Code Online (Sandbox Code Playgroud)
如何解决此错误?
这更像是一个建议问题而不是一个具体问题.我正在开发移动设备的应用程序.它的基本功能是打开PDF文件,视频文件,以及打开某些网页.这最好在PhoneGap或Appcelerator中实现吗?
所以我有2个应用程序.一个是传感器应用程序(使用XCode构建),使用硬件无线传感器记录数据(文本).另一个是清单/参考手册(使用Titaniam Appcelerator构建).使用自定义URL方案,他们可以相互实例化.
我要做的是将传感器应用程序复制到剪贴板的任何文本数据粘贴到参考手册应用程序中的文本字段中.我有一个UIWebview显示html页面(清单),现在显示一个文本框.要演示此功能,我必须触摸该字段并选择粘贴.我当时认为javascript可能有用,但我所有的研究poo poo都是这个想法.有关如何获取剪贴板上的文本并在参考手册应用程序中以编程方式显示它而不必触摸该字段并选择粘贴的任何想法?
我是否应该查看剪贴板,还是应该考虑修改自定义URL方案以便以这种方式传递数据?
我发布以下示例代码请任何帮助我
var bb_CoverPageImage = Ti.UI.createImageView({
width : '100%',
image : '',
categoryName : magazinePagesList[i].categoryName,
lengthId : magazinePagesList.length,
});
bb_CoverPageImage.image = L('Site_URL_Images') + magazinePagesList[i].imagePreviewUrl.replace(/\s/g, '%20');
coverScrollView.add(bb_CoverPageImage);
Run Code Online (Sandbox Code Playgroud)