Вы можете использовать эту пользовательскую библиотеку (написанную с помощью Promise) для выполнения удаленного вызова.
function $http(apiConfig) {
return new Promise(function (resolve, reject) {
var client = new XMLHttpRequest();
client.open(apiConfig.method, apiConfig.url);
client.send();
client.onload = function () {
if (this.status >= 200 && this.status < 300) {
// Performs the function "resolve" when this.status is equal to 2xx.
// Your logic here.
resolve(this.response);
}
else {
// Performs the function "reject" when this.status is different than 2xx.
reject(this.statusText);
}
};
client.onerror = function () {
reject(this.statusText);
};
});
}
Пример простого использования:
$http({
method: 'get',
url: 'google.com'
}).then(function(response) {
console.log(response);
}, function(error) {
console.log(error)
});
Вы можете получить каждый NumberPicker
TimePicker и сделать все, что хотите, например, изменить, запросить фокус и т. д.
NumberPicker hourPicker = (NumberPicker) mTimePicker.findViewById(Resources.getSystem().getIdentifier("hour",
"id", "android"));
NumberPicker minutePicker = (NumberPicker) mTimePicker.findViewById(Resources.getSystem().getIdentifier("minute",
"id", "android"));
NumberPicker amPmPicker = (NumberPicker) mTimePicker.findViewById(Resources.getSystem().getIdentifier("amPm",
"id", "android"));
// this is a number picker modified and there is one for each NumerPicker above
View numberPickerModified = (View) mTimePicker.findViewById(Resources.getSystem().getIdentifier("numberpicker_input",
"id", "android"));