我在视图中有3个Edittexts和3个微调器,每当任何edittext文本值发生变化或任何微调器选择发生变化时我都必须进行服务校准,如何在edittext或者微调器中获得更改通知选择?
答案 0 :(得分:0)
您需要向EditTexts和Spinners添加侦听器。
对于EditTexts,试试这个:
// Escape the first 18 columns of $data
$escaped = array_map("mysqli_real_escape_string", array_slice($data, 0, 18));
// Now pack them into the insert query
$querystring = "INSERT INTO forms (id, created_time, ad_id, ad_name, adset_id, adset_name, campaign_id, campaign_name, form_id, is_organic, specialist, full_name, email, city, country, date_of_birth, phone_number)
VALUES (" . implode(",", $escaped) . ")";
对于Spinners试试这个:
editText1.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
// your code here
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// your code here
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// your code here
}
});
答案 1 :(得分:-1)
您检查过api文档吗?所有的android视图都有非常清晰的监听器apis。 EditText / TextView也不例外:addTextChangedListener