30 lines
1.0 KiB
Java
30 lines
1.0 KiB
Java
package com.robust_image_source_identification_on_modern_smartphones.camera;
|
|
|
|
import android.app.Activity;
|
|
import android.os.Bundle;
|
|
import android.widget.TextView;
|
|
import android.content.Context;
|
|
import android.util.Log;
|
|
import android.hardware.camera2.CameraManager;
|
|
|
|
public class MainActivity extends Activity {
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
setContentView(R.layout.activity_main);
|
|
|
|
TextView text = (TextView)findViewById(R.id.my_text);
|
|
Context context = getApplicationContext();
|
|
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) {
|
|
Log.i("Robust image source identification on modern smartphones camera", toLog);
|
|
}
|
|
}
|