Use an Intent

Add onclick method on main java file and xml file.

res > layout > activity_main.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout
    xmlns:tools="http://chemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/tan_background"
    android:orientation="vertical"
    tools:context="com.example.android.miwok.MainActivity">
 
    <TextView
        android:id="@+id/numbers"
        style="@style/CategoryStyle"
        android:background="@color/category_numbers"
        android:text="Numbers"
        android:onClick="openNumberList" />
 
    <TextView
        android:id="@+id/family"
        style="@style/CategoryStyle"
        android:background="@color/category_family"
        android:text="Family Members" />
 
    <TextView
        android:id="@+id/colors"
        style="@style/CategoryStyle"
        android:background="@color/category_colors"
        android:text="Calors" />
 
    <TextView
        android:id="@+id/phrases"
        style="@style/CategoryStyle"
        android:background="@color/category_phrases"
        android:text="Phrases" />
 
</LinearLayout>

MainActivity.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.example.android.miwok;
 
import android.conent.Intent;
import android.support.v7.app.AppCompactActivity;
import android.os.Bundle;
import android.view.View;
 
public class MainActivity extends AppCompactActivity {
 
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
 
    public void openNumbersList(View view){
        //TODO: Write your code here!
        Intent i = new Intent(this, NumbersActivity.class);
        startActivity(i);
    }
}

android intent tutorial site
http://www.vogella.com/tutorials/AndroidIntent/article.html#usingintents_call