Tag Archives: string

3,681 views

How to set different locales in android

– create new folder with values in resources folder in project with extension your language code For example: My language is Czech (cs) I have to create the folder values-cs in res folder // for locale English is default /MyProject/res/values … Continue reading

Posted in Android Examples Code | Tagged , | Comments Off on How to set different locales in android
4,125 views

xml string with html tags Android

// in strings.xml <string name="myStringWithTags"><![CDATA[<b>some text..</b> other tags …]]></string> <string name="myStringWithPattern"><![CDATA[<b>%s</b> other tags …]]></string> // in Activity.class String sHtmlText = this.getApplicationContext().getString(R.string.myStringTags); sHtmlText = this.getApplicationContext().getString(R.string.myStringWithPattern,"replace %s with this text");

Posted in Android Examples Code | Tagged , , , | Comments Off on xml string with html tags Android
4,092 views

toLowerCase Locale toUperCase Locale Java Android

String s = "AbcČ"; String s2 = s.toLowerCase(new Locale("cs_CZ")); // Czech Republic String s3 = s.toLowerCase(new Locale("de_DE")); // Germany   // en_US en_GB ar_EG be_BY bg_BG ca_ES cs_CZ da_DK de_DE

Posted in Android Examples Code | Tagged , | Comments Off on toLowerCase Locale toUperCase Locale Java Android
3,958 views

R.string to string R.array to array Android

R.string to string Android source code R.array to string [] Android source code String s = getResources().getString(R.string.my_string); // Hello world!! String[] arrayOfStrings = getResources().getStringArray(R.array.my_array); // one, two <xml version="1.0" encoding="utf-8"> <resources> <string-array name="my_array"> <item>one</item> <item>two</item> </string-array> <string name="my_string">Hello world!!</string> </resources>

Posted in Android Examples Code, Array,List,Collections | Tagged , | Comments Off on R.string to string R.array to array Android
12,623 views

Append text and ad text to TextView Android example

String s = "Some text for appending\n"; TextView mTitle = (TextView) findViewById(R.id.title_text); mTitle.setText(R.string.app_name); // insert text from strings.xml mTitle.append(s); // append string like a variable value mTitle.append("My string will appended\n"); // append string You can insert this source code into … Continue reading

Posted in Android Examples Code | Tagged , , , | Comments Off on Append text and ad text to TextView Android example
6,774 views

Array copy to Array Java Android example

String[] source = {"Hello","world","by","Android"};   String[] destination = new String[source.length];   System.arraycopy(source, 0, destination, 0, source.length);

Posted in Android Examples Code | Tagged , , , | Comments Off on Array copy to Array Java Android example
6,440 views

Resource int R.string.app_name to String Android example

R.string.app_name to String example. MyActivity.java Resources res = getResources(); String sText = res.getString(R.string.app_name); res/values/string.xml   <resources> <string name="app_name">My app name</string> </resources>

Posted in Android Examples Code | Tagged , | Comments Off on Resource int R.string.app_name to String Android example
5,935 views

List LinkedList add sort find Item in Java example

List LinkedList Collections add sort find search Item, get searched item to string in Java example. MainClass.java import java.util.Collections; import java.util.LinkedList; import java.util.List;   public class MainClass { public static void main(String[] arg) { String[] arrayOfString = {"nothing", "Hello", "people" … Continue reading

Posted in Android Examples Code, Array,List,Collections | Tagged , , , , , , | Comments Off on List LinkedList add sort find Item in Java example
2,344 views

While cycle loop in Java example

While cycle Java basic example with array of strings. MainClass.java public class MainClass { public static void main(String[] arg) { String[] arrayOfString = { "Hello", "people", "hello", "world!" }; int i = 0; while ( i < arrayOfString.length ){ System.out.println(arrayOfString[i]); … Continue reading

Posted in Android Examples Code | Tagged , , , , , | Comments Off on While cycle loop in Java example
3,884 views

For cycle loop in Java example

Cycle for in Java example public class MainClass { public static void main(String[] arg) { String[] arrayOfString = { "Hello", "people", "hello", "world!" };   for (int i = 0; // start position , first cycle i == 0 i … Continue reading

Posted in Android Examples Code | Tagged , , , , , , , | Comments Off on For cycle loop in Java example