我想根据设备中的当前区域设置设置适当的数据库名称。有什么建议?谢谢你们。
public class DatabaseHelper extends SQLiteAssetHelper {
private String currentLanguage = "";
private static final String DATABASE_NAME = "";
private static final int DATABASE_VERSION = 1;
public DatabaseHelper(Context context) {
//I want the DATABASE_NAME should depends on current locale in device,
//if the current language of device is english, DATABASE_NAME = "db_en",
//else it is french, DATABASE_NAME = "db_fr"
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
答案 0 :(得分:1)
您可以将数据库名称存储在strings.xml文件中并进行本地化。 更多信息:http://developer.android.com/guide/topics/resources/localization.html