Reputation: 403
I have a website project that I created using css/html/js and it's in a folder. It has several videos embedded into pages and as result the whole project weights around 700 Mb. I created it for a tablet so now I'm seeking the way to open it on an android tablet. I tried just copying the folder and using tablet Chrome to open index.html, but it displays some text instead. I also tried using PhoneGap to build an app, but it doesn't accept large projects. So is there really any way to achieve what I need? Turning it into an app would be preferred, but if there is any way just to open it in a browser, it would be helpful too. Where do I look and where do I start?
Upvotes: 0
Views: 438
Reputation: 1641
You should keep your media files inside a directory on the sdcard. You can always access those media files present on the sdcard from your javacript code. In this way, you can easily create the apk by including html/css/js and excluding the video files using the phonegap or cordova.
Upvotes: 1
Reputation: 1
In xml file,
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
Class file
public class WebViewActivity extends Activity { private WebView webView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
webView = (WebView) findViewById(R.id.webView1);
webView.setWebViewClient(new WebClient());
webView.getSettings().setJavaScriptEnabled(true);
String url = "www.google.com"; // Give here hosted project url
webView.loadUrl(url);
}
public class WebClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
// This is used for finished on particular url
if (url.contains("http://www.google.com/")) {
Intent intent = new Intent();
intent.putExtra("responseurl", url);
setResult(Activity.RESULT_OK, intent);
finish();
}
}
}
}
Upvotes: 0