-3

i am new to android. i want to show full screen image on Activity like a layer, When i click on button i want to call new activity but before activity i want to show an image(full screen)on that activity for 5 seconds.like ads. how can i do ? please help me. thank you in advance.

here is my xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/black_ng2">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/imageViewForAd"
    android:adjustViewBounds="true"
    android:src="@drawable/splash_screen"/>


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="@dimen/_15sdp"
    android:layout_marginRight="@dimen/_15sdp"
    android:layout_marginTop="@dimen/_15sdp"
    android:layout_marginBottom="@dimen/_15sdp"
    android:padding="@dimen/_10sdp"
    android:id="@+id/cardLayout"
    android:layout_centerVertical="true"
    android:layout_alignParentEnd="true"
    android:layout_marginEnd="10dp"
    android:layout_alignParentRight="true">

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/_15sdp"
        android:layout_marginBottom="@dimen/_15sdp"
        android:id="@+id/textInputLayoutPooja"
        android:textColorHint="@color/colorwhite">
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="phone"
            android:hint="Date Of Mandal Pooja"
            android:id="@+id/txtDateOfPooja"
            android:drawableLeft="@drawable/calender"
            android:textSize="@dimen/_15sdp"
            android:textColor="@color/colorwhite"/>

    </android.support.design.widget.TextInputLayout>
    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/_15sdp"
        android:layout_marginBottom="@dimen/_15sdp"
        android:id="@+id/textInputLayoutYaatra"
        android:layout_below="@+id/textInputLayoutPooja"
        android:textColorHint="@color/colorwhite">
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Date Of Yaatra"
            android:id="@+id/txtDateOfYaatra"
            android:textSize="@dimen/_15sdp"
            android:drawableLeft="@drawable/calender"
            android:textColor="@color/colorwhite"/>

    </android.support.design.widget.TextInputLayout>
    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/_15sdp"
        android:layout_marginBottom="@dimen/_15sdp"
        android:id="@+id/textInputLayoutDarshan"
        android:layout_below="@+id/textInputLayoutYaatra"
        android:textColorHint="@color/colorwhite">
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Date Of Darshan"
            android:id="@+id/txtDateOfDarshan"
            android:textSize="@dimen/_15sdp"
            android:drawableLeft="@drawable/calender"
            android:textColor="@color/colorwhite"/>

    </android.support.design.widget.TextInputLayout>

    <Button
        android:layout_width="@dimen/_80sdp"
        android:layout_height="@dimen/_40sdp"
        android:text="Add Yaatra"
        android:id="@+id/btnAddYaatra"
        android:textSize="@dimen/_15sdp"
        android:layout_below="@+id/textInputLayoutDarshan"
        android:background="@color/btncolor"
        android:textColor="@color/colorwhite"
        android:layout_centerHorizontal="true" />



</RelativeLayout>

Pratik
  • 23
  • 1
  • 7
  • If you want to show ad then go through the documentation of AdMob in android. – Rishabh Mahatha Dec 16 '16 at 12:46
  • http://devdeeds.com/how-to-create-a-5-seconds-splash-screen-in-android/ Go through this document – Athul Dec 16 '16 at 12:50
  • I think you are looking for Splash Screen. However you should keep in mind that developer mostly use Splash screen to download background data. Unnecessary use of splash screen might affect UX. – Kunu Dec 16 '16 at 12:58

1 Answers1

0

Write this in your onCreate() of activity.

 Handler handlers = new Handler();
        handlers.postDelayed(new Runnable() {
            @Override
            public void run() {
                ImageView splash=(ImageView)findViewById(R.id.imageViewForAd)
                splash.setVisibility(View.GONE);
            }
        }, 5000);

Hope it will help u.

Sachin Varma
  • 2,175
  • 4
  • 28
  • 39