Tema: [ SOLUCIONADO ] Bases datos varios idiomas
Ver Mensaje Individual
  #10  
Viejo 26/10/15, 13:14:02
Avatar de sonydei
sonydei sonydei no está en línea
Miembro del foro
Mensajes: 75
 
Fecha de registro: may 2011
Mensajes: 75
Modelo de smartphone: Samsung Galaxy Note 2
Tu operador: Simyo
Mencionado: 2 comentarios
Tagged: 0 hilos
Os pongo los dos archivos el que me funciona con una sola base de datos:
Código:
public static void initialize(SQLiteDatabase db, Context ctx) {
		// Initialize DB
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(
					ctx.getAssets().open("InitializeDB.txt"), "UTF-8"));

			// do reading, usually loop until end of file reading
			String mLine = reader.readLine();
			while (mLine != null) {
				// process line
				db.execSQL(mLine);
				mLine = reader.readLine();
			}

			reader.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
Y el modificado que no funciona con las modificiaciones que me habéis indicado.

Código:
public static void initialize(SQLiteDatabase db, Context ctx) {
		// Initialize DB
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(
					ctx.getAssets().open(getString("R.string.InitializeDB")), "UTF-8"));

			// do reading, usually loop until end of file reading
			String mLine = reader.readLine();
			while (mLine != null) {
				// process line
				db.execSQL(mLine);
				mLine = reader.readLine();
			}

			reader.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	private static String getString(String string) {
		// TODO Auto-generated method stub
		return null;
	}
y este el string por ejemplo el español

Código:
<string name="InitializeDB">InitializeDB-es.txt</string>
¿Donde veis el fallo? Muchas gracias por vuestra ayuda.
Responder Con Cita