Localisation in my Android App on button click? -


I have an Android app and I have different activities and I have separate text views in those activities I have two buttons for two languages ​​for one English and for another Chinese

This is my activity ...

  AndroidLocalize the public class as I now Want to change all the text scenes from different activities in different languages. Activity {TextView TV; Button B1, B2; Override public null on @reate (bundle saved instainstate) {super.naught (savedinstenstate); SetContentView (R.layout.main); Tv = (TextView) findViewById (R.id.textView1); B1 = (button) Find VBID (R.B. button 1); B1.setOnClickListener (New OnClickListener) {Public Zero onClick (see arg0) {Locale Locale = New Location ("N"); Locale.setDefault (location); Configuration Config = New Configuration (); config.locale = Location; GetBaseContext .getResources () updateConfiguration (.. config, getBaseContext () getResources () getDisplayMetrics ()); tv.setText (R.string.greet);}}); B2 = (button) Find VibibIID (R.B. button2); B2.setOnClickListener (New OnClickListener) {Public Zero onClick (see v) {Locale Locale = New Location ("Hi"); Locale.setDefault (Location); Configuration Config = New Configuration (); config.locale = Location; GetBaseContext .getResources () updateConfiguration (.. config, getBaseContext () getResources () getDisplayMetrics ()); tv.setText (R.string.greet);}}); }   

I am able to click on the button in the same activity, now I want to provoke the language in second activity. Here is my another activity ..

  spreads public class Laanguage activity {@Override protected Zero OnCreate (bundled savedInstanceState) {// TODO auto-created method stub super.onCreate (savedInstanceState); SetContentView (R.layout.language); TextView TV; Tv = (TextView) findViewById (R.id.textView2); }  itemprop = "text"> 

after that you can use > Put Extra and getExtra in your main activity and sub activities respectively.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -