Kenapa hny announce2 tak ada yg nongol2 kecuali htc...eom

by Suyandi Liyis » Tue, 20 Oct 2009 20:20:43 GMT


Sponsored Links
 --~--~---------~--~----~------------~-------~--~----~
Google Groups "
-~----------~----~----~----~------~----~------~--~---



Other Threads

1. error on MediaPlayer

Hi all,
    I am writing a  player for stream video, here is the player's code
(just copy from apidemo):

package com.android.playerdemo;

import com.android.playerdemo.R;


import android.app.Activity;
import android.graphics.PixelFormat;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnBufferingUpdateListener;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnErrorListener;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;


public class MediaPlayerDemo_Video extends Activity implements
        OnBufferingUpdateListener,
OnCompletionListener,OnErrorListener,
        MediaPlayer.OnPreparedListener, SurfaceHolder.Callback {

    private static final String TAG = "MediaPlayerDemo";
    private int mVideoWidth;
    private int mVideoHeight;
    private MediaPlayer mMediaPlayer;
    private SurfaceView mPreview;
    private SurfaceHolder holder;
    private String path;
    private Bundle extras;
    private static final String MEDIA = "media";
    private static final int LOCAL_AUDIO = 1;
    private static final int STREAM_AUDIO = 2;
    private static final int RESOURCES_AUDIO = 3;
    private static final int LOCAL_VIDEO = 4;
    private static final int STREAM_VIDEO = 5;

    /**
     *
     * Called when the activity is first created.
     */
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.mediaplayer_2);
        mPreview = (SurfaceView) findViewById(R.id.surface);
        holder = mPreview.getHolder();
        holder.addCallback(this);
        holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        extras = getIntent().getExtras();

    }

    private void playVideo(Integer Media) {
        try {

            switch (Media) {
                case LOCAL_VIDEO:
                    /*
                     * TODO: Set the path variable to a local media
file path.
                     */
                    path = "";
                    if (path == "") {
                        // Tell the user to provide a media file URL.
                        Toast
                                .makeText(
                                        MediaPlayerDemo_Video.this,
                                        "Please edit
MediaPlayerDemo_Video Activity, "
                                                + "and set the path
variable to your media file path."
                                                + " Your media file
must be stored on sdcard.",
                                        Toast.LENGTH_LONG).show();

                    }
                    break;
                case STREAM_VIDEO:
                    /*
                     * TODO: Set path variable to progressive
streamable mp4 or
                     * 3gpp format URL. Http protocol should be used.
                     * Mediaplayer can only play "progressive
streamable
                     * contents" which basically means: 1. the movie
atom has to
                     * precede all the media data atoms. 2. The clip
has to be
                     * reasonably interleaved.
                     *
                     */
                    path = "http://www.test.com/2102029.mp4";
                    if (path == "") {
                        // Tell the user to provide a media file URL.
                        Toast
                                .makeText(
                                        MediaPlayerDemo_Video.this,
                                        "Please edit
MediaPlayerDemo_Video Activity,"
                                                + " and set the path
variable to your media file URL.",
                                        Toast.LENGTH_LONG).show();

                    }

                    break;


            }

            // Create a new media player and set the listeners
            mMediaPlayer = new MediaPlayer();
            mMediaPlayer.setDataSource(path);
            mMediaPlayer.setDisplay(holder);
            mMediaPlayer.prepareAsync();
            mMediaPlayer.setOnBufferingUpdateListener(this);
            mMediaPlayer.setOnCompletionListener(this);
            mMediaPlayer.setOnPreparedListener(this);
            mMediaPlayer.setAudioStreamType
(AudioManager.STREAM_MUSIC);


        } catch (Exception e) {
            Log.e(TAG, "error: " + e.getMessage(), e);
        }
    }

    public void onBufferingUpdate(MediaPlayer arg0, int percent) {
        Log.d(TAG, "onBufferingUpdate percent:" + percent);

    }

    public void onCompletion(MediaPlayer arg0) {
        Log.d(TAG, "onCompletion called");
    }

    public boolean  onError(MediaPlayer mediaplayer, int what, int
extra) {
        Log.d(TAG,"-------error found:"+what);
        return true;
    }

    public void onPrepared(MediaPlayer mediaplayer) {
        Log.d(TAG, "onPrepared called");
        mVideoWidth = mMediaPlayer.getVideoWidth();
        mVideoHeight = mMediaPlayer.getVideoHeight();
        if (mVideoWidth != 0 && mVideoHeight != 0) {
            holder.setFixedSize(mVideoWidth, mVideoHeight);
//            mMediaPlayer.start();
        }
        mMediaPlayer.start();
    }

    public void surfaceChanged(SurfaceHolder surfaceholder, int i, int
j, int k) {
        Log.d(TAG, "surfaceChanged called");

    }

    public void surfaceDestroyed(SurfaceHolder surfaceholder) {
        Log.d(TAG, "surfaceDestroyed called");
    }


    public void surfaceCreated(SurfaceHolder holder) {
        // TODO Auto-generated method stub
        Log.d(TAG, "surfaceCreated called");
        playVideo(extras.getInt(MEDIA));


    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        // TODO Auto-generated method stub
        if (mMediaPlayer != null) {
            mMediaPlayer.release();
            mMediaPlayer = null;
        }

    }

}

---------------------------------------------

However, every time I start play it returns Error (-1, 0) on logcat,
can any body give me some suggestions ?

Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~

2. accessing information from browser, in an application

I am editing the pre-existing zxing Barcode Reader code so it can
voice itself for blind users.
I know how to use Text to speech in the app.
Right now I am at the step where after the barcode is read, it then
opens a webpage in the android browser - it sends the product number
to google. What i want to do is be able to read from that webpage-
whether its from the DOM or just being able to get the source for the
page.

Here is where the intent is launched:

    Uri uri = Uri.parse("http://www.google." +
LocaleManager.getCountryTLD() + "/products?q=" + upc);
    launchIntent(new Intent(Intent.ACTION_VIEW, uri));

Do I need to use android.webkit somehow? Or is that just for making my
own webpages in the browser?
No clue how to proceed right now. Thanks, any help is very appreciated

Shani

--~--~---------~--~----~------------~-------~--~----~

3. open gl es2.0

4. emulator on linux in offline mode !!

5. com.google.wireless.gdata

6. Developer Challenge 2

7. why returns "Couldn't get connection factory client" when access gmap on emulator