Skip to content Skip to sidebar Skip to footer

How To Customize Android Videoview Error Dialogue

In my application i want to stream video. In case if mobile can not play that video VideoView shows dilogue like this what i want if to customize this dialogue and insert two butto

Solution 1:

        AlertDialog.Builder builder=new Builder(YourActivityName.this);
        builder.setTitle("Video");
        builder.setMessage("Message you want to pass");
        builder.setPositiveButton("Download", new DialogInterface.OnClickListener() {

            publicvoidonClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub

            }
        });
        builder.setNegativeButton("Play", new DialogInterface.OnClickListener() {

            publicvoidonClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub

            }
        });
        builder.create();
        builder.show();

Just write code u wanna perform on download/play button click.

Solution 2:

I solved my problem @AkashG by putting your code in MediaPlay.setOnErrorListener()

AlertDialog.Builder builder=new Builder(YourActivityName.this);
        builder.setTitle("Video");
        builder.setMessage("Message you want to pass");
        builder.setPositiveButton("Download", new DialogInterface.OnClickListener() {

            publicvoidonClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub

            }
        });
        builder.setNegativeButton("Play", new DialogInterface.OnClickListener() {

            publicvoidonClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub

            }
        });
        builder.create();
        builder.show();

Post a Comment for "How To Customize Android Videoview Error Dialogue"