我想傳入字符串數組中的字符串資源值,但它沒有在數組中取值。將採取空值如何傳遞字符串數組中的字符串資源引用android
下面是我的代碼:
prepaid = getResources().getString(R.string.lbl_prepaid);
dth = getResources().getString(R.string.lbl_dth);
public String[] addedRTHomeList(){
String[] homeList = {prepaid,dth,"PostPaid","Utility Services","Complaint Entry","Complaint Status","Recharge Status",chat,"Topup Request","Redeem Discount","Private Bus Booking","ST Bus Booking","Hotel Booking","Flight Booking","Money Transfer","Settings","Reports","DTH Activation"};
return homeList;
}
for(int i = 0; i < ba.addedRTHomeList().length ; i++)
{
md = new MenuDetail();
md.setMenuName(ba.addedRTHomeList()[i]);
md.setImageId(ba.RTDrwableListThemeRed()[i]);
RTmenuListRed.add(md);
RTMenuThemeRed.put(ba.RTMenuCode()[i],RTmenuListRed);
}
在for循環,當我訪問addedRTHomeList數組的第一個值,它取空值
爲什麼你不想使用<字符串數組>資源? –
你不能這個'homeList = {prepaid,dth}'你只能用Array.combine –
Thanx合併..如果可能請分享例子.. –