Tag Archives: string

7,796 views

Locale location Java Android example

Locale lc = Locale.getDefault(); // default now locale on device String sCountry = lc.getCountry(); // CZ   lc = new Locale("fr","FR"); //FRANCE .. Locale(language, country); String sCountry2 = lc.getDisplayCountry(); // Francie   Locale locale = Locale.GERMAN; String sCountry3 = locale.getDisplayCountry(); … Continue reading

Posted in Android Examples Code | Tagged , , | Comments Off on Locale location Java Android example
29,435 views

Formatting a Number to String NumberFormat DecimalFormat locale Java Android example code

NumberFormat, DecimalFormat, format(), locale format Java Androidexample source code NumberFormat numberFormat = new DecimalFormat("##"); String str = numberFormat.format(-01234.567); // -1235 System.out.print(str + "\n");   str = numberFormat.format(00); // 0 System.out.print(str + "\n");   numberFormat = new DecimalFormat("##00"); str = numberFormat.format(0); … Continue reading

Posted in Android Examples Code | Tagged , , , , , | Comments Off on Formatting a Number to String NumberFormat DecimalFormat locale Java Android example code
3,236 views

Titlebar title bar change text setTile Android example

Change the title associated with this activity. If this is a top-level activity, the title for its window will change. If it is an embedded activity, the parent can do whatever it wants with it.   String sTitle = "My … Continue reading

Posted in Android Examples Code | Tagged , , , , | Comments Off on Titlebar title bar change text setTile Android example
62,466 views

Get Assets folder path and read txt file to string Android example code

Programmatically load text from Asset folder file myData.txt to string Android example source code. Read file to byte[] buffer and convert into string Android example. Assets folder path may be: c:\documents\_android_projects\MyProject\assets // Path for a WebView String sAssets = "file:///android_asset/" … Continue reading

Posted in Android Examples Code | Tagged , , , , , , | Comments Off on Get Assets folder path and read txt file to string Android example code
8,614 views

Create array of strings in xml file Android example

Example source code for Android developers how create array of strings in *.xml file. You can using array of strings in Spinner ( combobox – dropdown list ) or ListView etc. <resources> <string-array name="colors"> <item>red</item> <item>orange</item> <item>yellow</item> <item>green</item> <item>blue</item> </string-array> … Continue reading

Posted in Android Examples Code, Array,List,Collections | Tagged , , , | Comments Off on Create array of strings in xml file Android example
7,818 views

string in java example

string in java example of use String str = "abc"; char [] chArray ={’a’,’b’,’c’}; String str2 = new String(chArray); // "abc"   String str3 = "Get index of"; // Returns the index within this string of // the first occurrence … Continue reading

Posted in Android Examples Code | Tagged , , | Comments Off on string in java example