Retrieve number of cameras instead of battery *charge counter*
This commit is contained in:
parent
d7e82d07c2
commit
34613e344b
@ -4,8 +4,8 @@ import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
import android.content.Context;
|
||||
import android.os.BatteryManager;
|
||||
import android.util.Log;
|
||||
import android.hardware.camera2.CameraManager;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
@Override
|
||||
@ -15,9 +15,12 @@ public class MainActivity extends Activity {
|
||||
|
||||
TextView text = (TextView)findViewById(R.id.my_text);
|
||||
Context context = getApplicationContext();
|
||||
BatteryManager batteryManager = (BatteryManager)context.getSystemService(Context.BATTERY_SERVICE);
|
||||
text.setText("Hello, worldg!" + batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER));
|
||||
log("Hello from Camera app!");
|
||||
log("Camera app initialized!");
|
||||
try {
|
||||
CameraManager cameraManager = (CameraManager)context.getSystemService(Context.CAMERA_SERVICE);
|
||||
text.setText("Number of cameras: " + String.valueOf(cameraManager.getCameraIdList().length));
|
||||
}
|
||||
catch (Exception _e) {}
|
||||
}
|
||||
|
||||
private void log(String toLog) {
|
||||
|
Loading…
Reference in New Issue
Block a user