我正在Android項目中,我有一個設備列表,我想顯示感謝基礎適配器。每個設備都有一個亮度級別,我想用搜索欄進行修改。 我試圖識別設備尋求與這樣的標籤欄:發送數據綁定ID與標籤不工作
<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:max="100"
android:tag="@{Integer.toString(ampoule.idx)}" />
這是我安瓿對象:
private String Type ;
private int LevelInt;
private String hueColor;
private String Name;
private int idx;
與結合:
<data>
<variable
name="ampoule"
type="com.example.****.***.containers.LightDevice"
/>
</data>
現在,當我嘗試獲取我的baseadapter的標籤以獲取該對象,我得到以下錯誤:
FATAL EXCEPTION: main
Process: com.example.***.***, PID: 9057
java.lang.NumberFormatException: Invalid int: "binding_4"
而且這裏是我得到的標籤:
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
setDimmableLevel(seekBar.getTag().toString(),progress);
}
private void setDimmableLevel(String idx, final int progress) {
Map<String, String> queryParams = new HashMap<>();
Log.d("TAG", "valeur idx : "+idx);
final LightDevice light = LightList.getInstance().getLight(Integer.parseInt(idx));
的錯誤是,我的變量值binding_4代替beeing的ampoule.idx值...
的任何想法,我應該怎麼做?
謝謝
不,仍然無法正常工作... –