当我单击我的 listView 时,我想加载本地数据。一些图片和文字。
主要活动
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Intent intent = new Intent(this, schemeTown.class);
intent.putExtra("town_name_dev", sparseArray.get(position));
this.startActivity(intent);
}
计划镇
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String townNameDev = intent.getStringExtra("town_name_dev");
//setContentView(R.layout.townNameDev);
}
但我不能这样做, setContentView(R.layout.townNameDev); 所以我在资产存储库中创建 Xml 文件并使用 Dom
我创建,但我不知道如何加载字符串资源文件。我需要这个来做一个多语言应用程序:
<town>
<name>I want to refer to my string resources (@string/france)</name>
<monument>
<img>file:///android_res/drawable/eiffel_tower.png</img>
<description>I want to refer to my string resources (@string/eiffel_tower)</description>
</monument>