Re: [WTA] Mau dowload pocket legends failed

by david » Wed, 24 Nov 2010 10:00:58 GMT


Sponsored Links
 ya mas, di zte blade saya sampe ga sempat maen gara2 pake internet
indosat entah kenapa suka putus wkt update.

On Nov 24, 7:36am, Muh Fitrah <fitrah...@gmail.com> wrote:

--
===============
"



Other Threads

1. Sorry Cannot Play this Video

Hi!
trying to play video in a Emulator, "error" Sorry this Video cannot be
played" , please tell me what i am doing or not doing..

TIA

Cheers

package info.shouraig.com;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.widget.MediaController;
import android.widget.VideoView;

public class XSO5 extends Activity {
        private static final String RTSP ="http://www.youtube.com/watch?
v=8bmWwxixT0Y";

        VideoView videoXSO5;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

      //***VideoView to video element inside Multimedia.xml file

       VideoView videoView =(VideoView)findViewById(R.id.videoXSO5);
       Log.v("videoXSO5", "***Video to Play:: " + RTSP);
       MediaController mc = new MediaController(this);
       mc.setAnchorView(videoView);
       Uri video = Uri.parse(RTSP);
       videoView.setMediaController(mc);
       videoView.setVideoURI(video);
       videoView.start();

-- 

2. Flickering camera preview in SurfaceView

Hi,

I have an Dialog with a custom view. This view has a SurfaceView which
shows a camera preview. However, the preview is very flickering.

The taken photo does not contain flicker. It looks as it should.

Why does the preview flicker? (The camera does work :-) )

This is my custom view:
---------

public class CameraView extends LinearLayout implements
SurfaceHolder.Callback, OnClickListener, PictureCallback {

        private SurfaceView surfView;
        private SurfaceHolder previewHolder;
        private Camera camera;
        OnProfilePictureTakenListener onProfilePictureTakenListener = null;

        public CameraView(Context context) {
                super(context);
                setOnClickListener(this);
                surfView = new SurfaceView(getContext());
                addView(surfView);
                previewHolder = surfView.getHolder();
                previewHolder.addCallback(this);
                previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int
width,
                        int height) {
                Camera.Parameters parameters = camera.getParameters();
                parameters.setPreviewSize(width, height);
                parameters.setPictureFormat(PixelFormat.JPEG);
                camera.setParameters(parameters);
                camera.startPreview();
        }

        @Override
        public void surfaceCreated(SurfaceHolder holder) {
                camera = Camera.open();
                try {
                        camera.setPreviewDisplay(previewHolder);
                } catch(Throwable t) {
                        Log.e("surfaceCallback", "Exception", t);
                        Toast.makeText(getContext(), t.getMessage(), 
Toast.LENGTH_LONG).show
();
                }
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder holder) {
                camera.stopPreview();
                camera.release();
                camera = null;
        }

        @Override
        public void onClick(View v) {
                takePicture();
        }

        private void takePicture() {
                camera.stopPreview();
                camera.takePicture(null, null, this);
        }

        @Override
        public void onPictureTaken(byte[] data, Camera camera) {
                new SavePhotoTask().execute(data);
                camera.startPreview();
        }

        public void setOnPictureTakenListener(OnProfilePictureTakenListener
lis) {
                onProfilePictureTakenListener = lis;
        }

        class SavePhotoTask extends AsyncTask<byte[], String, String> {

                @Override
                protected String doInBackground(byte[]... jpeg) {
                        File photo = new 
File(Environment.getExternalStorageDirectory(),
"/.addMePictures/" + System.currentTimeMillis());
                        if(photo.exists()) {
                                photo.delete();
                        }
                        try {
                                FileOutputStream fos = new 
FileOutputStream(photo.getPath());
                                fos.write(jpeg[0]);
                                fos.close();
                        } catch(IOException e) {
                                e.printStackTrace();
                        }
                        if(onProfilePictureTakenListener != null) {
                                
onProfilePictureTakenListener.onProfilePictureTaken(photo);
                        }
                        return null;
                }

        }

        public interface OnProfilePictureTakenListener {
                public abstract void onProfilePictureTaken(File imgFile);
        }

}


--------

Thank you very much!

//Kaloer

-- 

3. Market T Mobile Carrier Billing

4. Getting hold of PreferenceActivity Views from the xml file

5. Updating my calendar

6. Cannot build Android source in Ubuntu

7. Your Best App?