*****************************MainActivity.Java******************************************
public class MainActivity extends Activity {
WebView v1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
v1 = (WebView) findViewById(R.id.Wb1);
v1.getSettings().setJavaScriptEnabled(true);
v1.getSettings().setLoadWithOverviewMode(true);
v1.getSettings().setUseWideViewPort(true);
v1.loadUrl("file:///android_asset/ebook.epub");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
**************************activity_main.xml********************************************
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<WebView
android:id="@+id/Wb1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Download Source Code :Click Here
public class MainActivity extends Activity {
WebView v1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
v1 = (WebView) findViewById(R.id.Wb1);
v1.getSettings().setJavaScriptEnabled(true);
v1.getSettings().setLoadWithOverviewMode(true);
v1.getSettings().setUseWideViewPort(true);
v1.loadUrl("file:///android_asset/ebook.epub");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
**************************activity_main.xml********************************************
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<WebView
android:id="@+id/Wb1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Download Source Code :Click Here
Comments
Post a Comment