titanium

Want to produce random numbers between 1-45 without repetition

给你一囗甜甜゛ 提交于 2019-12-02 13:34:21
I have come across a very strange problem. I have tried to find its solution but in vain. My problem is that I want to create a random number between 1-45 and I don't want that number to repeat again. Random selection, by definition, will repeat randomly. However, you can build an array containing each of your numbers and then shuffle the array, producing a random order of numbers without repetition. var nums = [], i; for( i=1; i<=45; i++) nums.push(i); nums.sort(function(a,b) {return Math.random()-0.5;}); alert(nums.join(",")); This is Working code.. Random rd =new Random(); int n = rd.Next(1

changing Android picker font color on titanium appcelerator

佐手、 提交于 2019-12-02 12:57:20
I am using a picker on my application of type time picker. The picker works fine on iOS devices, however when I go to the android application, it appears, but the font color is white, and cant see the numbers. I do not want to change the background to a darker color because it doesnt match the rest of the application and wont be matching the ios app. I was wondering if there is a way to change just the font to black or gray color. I have already tried some of the solutions posted, and changing the themes, but it has not worked out for me. You need to create custom theme <resources> <style name

Fetching data from JSON.parse array

我与影子孤独终老i 提交于 2019-12-02 11:31:30
问题 I am stuck in this problem, I am calling a webService that returns me a json response. now i want to fetch a particular value from that response but after searching on internet and struggling a lot couldn't fix it. here is my code: 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');

appcelerator titanium - hide navigation bar android

久未见 提交于 2019-12-02 11:23:07
Is it possible to hide permanently the Android bottom navigation in Appcelerator Titanium? Many questions about this subject but no fine solutions. <fullscreen> true </fullscreen> in tiapp doesn't work with titanium 5.5.1 $.index.addEventListener('open', function(e) { $.index.activity.actionBar.hide();}); doesn't work. 'Window':{navBarHidden:true,tabBarHidden:true,fullscreen:true} in tss doesn't work etc. Thank you. Ricardo Pereira This method always worked for me, set the app to fullscreen without nav bar and tab bar. Assuming your main Window's id is not set or is set to 'index', only this

iOS LocationManager is not updating location (Titanium Appcelerator module)

蓝咒 提交于 2019-12-02 10:28:41
I've made Appcelerator Titanium Module for fetching device's rotaion and location. Source can be found on GitHub . The problem is that it fetches only one cached location but device motion data is OK and it is refreshing. I don't use delegate, I pull that data in my Titanium Javascript Code. If I set "City Run" in Simulator -> Debug -> Location nothing happens. The same cached location is returning. Pulling of location is OK because I tried with native app wich does this: textView.text = [NSString stringWithFormat:@"%f %f\n%@", locationManager.location.coordinate.longitude, locationManager

Appcelerator Could not find method android.app.Activity.checkSelfPermission

℡╲_俬逩灬. 提交于 2019-12-02 10:12:40
I cant seem to get geo location to work on Android just seem to get the following bug. [INFO] : dalvikvm: Could not find method android.app.Activity.checkSelfPermission, referenced from method ti.modules.titanium.geolocation.GeolocationModule.hasLocationPermissions [WARN] : dalvikvm: VFY: unable to resolve virtual method 32: Landroid/app/Activity;.checkSelfPermission (Ljava/lang/String;)I [INFO] : dalvikvm: Could not find method android.app.Activity.requestPermissions, referenced from method ti.modules.titanium.geolocation.GeolocationModule.requestLocationPermissions [WARN] : dalvikvm: VFY:

Is a TiTouchImageView working in an alloy project? [UPDATE]

允我心安 提交于 2019-12-02 08:42:45
I am currently developing a titanium app for android and iOs including an imageView which should be scrollable and scalable (via a slider). I already get this to work on iOs but on Android it is really hard to achieve the scrolling behaviour. I decided to use the TiTouchImageView module but the documentation only shows how to use it in a non-Alloy project. My current code looks like this: if (Ti.Platform.osname == "android") { var TiTouchImageView = require('org.iotashan.TiTouchImageView'); var androidImageView = TiTouchImageView.createView({ top: 0, left: 0, zoom: originalScaleValue, maxZoom:

Titanium ImageView wont display images?

无人久伴 提交于 2019-12-02 08:12:42
I created an image directory in my projects in the UI folder to place my images. So the full path is currently Resources/UI/Images. When i create an image view it wont display the images. I tried different options, even a web image but nothing works? var self = Ti.UI.createView({ backgroundColor:'white' }); var imgv = Titanium.UI.createImageView({url:"http://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Volkswagen_Logo.png/600px-Volkswagen_Logo.png"}); self.add(imgv); var imgv = Titanium.UI.createImageView({url:"../images/sb02.jpg"}); self.add(imgv); var imgv = Titanium.UI.createImageView(

Fetching data from JSON.parse array

一笑奈何 提交于 2019-12-02 05:05:07
I am stuck in this problem, I am calling a webService that returns me a json response. now i want to fetch a particular value from that response but after searching on internet and struggling a lot couldn't fix it. here is my code: 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

Appcelerator and CommonJS modules (caching and circular references)

﹥>﹥吖頭↗ 提交于 2019-12-01 18:59:52
问题 Here's the thing: I'm using the CommonJS way of making my mobile (iPhone/Android) application modular. No surprise there. But there's one thing that I just can't get my head around. CommonJS lets me create STATIC private variables, which lets me create singletons at ease. This, I think at least, is because the contents of a file that gets require() d is read only once and then the exports object (which is initialized only once) is returned every time. But when I create a circular reference as