Be patient..... we are fetching your source code.
Objective
Main objective of this tutorial is to help you to view HTML page in the Web view.
You will get Final Output:
Step 1 Create Project
First create new Android Project with the following Layout.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|top"
android:orientation="vertical"
android:padding="5dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="HTML in WEB View"
tools:context=".MainActivity" />
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Step 2 Add HTML page into assets folder
Now add your HTML Page into assets folder in your Project.
Step 3 Define WebView
Next step is to define Web View into your Main Activity and load your saved HTML page into your Web View.
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// define webview
WebView webview = (WebView) findViewById(R.id.webView);
webview.setHorizontalScrollBarEnabled(false);
webview.loadUrl("file:///android_asset/theappguruz.html");
}
}
I hope you enjoy this tutorial and it would be helpful to you.
Got an Idea of Android App Development? What are you still waiting for? Contact us now and see the Idea live soon. Our company has been named as one of the best Android App Development Company in India.
An entrepreneur who has founded 2 flourishing software firms in 7 years, Tejas is keen to understand everything about gaming - from the business dynamics to awesome designs to gamer psychology. As the founder-CEO of a company that has released some very successful games, he knows a thing or two about gaming. He shares his knowledge through blogs and talks that he gets invited to.
Android - Location using GPS
Android - Getting Battery Details