public class MyPlayer extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(akki.player.R.layout.main);
boolean flashInstalled = false;
try {
PackageManager pm = getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
if (ai != null)
flashInstalled = true;
} catch (NameNotFoundException e) {
flashInstalled = false;
}
if(flashInstalled){
WebView browser=(WebView) findViewById(akki.player.R.id.webView1);
//
browser.getSettings().setJavaScriptEnabled(true);
;
browser.getSettings().getPluginsEnabled();
browser.getSettings().setAllowFileAccess(true);
browser.getSettings().setAppCacheEnabled(false);
browser.loadUrl("http://sound30.mp3pk.com/indian/dabangg2/[Songs.PK]%2004%20-%20Saanson%20Ne%20-%20Dabangg%202.mp3");
Toast.makeText(this, "Flash Player installed ....", 1).show();
}
else
{
Toast.makeText(this, "Install Flash Player First ..", 1).show();
}
}
这是我从网站播放歌曲的代码。但它说网页不可用。
什么是可能的错误。?提前谢谢。我也有一个将播放器链接到网站的 player.html 文件。代码工作正常,因为它要求安装代码中提到的 Flash 播放器,但是当我启动应用程序时,它只是不显示网页。相反,它说网页不可用。