I’m creating one application in Android. It has one layout named main.xml
main.xml:
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/splashscreen" />
mainActivity.java:
public class MainActivity extends WebViewActivity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int height = displaymetrics.heightPixels;
int wwidth = displaymetrics.widthPixels;
setContentView(R.layout.main);
final ImageView imgview=(ImageView)findViewById(R.id.imageView1);
imgview.setLayoutParams(new LinearLayout.LayoutParams(wwidth,
height, 0.0F));
int DELAY = 6000;
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run()
{
WebViewActivity.loadurl("file:///android_asset/www/index.htm");
}
}, DELAY);
}
}
Initially want to load main.xml, after 6 seconds I want to load url in webview. WebViewActivity has codes for loading…
I have followed the above coding…
Result: Initially main.xml is loading perfectly… but after 6 seconds loadurl method is called but main.xml is not removed. How to do this?
Note: WebViewActivity has layout with webview.
I have followed the below coding… I did not used main.xml page… directly loaded in webview… Working good 🙂