lundi 30 mars 2015

Android APP multilanguage SQLite

I would fully translate my Android app. (this includes the SQLite is displayed on the phone language)


This is like now connect;



private static final int DATABASE_VERSION = 5;
private static final String DATABASE_NAME = "quotes.db";
private static final String DB_PATH_SUFFIX = "/databases/";
private static final String TABLE_QUOTES = "quote";
private static final String KEY_ID = "_id";
static Context myContext;

public DataBaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
myContext = context;
}


I had thought to remove the name string database and pass it the name database using the strings.xml file.


super(context, context.getResources (). getString (R.string.DATABASE_NAME), null, DATABASE_VERSION);


Also look for the query to pass on through strings.xml, but can not find clear documentation.


I would appreciate if I do not guide a little. Many Thanks.


Example the query:



// Select All Query
String selectQuery = "SELECT name, COUNT(author_name ) AS count FROM author LEFT JOIN quote ON name = author_name WHERE name LIKE '%"
+ value + "%' GROUP BY name ORDER BY name ASC";

Aucun commentaire:

Enregistrer un commentaire