问题
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.
If i cant customize VideoView
Error dialogue can i make it dont show on screen

回答1:
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();
Just write code u wanna perform on download/play button click.
回答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() {
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();
来源:https://stackoverflow.com/questions/11407108/how-to-customize-android-videoview-error-dialogue