I work on SDK1.5
this code compile and make apk file. but this file don't walk on my virtual
device.
package com.exemple.android.skeleton;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.hardware.*;
import java.util.Date;
public class TimeButton extends Activity implements SensorListener {
/** Called when the activity is first created. */
TextView myTextView;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
SensorManager sensorMgr = (SensorManager)
getSystemService(SENSOR_SERVICE);
boolean TempSupported =
sensorMgr.registerListener(this,SensorManager.SENSOR_TEMPERATURE,SensorManager.SENSOR_DELAY_UI);
if (!TempSupported) {
sensorMgr.unregisterListener(this,SensorManager.SENSOR_TEMPERATURE);
myTextView.findViewById(R.id.TextView01);
myTextView.setText("Pas de temperature");
}
}
SensorListener mySensorListener = new SensorListener() {
@Override
public void onSensorChanged(int sensor, float[] values) {
if (sensor == SensorManager.SENSOR_TEMPERATURE)
onTemperatureChanged(sensor, values);
}
public void onTemperatureChanged(int sensor, float[] values){
float temp;
temp = values[0];
myTextView.findViewById(R.id.TextView01);
myTextView.setText("Temp:"+temp);
}
public void onAccuracyChanged(int sensor, int accuracy) {}
};
@Override
public void onAccuracyChanged(int sensor, int accuracy) {
// TODO Auto-generated method stub
}
@Override
public void onSensorChanged(int sensor, float[] values) {
// TODO Auto-generated method stub
}
}
--
Nzouwo bernis
Etudiant maître en informatique.
spécialité réseaux et dévellopement.
certifié cisco
Tel:(00237)75282421
loisirs: sport, jeu d'echec, musique...
--
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