Hi i plan to develop an android application for English and Spanish Languages.For that we store data in Sq lite Database.without depends on the device language. Application contains List of long text values stored in sq lite database and data retrieved from the db and shown in list view.how can i store different languages data in sq lite and how to retrieve and display in view based on language selection.
1
votes
1 Answers
1
votes
You could create a table in sqlite that contains nodes as one column and two other columns that contains the spanish version of the same and English version. Like:
ID NODE SPANISH ENGLISH
1 LOGIN S-LOGIN LOGIN
use :
Locale current = getResources().getConfiguration().locale;
to get the current locale, google a little bit to find out how to get the current language selection.
In the onResume method of the activity:
1. Check the current locale
2. Based on the current locale, fetch the strings for the labels and views
3. SetText to the views using the strings that you obtain
And that's it. I hope this much clue helps!