我正在使用Tablayout,并且在TabLayout的TextView中使用了个性化的警报,我想在其中播放视频。 上传视频时出现错误,我收到警报无法播放该视频。
视频的格式为mp4
我认为错误是正在加载视频或找到了视频
public class MasaE_Male extends Fragment {
TextView Piernas, Pecho, Hombros, Espalda, Abdominales, p1, num1;
ImageView ivp1;
VideoView vp1;
ViewFlipper vf1;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view= inflater.inflate(R.layout.masae_male,container,false);
Piernas=view.findViewById(R.id.Piernas);
Pecho=view.findViewById(R.id.Pecho);
Hombros=view.findViewById(R.id.Hombros);
Espalda=view.findViewById(R.id.Espalda);
Abdominales=view.findViewById(R.id.Abdominales);
Piernas.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder BPiernas= new AlertDialog.Builder(getContext());
View mView= getLayoutInflater().inflate(R.layout.piernas,null);
BPiernas.setView(mView);
final AlertDialog dialog =BPiernas.create();
dialog.show();
vp1=mView.findViewById(R.id.VV1);
ivp1=mView.findViewById(R.id.IVp1);
p1=mView.findViewById(R.id.textp1);
num1=mView.findViewById(R.id.nump1);
vf1=mView.findViewById(R.id.VFp1);
String VideoPath= "android.resource://com.example.stark.finalp.Male" + R.raw.scb;
Uri uri = Uri.parse(VideoPath);
vp1.setVideoURI(uri);
MediaController MD= new MediaController(getActivity());
vp1.setMediaController(MD);
MD.setAnchorView(vp1);
return view;
}
}