Okhelp.cz

Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

Map TreeMap key value pair add put get pair by key Java Android example

Map TreeMap add key value pair get find pair by key Java Android example.

MainClass.java

import java.util.Map;
import java.util.TreeMap;

public class MainClass {
	public static void main(String[] arg) {
		
		// english;germany dictionary
		String[] arrayOfString = { "one;eine", "two;zwei", "three;drei" };

		Map<String, String> map = new TreeMap<String, String>();
	    
		for(String s: arrayOfString){
	    	String[] array = s.split(";");
	    	String sKey ="", sValue="";
	    	if(array.length > 1){
	    	sKey = array[0]; sValue = array[1];
	    		map.put(sKey, sValue);
	    	}
	    }

       // check if key exists 	    
	   if( map.containsKey("two")){
		System.out.print("two = " + map.get("two"));
	   }
	}
}
/*
two = zwei
 */


396LW NO topic_id




AD

Další témata ....(Topics)


32

Create array of strings in xml file Android example | 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>
</resources>
14

SQLite explorer download | sqlite-explorer-download


Best of SQLite explorer and admin download for SQLite 2.x and SQLite 3.x in separated folders.

Download Explorers SQLite 2.x and SQLite 3.x in separated folders
308

Where Eclipse stored Settings and Templates Java Code | where-eclipse-stored-templates-java-code



C:\documents\workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.ui.prefs
342

android.app.Application cannot be cast to android.app.Activity | android-app-application-cannot-be-cast-to-android-app-activity


If you using Context as parameter of function try this solution:

public class MyActivity extends Activity {
// bla bla bla .......
//error 
myFc( getapplicationcontext());
// OK
myFc(MyActivity.this);
246

Snow Text Effects Paint.NET | snow-text-effects-paint-net


For some graphics you can use Paint.NET editor.
//www.getpaint.net/
How create Snow Effects on Text by 1 minute show this video: