[英]Android App Iframe a site
I was trying to make android app for my radio station. 我试图为我的电台制作android应用。 I want when user will open the app the site will load automatically. 我希望用户何时打开应用程序,网站将自动加载。 I was following this tutorial but when I tried to run the app it's showing this error "Unfortunately,Tarab Radio stop work " Here is my activity_main.xml 我正在按照本教程进行操作,但是当我尝试运行该应用程序时,它显示此错误“不幸的是,Tarab Radio停止工作”,这是我的activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
& MainActivity.java &MainActivity.java
package com.jibon.tarabradio;
import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebView;
public class MainActivity extends Activity {
@SuppressLint("SetJavaScriptEnabled") @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webview;
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://hoicoimasti.com/radio/");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Any Idea where I did mistake. 任何想法我做错了。 Thanks in advance. 提前致谢。
put setContentView(R.layout.activity_main); 把setContentView(R.layout.activity_main); in your onCreate method. 在您的onCreate方法中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.