use of com.connectsdk.service.DeviceService in project butter-android by butterproject.
the class PairingDialog method getPairingDialog.
public AlertDialog getPairingDialog(String message) {
TextView title = (TextView) activity.getLayoutInflater().inflate(android.R.layout.simple_list_item_1, null);
title.setText(message);
final EditText input = new EditText(activity);
input.setInputType(InputType.TYPE_CLASS_NUMBER);
return new AlertDialog.Builder(activity).setCustomTitle(title).setView(input).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String value = input.getText().toString().trim();
for (DeviceService service : device.getServices()) service.sendPairingKey(value);
}
}).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.cancel();
// pickerDialog.dismiss();
}
}).create();
}
Aggregations