1
我用menu_items.xml填充我的菜單項,它位於值中。Android:我如何從數據庫中爲<item></item>設置值?
我menu_items.xml樣子:
<?xml version="1.0" encoding="utf-8"?>
<string-array name="menu_items">
<item ><b><u>Where to stay</u></b></item>
<item ><b><u>Where to eat</u></b></item>
<item ><b><u>What to see</u></b></item>
<item ><b><u>Usefull info</u></b></item>
</string-array>
這是從MainActivity.java代碼的一部分從哪裏獲得的標籤之間的這些值:
private ListView lvMenu;
private CharSequence[] lvMenuItems; //CharSequence[] allow to bold text between <item></item> tags
...
lvMenuItems = getResources().getTextArray(R.array.menu_items);
lvMenu = (ListView) findViewById(R.id.menu_listview);
lvMenu.setAdapter(new ArrayAdapter<CharSequence>(this,
android.R.layout.simple_list_item_1, lvMenuItems));
我c reated數據庫,以及所有這些東西。現在,我想在標籤之間放置一些來自數據庫的標題。 你能幫我解決這個問題嗎?謝謝。 如果你需要更多信息,告訴我。
我會試試這個,一個我想我想能夠從數據庫中添加一些數據到String []數組中? –
@ZeljkoIvanovic確保一切順利... – Nambi