I tried handling the keyDown event from onKeyLIstener implementation.
but it seems its not working.

        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();

InputMethodManager inputMethodManager = (InputMethodManager)
mContext.getSystemService ( Context.INPUT_METHOD_SERVICE );
//inputMethodManager.showSoftInput ( mStatusBarView,
InputMethodManager.SHOW_FORCED );
inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);

                    }
                        });

        urlTextbox.setOnKeyListener(new View.OnKeyListener() {
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                // If the event is a key-down event on the "enter" button
        Log.v(TAG,"On key down");

        if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
                    (keyCode == KeyEvent.KEYCODE_ENTER)) {
                  // Perform action on key press
        Log.v(TAG,"On key down - pressed");
                  return true;
                }
                return false;
            }
        });

When a key is pressed it is been passed to quickSearchbox intent. How
to override this ?
Can someone please help.?
Dianne, your insight would be helpful...

thanks,
- mani
On Sep 23, 1:35 pm, mani <[email protected]> wrote:
> 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 ).!!! (which ever
> activity am in)
> 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
>
> Thanks,
> Mani

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to