SORU
16 Mayıs 2012, ÇARŞAMBA


Nasıl bir edittext dikkatim dağıldı, ne zaman netleşir

Bir EditText odağı kaybettiğinde, kullanıcıların arama yaptım soruları ama herhangi bir cevap bulamadım yetişmem lazım.

Bu gibi focuschangelistener kullanıyorum

OnFocusChangeListener foco = new OnFocusChangeListener() {

    @Override
    public void onFocusChange(View v, boolean hasFocus) {
        // TODO Auto-generated method stub

    }
};

Ama benim için çalışmıyor

Teşekkürler

CEVAP
16 Mayıs 2012, ÇARŞAMBA


onFocusChange setOnFocusChangeListener uygulamak ve hasFocus için boolean bir parametre var. Bu yanlış, başka bir denetime dikkatini kaybettin.

 EditText txtEdit = (EditText) findViewById(R.id.edittxt);

 txtEdit.setOnFocusChangeListener(new OnFocusChangeListener() {          

        public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
               // code to execute when EditText loses focus
            }
        }
    });

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • GavinMichaelBooth

    GavinMichael

    26 AĞUSTOS 2006
  • Press Start

    Press Start

    4 HAZİRAN 2006
  • Tome Rodrigo

    Tome Rodrigo

    9 Temmuz 2006