I would like to create a listview with all bluetooth devices scanned. Each row will contain a connection state of text and clicking it will make the device connect to remote device. How could I update only the single row of remote device being connected in listview so the connection state will keep changing: disconnected -> connecting -> connected for example?
You can take row from ListView at required position and update:
private void refreshConnectionState(int rowIndex, String newConnectionState){
View row = devicesListView.getChildAt(rowIndex);
if(row == null) return;
TextView stateTextView = (TextView )row.findViewById(R.id.state_text_view);
stateTextView.setText(newConnectionState);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.