久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

java android getResources()。getIdentifier()

瀏覽:134日期:2024-05-03 13:48:22
如何解決java android getResources()。getIdentifier()?

問題似乎是您要轉換drawerSelection為小寫字母。在R.java文件中很明顯,標識符的大小寫得以保留。嘗試致電:

int panelId = this.getResources().getIdentifier(drawerSelection,'id',getActivity().getPackageName());解決方法

如何從R.獲取ID的int id值?當我使用getIdentifier它的正好回報0。

int i = getArguments().getInt(SELECTION_NUMBER); String drawerSelection = getResources().getStringArray(R.array.drawerSelection_array)[i];int panelId = this.getResources().getIdentifier(drawerSelection.toLowerCase(),'id',getActivity().getPackageName());

編輯

Xml

<LinearLayout xmlns:android='http://schemas.android.com/apk/res/android'android:layout_width='match_parent'android:layout_height='match_parent'android:orientation='vertical' ><ListView android: android:layout_width='match_parent' android:layout_height='wrap_content' ></ListView></LinearLayout>

日志

06-10 21:24:30.372: I/System.out(3572): Selection = Bus_Schedules06-10 21:24:30.372: I/System.out(3572): panelId = 0

R.java

public static final class id { public static final int Bus_Schedules=0x7f090004; public static final int basemenu=0x7f090005; public static final int content_frame=0x7f090001; public static final int drawer_layout=0x7f090000; public static final int left_drawer=0x7f090002;

標簽: java
相關文章:
主站蜘蛛池模板: 广饶县| 临安市| 高尔夫| 乌鲁木齐县| 梅河口市| 南充市| 阜新| 西和县| 礼泉县| 龙门县| 成武县| 逊克县| 略阳县| 文昌市| 梅州市| 冀州市| 赤水市| 调兵山市| 宜川县| 南昌市| 贵德县| 临江市| 通城县| 瑞丽市| 福清市| 大邑县| 德钦县| 定日县| 贡山| 车险| 尼勒克县| 曲沃县| 尚志市| 大兴区| 玛多县| 平远县| 乐清市| 马龙县| 英山县| 德兴市| 香港|