How to add New Activity from Android GridView onItemClick?
<p>Check this image sample i have done it <a href="http://i.stack.imgur.com/vp21R.png" rel="nofollow">Material Design Gridview Image </a>
I have done the same <code>Material Design</code> for grid view <code>Activity</code> on my app, i like to add the <code>onItemClick</code> to new <code>Activity</code>,</p>

<p>I don't know how to do this , please give the brief explanation for the solution</p>

<p>res/layout/activity_main.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/android_coordinator_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;

    &lt;android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:id="@+id/appbar_layout"
        android:layout_height="@dimen/app_bar_height"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;

        &lt;android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar_android_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginStart="@dimen/expanded_toolbar_title_margin_start"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"&gt;

            &lt;ImageView
                android:id="@+id/image_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerInside"
                android:src="@drawable/code"
                app:layout_collapseMode="parallax"
                app:layout_collapseParallaxMultiplier="0.7" /&gt;

            &lt;android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /&gt;

        &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;

    &lt;/android.support.design.widget.AppBarLayout&gt;

    &lt;android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:id="@+id/nestedscrollview"
        android:layout_height="match_parent"
        android:fillViewport="true"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;

        &lt;LinearLayout
            android:id="@+id/linearLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"&gt;

            &lt;GridView
                android:id="@+id/grid"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:columnWidth="100dp"
                android:gravity="center"
                android:listSelector="#00000000"
                android:numColumns="auto_fit"
                android:stretchMode="columnWidth" /&gt;
        &lt;/LinearLayout&gt;
    &lt;/android.support.v4.widget.NestedScrollView&gt;

&lt;/android.support.design.widget.CoordinatorLayout&gt;
</code></pre>

<p>res/layout/gridview_custom_layout.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/android_gridview_custom_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="10dp"&gt;

    &lt;com.andexert.library.RippleView
        android:id="@+id/more"
        rv_centered="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        app:rv_color="#fff"
        app:rv_rippleDuration="200"&gt;

        &lt;LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/linearLayout"
            android:orientation="vertical"&gt;

            &lt;ImageView
                android:id="@+id/gridview_image"
                android:layout_width="80dp"
                android:layout_height="80dp"
                android:src="@mipmap/ic_launcher" /&gt;

            &lt;TextView
                android:id="@+id/gridview_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/grid_image"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:text="Grid View Item"
                android:textColor="#444"
                android:textSize="12sp"
                android:textStyle="bold" /&gt;
        &lt;/LinearLayout&gt;
    &lt;/com.andexert.library.RippleView&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>src/MainActivity.java</p>

<pre><code>import android.content.Context;
import android.os.Bundle;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.GridView;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    Toolbar toolbar;
    CollapsingToolbarLayout collapsingToolbarLayoutAndroid;
    CoordinatorLayout rootLayoutAndroid;
    GridView gridView;
    Context context;
    ArrayList arrayList;

    public static String[] gridViewStrings = {
            "Android",
            "Java",
            "GridView",
            "ListView",
            "Adapter",
            "Custom GridView",
            "Material",
            "XML",
            "Code",

    };
    public static int[] gridViewImages = {
            R.drawable.android_ic,
            R.drawable.android_ic,
            R.drawable.android_ic,
            R.drawable.android_ic,
            R.drawable.android_ic,
            R.drawable.android_ic,
            R.drawable.android_ic,
            R.drawable.android_ic,
            R.drawable.android_ic
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        gridView = (GridView) findViewById(R.id.grid);
        gridView.setAdapter(new CustomAndroidGridViewAdapter(this, gridViewStrings, gridViewImages));

        initInstances();
    }

    private void initInstances() {
        rootLayoutAndroid = (CoordinatorLayout) findViewById(R.id.android_coordinator_layout);
        collapsingToolbarLayoutAndroid = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar_android_layout);
        collapsingToolbarLayoutAndroid.setTitle("Material Grid");
    }

}
</code></pre>

<p>src/CustomAndroidGridViewAdapter.java</p>

<pre><code>import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * Created by HP on 5/11/2016.
 */

public class CustomAndroidGridViewAdapter extends BaseAdapter {
    private Context mContext;
    private final String[] string;
    private final int[] Imageid;

    public CustomAndroidGridViewAdapter(Context c,String[] string,int[] Imageid ) {
        mContext = c;
        this.Imageid = Imageid;
        this.string = string;
    }

    @Override
    public int getCount() {
        return string.length;
    }

    @Override
    public Object getItem(int p) {
        return null;
    }

    @Override
    public long getItemId(int p) {
        return 0;
    }

    @Override
    public View getView(int p, View convertView, ViewGroup parent) {
        View grid;
        LayoutInflater inflater = (LayoutInflater) mContext
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        if (convertView == null) {

            grid = new View(mContext);
            grid = inflater.inflate(R.layout.gridview_custom_layout, null);
            TextView textView = (TextView) grid.findViewById(R.id.gridview_text);
            ImageView imageView = (ImageView)grid.findViewById(R.id.gridview_image);
            textView.setText(string[p]);
            imageView.setImageResource(Imageid[p]);
        } else {
            grid = (View) convertView;
        }

        return grid;
    }
}
</code></pre>

<p>PLease give me the solution for call another Actvivty when mouse click on Image (Image 1, Image 2, etc) in Gridview this</p>