OnKeyListener Not working

by Guillaume Imbert » Thu, 03 Mar 2011 04:27:50 GMT

Sponsored Links

I try to apply treatment onto EditText.
To do so in Android 1.5 a few months ago I used the View.OnKeyListener
interface and everything worked fine.

Now I uploaded my application onto a Android 2.2 device (and also
virtual device) and it doesn't work anymore, except the OK key, that
is still captured.

My EditText is binded to the controller through my Controller
constructor :

       public TextController(EditText textBox) {
                boxSize = textBox.getText().toString().length();
                text = textBox.getText().toString();

the onKey method is triggered only while hitting the DEL key and the
OK key

Has anyone already experienced this?


Other Threads

1. My MapActivity is not showing the map

Hi All,

I am trying to create a sample application to explore Google maps
through android.

When I try to run the application I only get the blank grid. no map is

If i see the DDMS logcat i get erros "Couldn't get connection factory

Please help me in this regard.

Surprisingly the already installed  Google Maps app of emulator is
working fine and showing me the maps

Thanks in advance

Here is my MapActivity-

public class MapsActivity extends MapActivity {
        /** Called when the activity is first created. */
        public void onCreate(Bundle savedInstanceState) {

        protected boolean isRouteDisplayed() {
                return false;


The manifest file looks like -

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.eterno" android:versionCode="1"
        <application android:icon="@drawable/icon" android:label="@string/
                <uses-library android:name="com.google.android.maps" />
                <uses-permission android:name="android.permission.INTERNET" />
                <activity android:name=".MapsActivity" android:label="@string/
android:name="android.intent.action.MAIN" />
android:name="android.intent.category.LAUNCHER" />


and the mail.xml looks like -

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
                android:id="@+id/mapView" android:layout_width="fill_parent"
                android:layout_height="fill_parent" android:enabled="true"
android:apiKey="02352T_xL1RpvxyvjnKOslq4kck4eh5D-DRQRjg" />


2. getCellLocation() returns null


I am trying to access the current cell location information. When I
try to call getCellLocation() it returns null.

I am unable to reason out this.. the same code works on 1.5 but fails
on 1.6 or 2.1.(Tested on G1 with 1.6 and HTC legend 2.1).

Can some one help me in correcting this bug? My code is below.

        TelephonyManager tMgr = (TelephonyManager)
getSystemService(TELEPHONY_SERVICE) ;
        outputView = (TextView) findViewById(R.id.output) ;

        outputView.append("Device type:"+tMgr.getPhoneType()+"\n") ;

       GsmCellLocation gsmCellLocation = (GsmCellLocation)
tMgr.getCellLocation() ;
       if (gsmCellLocation != null) {
          String mCellId = "" + gsmCellLocation.getCid() ;
          String mLAC = "" + gsmCellLocation.getLac() ;
          Log.d("SDKService" , "Cell Id: "+mCellId+" LAC: "+mLAC) ;
          outputView.append("Cell Id: "+mCellId+" LAC: "+mLAC+" MCC: "+mMCC+"
MNC: "+mMNC+"\n") ;

Also, I have added the following permissions :


Do I need to add any other permissions?

Kindly let me know where I have gone wrong.

Thanks in advance,


3. how to capture log messages to String

4. Can someone please post the steps to debug the Android kernel?

5. Froyo wpa_supplicant

6. Suggestions on howto start service without rebooting device

7. Populating child list in Expandable lists using dynamic multidimensional arrays