Q1. What are the available different forms of video encoding type
available in android for user to choose from? Because i'm currently
doing a video recording app which i wanted to use ListPreference to
allow user to dynamically choose what type of encoding is available.

Q2. 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
resolution data and display the different resolutions dynamically into
my ListPreference for user selection... Does it have to do with a
method name "flatten()" i don't quite know what is the method... I'm
kinna new in java/android, can someone guide me on how should i do
that?

My mainActivity.java file
public class CameraTest extends Activity implements
SurfaceHolder.Callback {

        private static final String TAG = "Exception";

        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);
        //getparameters

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

        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 since having error because my ListPreference
for Video resolution has empty "entries" for user to select from...
<?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="3"
                        android:summary="Set the Video Encoding Type"
                        android:key="EncodingPref"
                        android:entries="@array/EncodingType"
                        android:entryValues="@array/
updateEncodingType"
                        android:dialogTitle="Video Encoding Format" />
                <ListPreference
                        android:title="File Format"
                        android:defaultValue="3gp"
                        android:summary="Select the File Format"
                        android:key="FileFormatPref"
                        android:entries="@array/FileFormat"
                        android:entryValues="@array/updateFileFormat"
                        android:dialogTitle="File Format" />
                <ListPreference
                        android:title="Video Resolution"
                        android:summary="Set the Video Resolution"
                        android:key="ResolutionPref"
                        android:dialogTitle="Video Resolution" />
        </PreferenceCategory>
</PreferenceScreen>

-- 
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

Reply via email to