0

trying develop a Russian/English Flag game, given the flag image you choose in Russian or in English modes...

Since English country names get from country file image names, can have a Java generic Map key=englishCountryName & value=inRussianEquivalent.... to do the Russian part???

Or exist other way? if you think this is good choice, where insert this COUNTRIES Map<String, String> (about 200 entries) , in an Activity or in a Java file? can/must this Map variable be public static final?

2
Contributors
16
Replies
19
Views
5 Years
Discussion Span
Last Post by lse123
0

java files can contain russian characters eg on a Map (english the key), (Russian the value)????

0

No Java files have to be encoded in UTF-8 therefore it is easier to use XML files as Android OS takes care of it

0

You mean populate, with English (key), & Russian (value) words the Java Maps generic arrays, from xml file...utf-8 coded, this must work?

yes this mean(exactly) / no may not work

0

In my case is easier use a map with ru(values) and en(keys), just tell am I able for this?

0

java files needed any char encoding statement in Android... go to try now!

0

Little respect wouldn't hurt! And even Java need Unicode. Or do you care to post particular example to prove me wrong?

0

I try it well i think it will work... prompt me for convert to utf-8 jave file. are you recomment hard code(populate) the map in java code or read at run time from a file...? countries names en/ru...???

0

These are two different statements

java files needed any char encoding statement in Android... go to try now!

and

I try it well i think it will work

I'm not recommending any hard coded maps. I'm telling you to do it properly through resources as xml files. If you not gone listen to my advice do not ask me about map or your chances of russian alphabet in Java

0
public Map<String, String> enRu;
enRu = new HashMap<String, String>();
enRu.get("Africa")
enRu.get("key")=gives value ,... 

well if have value how get corresponding key? no double values no double keys... what java map to use?

0
public static String getKeyByValue(Map<String, String> map, String value) {
    for (String key : map.keySet()) {
        if (value.equals(map.get(key))) {
            return key;
        }
    }
    return null;
}
0

How I can hard populate a Map without must space in jave file? exist and other way than
regionsMap.put("Africa", true);
???

0
        enRu = new HashMap<String, String>();
        enRu.put("Africa", "Африка");

        textView = (TextView)findViewById(R.id.ru);
        textView.setText(enRu.get("Africa")+" "+getKeyByValue(enRu,"Африка"));

well I went in other WORKSPACE and opeded the file but non-understandable chars appear for russian... if work only in old workspace, and upload apk in my device and works, means works in all phones???

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.