I want to capture the click event on VideoView. I followed the same
steps with Button. However, it does not work. Could you give me a
recommendation? This is my code.

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

        VideoView video_up = (VideoView) findViewById(R.id.video_up);

        View continueButton = findViewById(R.id.continue_button);
        continueButton.setOnClickListener(this);

        video_up.setVideoPath("/data/3.3gp");
        video_up.start();

        video_up.setOnClickListener(this);
    }

    // ...
    public void onClick(View v) {

        Log.d("ID_EVENT_TRUONG",Integer.toString(v.getId()));

       switch (v.getId()) {
        case R.id.continue_button:
           new AlertDialog.Builder(this)
           .setTitle("BrightHub Alert!")
           .setMessage("Google Android How-to guides in the Bright Hub")
           .setNeutralButton("Ok",
           new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog,
           int which) {
           }
           }).show();
           break;
        // More buttons go here (if any) ...
        case R.id.video_up:
                   new AlertDialog.Builder(this)
           .setTitle("BrightHub Alert!")
           .setMessage("Google Android How-to guides in the Bright Hub")
           .setNeutralButton("Ok",
           new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog,
           int which) {
           }
           }).show();

           break;
       }
    }

 }

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