我在我的微调器中调用onItemSelectedListener
但onItemSelected
中的代码未被执行。
这是我的代码:
final MaterialBetterSpinner materialDesignSpinner = (MaterialBetterSpinner)
findViewById(R.id.states_list);
ArrayAdapter<String> stateArrayAdapter = new ArrayAdapter<>(this,
android.R.layout.simple_dropdown_item_1line, getResources().getStringArray(R.array.oman_states));
materialDesignSpinner.setAdapter(stateArrayAdapter);
materialDesignSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
System.out.println("works");
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
System.out.println()
未执行
我在这里做错了什么?
答案 0 :(得分:1)
您希望使用android.util.Log
代替System.out
,而service.Login = function(username, password, callback) {
var encodedString = 'username=' + encodeURIComponent(username) + '&password=' + encodeURIComponent(password);
var baseUrl = "https://localhost:450/rest/";
$http({
method: 'POST',
url: baseUrl + "dns/loginResource",
data: encodedString,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(function(response) {
var data = response.statusText;
console.log(data);
callback(data);
}, function(error) {
var data = error.data;
console.log(data);
callback(response);
});
并非始终有效。请参阅this。