Keyboard popup not happening from status bar edittext

261 views
Skip to first unread message

mani

unread,
Sep 23, 2010, 3:35:53 AM9/23/10
to android-platform
Hi all,

I implemented a edittext and a button on a status bar.

The problem i face here is, when the edittext is focused and i click
it, i couldnt see the Keyboard popup not happening.

But if i focus it, cursor blinks, and when i type some characters it
is handled by quick search box Activity(intent ).!!!

I have implemented onClick() function for editext. So that i thought
to launch the keyboard input forcefully, even then it doesnot work.!!


W/KeyCharacterMap( 144): No keyboard for id 0
W/KeyCharacterMap( 144): Using default keymap: /system/usr/keychars/
qwerty.kcm.bin
I/ActivityManager( 68): Starting activity: Intent
{ act=android.search.action.GLOBAL_SEARCH flg=0x10000000
cmp=com.android.quicksearchbox/.SearchActivity (has extras) }
I/ActivityManager( 68): Start proc com.android.quicksearchbox for
activity com.android.quicksearchbox/.SearchActivity: pid=331 uid=10026
gids={3003}
I/ActivityManager( 68): Starting activity: Intent
{ act=android.search.action.GLOBAL_SEARCH flg=0x10000000
cmp=com.android.quicksearchbox/.SearchActivity (has extras) }

what is the problem ?
How should i receive the keyboard popup first and characters typed in
being sent to edittext on the status bar.?

Can someone help me with this.

private void makeStatusBarView(Context context) {


urlTextbox = (EditText)sb.findViewById(R.id.urltextbox);
urlTextbox.setFocusable(true);
//urlTextbox.requestFocusFromTouch();

urlTextbox.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {

String url =
urlTextbox.getText().toString();
System.out.println("Status Bar -
Onclick of textbox"+url);
InputMethodManager inputMethodManager = (InputMethodManager)
mContext.getSystemService ( Context.INPUT_METHOD_SERVICE );
inputMethodManager.showSoftInput ( urlTextbox,
InputMethodManager.SHOW_FORCED );

}

});
Button mButton = (Button) sb.findViewById(R.id.Go);
mButton.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {

String url =
urlTextbox.getText().toString();
System.out.println("Status Bar -
Onclick of GO"+url);
Intent browserIntent = new
Intent("android.intent.action.VIEW", Uri.parse("http://
www.google.com"));

browserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(browserIntent);
}
});

}

I implemented in makestatusbarview()

~mydroid/frameworks/base/services/java/com/android/server/status/
StatusBarService.java

Dianne Hackborn

unread,
Sep 23, 2010, 6:44:00 PM9/23/10
to android-...@googlegroups.com
This is not something we have ever done, so you may just need to debug it.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

mani

unread,
Sep 23, 2010, 11:04:23 PM9/23/10
to android-platform
The tricky part here is, i could able to receive click event(OnClick)
on the edit text, but the keyboard is not launched by the system.
And when i introduced KeyListener on the edit text, none of the events
are handled. it is been passed to Qucik Search box intent. Which
simply tells statusbar is not in focus.
So not sure how to figure it out.!! trying to go through qucik search
box intents as well.

This is a challenging work to figure.

Thanks for ur response. if you find any insights or place where i
should look in, please share me or help me.!!

- mani
> > android-platfo...@googlegroups.com<android-platform%2Bunsubscrib e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-platform?hl=en.
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com

mani

unread,
Sep 24, 2010, 7:46:13 AM9/24/10
to android-platform
I could figure out why key events are not passed to status bar view.
While adding statusbar view to the window,the flag is been set as
FLAG_NOT_FOCUSABLE.

if you check out the definition for it.It clearly says, window wont
get key input focus.

FLAG_NOT_FOCUSABLE Window flag: this window won't ever get key input
focus, so the user can not send key or other button events to it.

public void systemReady() {
System.out.println("Statusbar service - systemReady ");
final StatusBarView view = mStatusBarView;
WindowManager.LayoutParams lp = new
WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,

view.getContext().getResources().getDimensionPixelSize(

com.android.internal.R.dimen.status_bar_height),
WindowManager.LayoutParams.TYPE_STATUS_BAR,
// WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE| // After
commenting this line i am able to receive the key events and system
launches keyboard.
WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING,
mPixelFormat);
lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL;
lp.setTitle("StatusBar");
lp.windowAnimations = R.style.Animation_StatusBar;

WindowManagerImpl.getDefault().addView(view, lp);
}FLAG_NOT_FOCUSABLE Window flag: this window won't ever get key
input focus, so the user can not send key or other button events to
it.

But the problem here is, other windows ( application windows ) phone
windows doesnt get focused and i couldnt do any touch events on the
screen.....:(

My question is

1 - Can window focus be changed dynamically, like when the user
touches the application window, it should get focused and when user
touches status bar, it should get focus.
If so, can you point out in the framework code where i can fix it. I
went throught WindowManager, PhoneWindowManager classes. It is pretty
huge, tough to visualise, where the sequences are defined to add the
status bar window, keuguard window, phone window, application window.

Can someone point me or give some brief explanations on this.!!

2 - Second of way of bringing solution to this is, write a seperate
activity, which shows the keyboard and when user presses done, i show
it back on the status bar. [ I havenot tried it yet, hope it works.]

- mani

Dianne Hackborn

unread,
Sep 24, 2010, 10:07:34 PM9/24/10
to android-...@googlegroups.com
Oh, yes, the status bar really does not want to take input focus from everyone else. :)

If it could get input focus, you would need a full UI model for how the user can navigate focus between windows.  This doesn't currently exist.

You can change the flag dynamically as you want, so could temporarily set it until the user does something to tell you they want to move focus elsewhere.

To unsubscribe from this group, send email to android-platfo...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Dianne Hackborn
Android framework engineer

Shrenik Vikam

unread,
Sep 4, 2012, 5:15:02 AM9/4/12
to android-...@googlegroups.com, hac...@android.com
Hello , 
that mean to say if the tablet has a status bar and if anybody want to have a focus on back , home and other button , that also not achievable using DPAD ?

Dianne Hackborn

unread,
Sep 4, 2012, 9:24:41 PM9/4/12
to Shrenik Vikam, android-...@googlegroups.com
Correct you can not navigate focus to the nav bar.
Reply all
Reply to author
Forward
0 new messages