tags:

views:

147

answers:

2

hi

I am implementing one application gust i am adding validations in login page implemented then two fields required username and password button login i am applying validations then focus are not getting then set focus in unfilled edittext

>

 if(Username.contentEquals("")) {
    > Toast.makeText(LBS.this, "Please enter
    > username ",Toast.LENGTH_SHORT).show(); 
    > } else { if( pwd.contentEquals("")) 
    > Toast.makeText(LBS.this, "Please enter
    > password ",Toast.LENGTH_SHORT).show();
    > else
    >             try { ........................... }

not filling username then filling password then username entered some toast displayed fine focus are entered in username edittext this is the problem how can implemented focus in unfilled username

+1  A: 

You should be able to use requestFocus after you've come back from the Toast.

For example, if you've got an editText object called username, you SHOULD be able to add a line like username.requestFocus();

But I'm having some problem, right now, making that work just right. In my emulator, the edittext I specify appears to have focus (blinking cursor) but the next field also has a blinking cursor and is where the next key strokes go. So there may need to be some extra bit of code before/after the requestFocus call.

AG
thank you very much i got my problem
narasimha
+1  A: 

Mee too got Same Problem.Wat is the extra code that needs to be placed in order get back control back to setFocussed widget.I will be waiting for valuable reply.

Android_prog
same username.requestFocus() is predefined method
narasimha