Skip to main content

Posts

Showing posts with the label webview

Load html file to WebView from assets in Android

Put the html file inside asset folder and use the code given below : public class MainActivity extends Activity { WebView myWebView; TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myWebView=(WebView) findViewById(R.id.webView1); myWebView.loadUrl("file:///android_asset/Noun.htm"); } Copy and download the code and try your self.

Fragmentation In Android

See more basics on Android along with interview questions Fragments are a portion of an Activity: Load a fragment Activity to call a fragment : public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } activity_main : <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <fragment android:id="@+id/titles" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" class="com.example.googlefragment.TitlesFragment"/> //calls the fragment </LinearLayout> TitlesFragment : ...