こんにちは友達文字列ファイルからグジャラート語のテキストを表示したいので、values-guのようなフォルダーを作成し、文字列アイテムを次のように置きます
<item name="language">ભાષા પસંદ કરો</item>
デバイスで実行すると空白のテキストが表示されるので、どうすれば解決できますか?
私のMainJavaファイルは以下の通りです:
public class CategoryActivity extends Activity
{
Button mButtonCurrency;
Button mButtonGoldSilverPrice;
Intent mIntent;
Locale myLocale;
Spinner mSpinnerLangeage;
public int from;
TextView mTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.choose_category);
mIntent=getIntent();
mButtonCurrency=(Button)findViewById(R.id.choose_category_btn_currency);
mTextView=(TextView)findViewById(R.id.choose_category_txt_language);
mButtonGoldSilverPrice=(Button)findViewById(R.id.choose_category_btn_gold_silver);
mSpinnerLangeage=(Spinner)findViewById(R.id.choose_category_spn_language);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.language_name, R.layout.spin_layout);
adapter.setDropDownViewResource(android.R.layout.select_dialog_singlechoice);
mSpinnerLangeage.setAdapter(adapter);
mSpinnerLangeage.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(
AdapterView<?> adapterView, View view,int pos, long l) {
from=pos;
if(pos==1)
{
setLocale("en");
}
else if (pos==2) {
setLocale("gu");
}
}
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
mButtonCurrency.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mIntent=new Intent(getApplicationContext(), CurrencyConverterActivity.class);
startActivity(mIntent);
}
});
mButtonGoldSilverPrice.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mIntent=new Intent(getApplicationContext(), GetGoldAndSilverPriceActivity.class);
mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(mIntent);
}
});
}
public void setLocale(String lang) {
myLocale = new Locale(lang);
Resources res = getResources();
DisplayMetrics dm = res.getDisplayMetrics();
Configuration conf = res.getConfiguration();
conf.locale = myLocale;
res.updateConfiguration(conf, dm);
Intent mIntentRefresh = new Intent(this, CategoryActivity.class);
mIntentRefresh.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(mIntentRefresh);
}
私の文字列ファイルには次のような値が含まれています
<item name="language">ભાષા પસંદ કરો</item>
しかし、それはデバイスで動作していません