I have one edittext
and button which passes the editText
text to the other activity onClick
when it comes to second activity it is receiving the text from main activity.
My question is, I have more than 20 String names in String resource folder, I have to open the particular string which matches the edittext
value of main activity.
In short, I have to change the textview
text which matches string resource String
<resources>
<string name="app_name">sylb</string>
<string name="title_activity_display">display</string>
<string name="large_text">some_large_text</string>
<string name="ds15mca21">second mca</string>
<string name="ds15mca11">first mca</string>
<string name="ds15mba21">second <b>mba</b>></string>
<string name="ds15aut21">second <i>automobile</i></string>
<string name="action_settings">Settings</string>
</resources>
display code
public class display extends AppCompatActivity {
String code;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Intent intent = getIntent();
Bundle extras = intent.getExtras();
code= extras.getString("keyName");
TextView textView= (TextView) findViewById(R.id.textapp);
textView.setText("R.string." + "ds" + code);
}
}
– Ravi Kiran Feb 23 '17 at 03:36