Forked from udacityandroid/onCreate method in MainActivity.java
Created
June 7, 2019 21:51
-
-
Save sherif-khalaf/9945a05f985feddcc07d10fcd2b6b8ed to your computer and use it in GitHub Desktop.
Use OnClickListeners for All Categories - onCreate method in MainActivity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Find the View that shows the numbers category | |
| TextView numbers = (TextView) findViewById(R.id.numbers); | |
| // Set a click listener on that View | |
| numbers.setOnClickListener(new View.OnClickListener() { | |
| // The code in this method will be executed when the numbers View is clicked on. | |
| @Override | |
| public void onClick(View view) { | |
| Intent numbersIntent = new Intent(MainActivity.this, NumbersActivity.class); | |
| startActivity(numbersIntent); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment