我希望在视频加载视频之前有一个进度条。但我得到以下错误。我还添加了所有必要的导入。
我正在使用AIDE IN ANDROID
这是我的代码
public class MainActivity extends Activity{
ProgressBar progressBar = null;
VideoView videoView = null;
String videoUrl = "http://www.androidbegin.com/tutorial/AndroidCommercial.3gp";
Context context = null;
@Override
public void onCreate(Bundle iclic) {
super.onCreate(iclic);
context = null;
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
videoView = (VideoView) findViewById(R.id.videoview);
progressBar = (ProgressBar) findViewById(R.id.progressbar);
Uri videoUri = Uri.parse(videoUrl);
videoView.setVideoURI(videoUri);
videoView.start();
progressBar.setVisibility(View.VISIBLE);
videoView.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
// TODO Auto-generated method stub
mp.start();
mp.setOnVideoSizeChangedListener(new OnVideoSizeChangedListener() {
@Override
public void onVideoSizeChanged(MediaPlayer mp, int arg1,
int arg2) {
// TODO Auto-generated method stub
progressBar.setVisibility(View.GONE);
mp.start();
}
});
}
});
}
}
没有理解问题所在!
答案 0 :(得分:2)
试试这个,做得很完美
将[Code]
var
OptionPage: TInputOptionWizardPage;
procedure InitializeWizard();
begin
OptionPage :=
CreateInputOptionPage(
wpWelcome,
'Choose installation options', 'Who should this application be installed for?',
'Please select whether you wish to make this software available for all users ' +
'or just yourself.',
True, False);
OptionPage.Add('&Anyone who uses this computer');
OptionPage.Add('&Only for me');
if IsAdminLoggedOn then
begin
OptionPage.Values[0] := True;
end
else
begin
OptionPage.Values[1] := True;
OptionPage.CheckListBox.ItemEnabled[0] := False;
end;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = OptionPage.ID then
begin
if OptionPage.Values[1] then
begin
{ override the default installation to program files ({pf}) }
WizardForm.DirEdit.Text := ExpandConstant('{userappdata}\My Program')
end
else
begin
WizardForm.DirEdit.Text := ExpandConstant('{pf}\My Program');
end;
end;
Result := True;
end;
替换为new OnPreparedListener()
,将new MediaPlayer.OnPreparedListener()
替换为new OnVideoSizeChangedListener()