English 中文(简体)
甲状腺素——同值——不同语言
原标题:android sqlite - same value - different language

我愿从本组织语言(地方化)的不同价值中获取。 如何做到这一点?

创建这样的表格:

create table test (
_id integer primary key autoincrement,
some_value text,
some_value_en text
);

获得适当价值(有些价值或部分价值_en)将是好的解决方案?

最佳回答

我不肯定你需要什么,但你可以使用安乐斯地方化基础设施来获得一栏名称。 Put “ Some_ Value” in a String resources in Valuestrings.xml, and overe it in Value-enstrings.xml with “some_ Value_en” .

SELECT according to the column name.

问题回答

如果我正确理解你的话,你就希望分散地获得地方化的资源。 你们可以做的是,首先让验证员采用这种方法:

int id = getResources().getIdentifier("name_of_resource", "id", getPackageName());

资源名称可以是你从数据库获得的。 当地化护卫将休息。 因此,基本上,你只是在数据库中储存缺省。

String localizedResource = getResources().getString(id);

牢记Id能更有效地直接获得资源。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签