Single click into an editText

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Single click into an editText

Postby chaoz1336 » Fri Jan 16, 2009 12:44 pm

It's me again =)
So...
I add an onClickListener on an EditText, but only when this EditText has the focus and I click it again,
then my onClickListener is triggered...

But I want it to react on a single click, noch like "click -> focus, 2nd Click -> react"

....any idea? =/

thx in advance!
chaoz1336
Experienced Developer
Experienced Developer
 
Posts: 90
Joined: Wed Dec 10, 2008 5:19 pm

Top

Postby mortefer » Fri Jan 16, 2009 8:46 pm

Just thinking aloud but:
Try extending EditText, catch onFocusChanged event and store a flag if item is focused, then when onCick event occurs you check if flag is set, if so - proceed with event, otherwise do nothing.
mortefer
Experienced Developer
Experienced Developer
 
Posts: 54
Joined: Sat Dec 20, 2008 11:24 am

Postby MrSnowflake » Sat Jan 17, 2009 8:48 am

That would work, but the problem is then, what if you use the trackball to focus the button?
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby chaoz1336 » Sat Jan 17, 2009 9:46 am

MrSnowflake wrote:That would work, but the problem is then, what if you use the trackball to focus the button?


...damn ... thats right =/
aint there any similiar controls?
chaoz1336
Experienced Developer
Experienced Developer
 
Posts: 90
Joined: Wed Dec 10, 2008 5:19 pm

Postby MrSnowflake » Sat Jan 17, 2009 11:10 am

You could try intercepting View.onTouchEvent(MotionEvent event) and try using that, instead of overriding the onFocusThingy.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby mortefer » Sun Jan 18, 2009 9:43 pm

Doesn't changing of focus (even with a track ball) fires onFocusChanged event? If no - then this is ridiculous
mortefer
Experienced Developer
Experienced Developer
 
Posts: 54
Joined: Sat Dec 20, 2008 11:24 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests