Community Questions & Answers
Break in string from xml?
Hey, i am pulling some text stuff from xml (localization) everything works fine - except the breaks :/ In my XML strings there is (for example) <string name="hello_world_text">Hello \n World</string> If i write this stuff...
Custom Object Array converting to String
In My Apps on Appcelerator portal of ACS, I created a Custom Object, with properties, the value of the property is something like: `[ { 'name': 'somename', 'perc': 60 }, { 'name': 'othername', 'perc': 35 } ]` When I save the object, it converts the JSON...
How to dynamically change the referenced item.
I am using Titanium Alloy 3.0.2. I've named some buttons btn1, btn2, btn3, etc. I'd like to reference them in a loop and set some properties. I could reference each one of them like this $.btn1, but I'm certain there is some way I could reference them...
Parsing JSON string from module event
Hello, I am using Titanium SDK 3.0.2.GA and Android 4.0.3 and am having an issue parsing a JSON string that is being passed from a module. If I test parting within titanium, it works perfectly fine with the example below: ~~~ var sampleJSON =...
String matching in ACS
Hi Community, Is there a way of string pattern matching in ACS, e.g ~~~ SELECT * FROM suppliers WHERE supplier_name like '%bob%'; ~~~ In the example above , the query is looking for all suppliers whose name contains the characters 'bob'.
What is the best practice in using "Strings" in our Project
In my project i have bunch of strings for error message , alert messages and other info. Can i keep all these strings in i18n\en\String.xml or it should be in some JS file (Constant.JS) file? Note: I'm developing app for English language only What is...
Validate string for date format
I have a string that I need to validate for a valid date format. How do I do that? I cannot use a datepicker in my application because it just looks ugly. So, I have three text fields that allow numbers only and now want to combine their content to form...
Android HttpRequest returning Blob when expecting string
I have an app which has been running successfully under iOS for some time. Included in that app are a number of HTTPClient requests (GET and POST) that handle interactions with the server. The first of these (A GET) requests data from the server. We can...
String replace function
when I call text.replace('a','c'); I saw that the replace function replace subStr ('a') just in the first time... How can I replace all the subStr that founds in the String text ? like : text = 'blabla bla' the result will be : 'blcblc blc' Thanx for...
Problem with display RSS data from blog rss feed
Ok I have few problems for RSS reading. I have managed to get the data from the blog. But it contains a lot of format text that I don't want to display but when i retrieve the data, it comes together with the text. The url i use is...
Display string as image
I queried an sqlite DB for an image type. I converted that BOLB to a string as I am passing back a JSON object from a web service. I verified that the string matches the contents of the sql image type field in the database. My problem now is that I have...
XML parse string error for iOS
I am working on caching the xml files to make my app accessible offline. On the homepage of my app, I called all the xml files that my app uses. And this is how I am parsing my xml file. But it's giving me error. Here is my code: ~~~ var data =...
String.formatDecimal usage
Hi, I'm trying to determine what I can use for the pattern format string with the String.formatDecimal extension: ~~~ formatDecimal( Number value, [String locale], [String pattern] ) : String ~~~ I've found that '0.000' and '0E00' are valid so far. Can...
How to identify string in textfield
Hi Everyone, I have a very simple question. I just want to check that email entered in a text field is valid or not. Like, I can check wether it contains "@" and ".com" to ensure for valid email. How would I do that?? Thanks in Advance
Compare string or search a char in a string
i scan a barcode then i want to specifiy, its a number , text or a website adress and if this is a website for example i want to open a webview or safari. Can ? achieve this?? Can i compare string and a char ?? sorry for my english..
HttpClient response mechanics
Total noob to this so that's why i'm asking so stupidly. I also asked a quite similar thing here but nobody answered... I just want to send a string from the server to the app as a response when i upload a file to the server. Is this supposed to work...
How to remove the spaces from both sides of a string
Hi, I have to enter a name in a textField which can contain one blank space only between the words and it can contain any character, if the user enter any spaces at the beginning or end of the string, it should be automatically removed(just like Trim...
Admob 2.0.1 & Android - Age old "String" error!
Hi all, I'm using: Admob 2.0.1 Titanium SDK 2.1.4GA V8 Runtime Titanium Studio build: 2.1.2.201208301612 Build: jenkins-titanium-rcp-master-232 (origin/master) Date: 30 August 2012, 16:14:46 I'm trying to compile under Android Google APIs but it...
Measurong length of array not chracters
Hi I have one problem regarding the length function.The problem is that when more than one entries come in the variable it calculates the length perfectly but for one entry it starts to measure the number of characters instead of length array.I want...
Converting a line of String to an Int
Hi all, I want to know if it is possible to convert a line of string to an Int for example I,m reading from a Json file and it returns the Name and Nickname of a specific selected fighter but i want to count the amount of Nicknames the fighter has to use...
URL's in strings possible?
Is it possible to use URL's in strings? At the moment I get "Null" if i try it. Is there any way to fix this? ~~~ if(Ti.Platform.name!='android') { var contentURL = L('android_q1'); win.add(activeMovie); } else { var contentURL =...
javascript
Hi, I am looking for a function which gives the width in pixels of a word ? does anyone know that function ? thanks
how to show 'https://graph.facebook.com/'+Ti.Facebook.uid+'/name' as a string
hi guys how to show a url ==> 'https://graph.facebook.com/'+Ti.Facebook.uid+'/name', as a string (so the username from the person who has logged in with FB) same idea as showing a picture ==> var profileView =...
string functions titanium mobile
hi, in my android app i need to obtain a char code of the specified letter and to obtain the letter at the specified char code, i tried asc and char like in javascript but with no success, can you help me?thanks
How to apply font size in strings.xml
Titanium mobile sdk 2.1 iphone sdk 5.1 Hi, is there a way to change part of the string's font size from the string.xml? I tried this but didn't work: ~~~ <string name="intro">Welcome <font...
Reading raw data from Blob
Hi, for sending a photo via multipart upload I need the content of an image as string. This I tried: ~~~ var stream = Ti.Stream.createStream({ source : image, // from camera role mode : Ti.Stream.MODE_READ }); var buffer =...
make a call on android
hi, i use this code to call on android : ~~~ var intent = Ti.Android.createIntent({ action: Ti.Android.ACTION_CALL, data: call }); Ti.Android.currentActivity.startActivity(intent); ~~~ 'call' is a string which contains : call = 'tel:' + passerelle...
call on android
hi, i use this code to call on android : ~~~ var intent = Ti.Android.createIntent({ action: Ti.Android.ACTION_CALL, data: call }); Ti.Android.currentActivity.startActivity(intent); ~~~ call is a string which contains : call = 'tel:' + passerelle + ','...
add # to phone number when calling on android
hi, i have this code : ~~~ if(codeConfidentiel == null || codeConfidentiel == ''){ Ti.Platform.openURL('tel:' + passerelle + ',' + number + '#'); } else{ Ti.Platform.openURL('tel:' + passerelle + ',' + codeConfidentiel + '#,' + number +...
tel on android
hi, i have this code : ~~~ if(codeConfidentiel == null || codeConfidentiel == ''){ Ti.Platform.openURL('tel:' + passerelle + ',' + number + '#'); } else{ Ti.Platform.openURL('tel:' + passerelle + ',' + codeConfidentiel + '#,' + number +...
Parsing an array into a variable
Hello guys, I've got a list of names that are returned from a database, and pushed to a TableView. I would like to grab them again (using the 'babyname' variable) and pop them into a single variable so I can write out my list so it can be emailed. It...
Javascript String.replace() not working
Hi, I can't figure out why this isn't working for me in Titanium! I have a string with some characters that I want to remove however when I use the javascript 'replace()' function nothing happens! Here is my code ~~~ var myString =...
Send 'ESC' character to function (printer)
Hi, i need to send a character ESC to a string to change some properties for a printer. The data for the printer is a string variable and i need to include a 'ESC'character with a 'k2' parameter. How i can to do this?.
How to style individual characters in a label?
I have a label who has a text value. I want to make a portion of that string bold. How can I do this?
Sending ASCII (CP437) characters to a printer with appcelerator
Hello all, I am attempting to write special characters to a TCP socket. The input data comes from a UTF8 encoded .json file, and is read and operated on by appcelerator as UTF8. I am building a lengthy string containing both ASCII data as well as command...
RegExp / String Replace
hello there,,i have a problem about String Replace,,for example i have this code : ~~~ var pattern = new RegExp('°',''); var deskripsiSiangClean = cuaca[0].fcttext.replace(pattern , '\u00B0'); deskripsiSiang = deskripsiSiangClean; ~~~ Text...
Number formatting in a String zeros in front.
I am trying to format a number to show in a string as such: 000001, 012345, 000123. Kind of a serialized way of displaying numbers. Does anyone know how I would go about to do this?
String to Int? Am I crazy?
I'm trying to do what I feel should be exceptionally easy, and I don't know if I am just hitting a mental roadblock or what. I've searched all over Google and tried looking through some similar Q&A questions but nothing was specifically what I'm having...
How to get Base64Decode as a string?
For our app, we are needing to Base64 encode/decode but as we are not doing it on images we need to keep it as a string. While we can get our own external library to do it, I happily noticed Titanium already had this support. Then we found decoding...
Titanium.App.Properties.setString(); can we pass first parameter as string variable?
Hi Can we pass the first parameter of the Titanium.App.Properties.setString(); as a variable? like `Titanium.App.Properties.setString(myVariable, "My data"); Thanks
Can't run the .replace() function on base64 string. What gives?
I have a large base64 encoded string. It does a line break every 72 characters. I can\\\'t send this string, with the line breaks, as POST data in an XHR post. So I tried to do a .replace() and remove the line breaks like...
How to parse a XML String and get only one value
In fact i succeed to get this XML String :...
Get date and time from picker then save to DB as TEXT?
Hi Guys. Im using a Date & Time picker to allow the user to set a date and time. This works fine. Im then using this code to pop the date and time into a text box ~~~ picker.addEventListener('change',function(x) { datetime.value =...
String functions in Android
Hi, I am using SDK 1.4.2 on a Mac, whenever I use any string function in the Android emulator, I get errors like the simple code snippet below: ~~~ var str="Split Into An Array"; str.split(); ~~~ Results in an error dialog in the Android emulator...
How to display date according to keyboard/localization
Hi! I have a date formatted like "Thu, 14 Apr 2011 11:00:00 +0200" which is read via xml. How can I get it formatted using the localization setting? fx "4/14/2011" in England, and "14-4-2011" in Sweden. Or, must I create...
How do I read characters from the blob returned by getFile on a UTF8 text file?
I've been struggling with this for 4 days now. I'm new to Appcelerator, but pretty good with Java and other languages. I'm trying to read a text file in a mobile, Android app, but cannot find any way to slice the resulting string when I use the .text...
how to get string from TiBlob, not using .text, to pass camera image to web service
I see numerous people asking how to convert a TiBlob to a string but the usual answer is to use .text which doesn't work for iPhone images. I am using the Titanium.Media.ShowCamera on the iPhone and I have the image (event.media) which is a TiBlob object....
Add ' to sql string for replication
I'm adding web-syncing functionality to my iPad app, and what Ive decided is to basically whenever I run a SQL command on the website or app, save that sql (along with a timestamp so I run it in order) and handle it from there. On the app side, I'm having...
Not understanding the formatDate and formatTime
Can someone give more detail on the formatDate and format Time functions? I'm new to this and I'm just don't get it. I do the following: ~~~ var foo = Date(); var foo2 = foo; Ti.API.info('Orriginal Date: ' + foo); foo = String.formatDate(foo); foo2 =...
Get XML node content as html
This probably such a newbie question but I'm stuck at parsing an RSS feed. I've created an index of stories from an RSS feed whose structure is such that each story's full html content is contained within the description tag. ~~~ ... <item> ...
Showing 1-50 of 64 1 2