如何自定义的Andr​​oid VideoView错误对话 [英] How to customize android VideoView Error Dialogue

查看:238
本文介绍了如何自定义的Andr​​oid VideoView错误对话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用我想视频流。在情况下,如果手机不能播放视频 VideoView 显示dilogue这样
我想要什么,如果定制这一对话,并插入两个按钮之一,下载此视频和一个尝试播放低质量视频。
目前已经在 onErrorLitener VideoView 的我显示对话用户,但以这种方式与我的对话 VideoView自己对话也显示在屏幕上,我不想要的。

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 buttons one to download this video and one to try to play an Low Quality video. right now in onErrorLitener of VideoView i am showing dialogue to user but in this way with my dialogue VideoView own dialogue also show on screen which i don't want.

如果我不能自定义 VideoView 错误的对话我可以让它不要在屏幕上显示

If i cant customize VideoView Error dialogue can i make it dont show on screen

推荐答案

我解决我的问题@AkashG把你的code在MediaPlay.setOnErrorListener()

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() {

            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub

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

            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub

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

这篇关于如何自定义的Andr​​oid VideoView错误对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆