[Android Software Development] imso:
I wanted to know is there any easy way to retrieve video resolution on the actual phone? Because different phone has different phone resolution's compatibility, so i wanted to retrieve the phone's resolution string data and display the different resolutions dynamically into my ListPreference for user selection...

Does it have to do with extracting the string from log.d, substituting the appropriate resolution values and populate into my ListPreference, does it have to do with some Split method? If so how should i do it i'm a newbie in java/android can someone guide me on how should i do that? :confused:

MainCamera.getParameters().get("preview-size-values");
Log.d("ServiceCamera", MainCamera.getParameters().flatten());

My MainActivity.java file

public class CameraTest extends Activity implements SurfaceHolder.Callback {

public static SurfaceView surfaceView;
public static SurfaceHolder surfaceHolder;
public static Camera MainCamera;
private static boolean previewRunning;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

surfaceView = (SurfaceView)findViewById(R.id.surface_camera);
surfaceHolder = surfaceView.getHolder();
surfaceHolder.addCallback(this);

surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

Button btnStart = (Button) findViewById(R.id.button4);
btnStart.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
startService(new Intent(getApplicationContext(), ServiceRecording.class));

MainCamera.getParameters().get("preview-size-values");
Log.d("ServiceCamera", MainCamera.getParameters().flatten());

}
});

Button btnStop = (Button) findViewById(R.id.button5);
btnStop.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
stopService(new Intent(getApplicationContext(), ServiceRecording.class));
}
});

Button btnSetting = (Button) findViewById(R.id.button2);
btnSetting.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
startActivity(new Intent(getApplicationContext(), SettingActivity.class));
}
});
}

public static boolean ServiceStatus;
@Override
public void surfaceCreated(SurfaceHolder holder) {

if(ServiceRecording.recordingStatus)
{
stopService(new Intent(getApplicationContext(), ServiceRecording.class));

try {
Thread.sleep(4000);
}
catch (InterruptedException e) {
e.printStackTrace();
}

MainCamera = ServiceRecording.ServiceCamera;

startService(new Intent(getApplicationContext(), ServiceRecording.class));
}
else{

MainCamera = Camera.open();

if (MainCamera != null) {
Camera.Parameters params = MainCamera.getParameters();
params.setPreviewSize(320, 240);
params.setPreviewFormat(PixelFormat.JPEG);
MainCamera.setParameters(params);

try {
MainCamera.setPreviewDisplay(holder);
}

catch (IOException e)
{
e.printStackTrace();
}
MainCamera.startPreview();
previewRunning = true;
}
else {
Toast.makeText(getApplicationContext(), "Camera not available!", Toast.LENGTH_LONG).show();
finish();
}
}

if (previewRunning) {
MainCamera.stopPreview();
}
}

@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

}

@Override
public void surfaceDestroyed(SurfaceHolder holder){
MainCamera.stopPreview();
previewRunning = false;
MainCamera.release();
}
}

My Preference.xml file currently without any entryValues and entries because i don't seems to know how to populate the dynamic string Values?? :confused:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="Video">
<CheckBoxPreference
android:title="Audio"
android:defaultValue="True"
android:summary="Select w/o Audio"
android:key="AudioPref" />
<ListPreference
android:title="Video Encoder"
android:defaultValue="3gp"
android:summary="Select a video encoding type"
android:key="EncodingPref"
android:entries="@array/EncodingType"
android:entryValues="@array/updateEncodingType"
android:dialogTitle="Video Encoding Formats" />
<ListPreference
android:title="Video Resolution"
android:defaultValue="1"
android:summary="Select the video resolution"
android:key="ResolutionPref"
android:entries="@array/ "
android:entryValues="@array/ "
android:dialogTitle="Video Resolution" />
</PreferenceCategory>
</PreferenceScreen>