OnKeyListener Not working

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


Sponsored Links
 Hi

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) {
                textBox.setOnKeyListener(this);
                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
displayed.

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

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
Amit

Here is my MapActivity-

public class MapsActivity extends MapActivity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
        }

        @Override
        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"
android:versionName="1.0">
        <application android:icon="@drawable/icon" android:label="@string/
app_name">
                <uses-library android:name="com.google.android.maps" />
                <uses-permission android:name="android.permission.INTERNET" />
                <activity android:name=".MapsActivity" android:label="@string/
app_name">
                        <intent-filter>
                                <action 
android:name="android.intent.action.MAIN" />
                                <category 
android:name="android.intent.category.LAUNCHER" />
                        </intent-filter>
                </activity>

        </application>
</manifest>



and the mail.xml looks like -

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

-- 

2. getCellLocation() returns null

Hi,

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.

<Code>
        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") ;
       }
</Code>

Also, I have added the following permissions :

ACCESS_FINE_LOCATION,
ACCESS_COARSE_LOCATION,
CONTROL_LOCATION_UPDATES.

Do I need to add any other permissions?

Kindly let me know where I have gone wrong.

Thanks in advance,
Regards,
Vinay

-- 

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