

Now after clicking the button in the first page the second page is opened. package import import import import import android.os.Bundle public class MainActivity extends AppCompatActivity Assuming you have completed a previous video 'Android Studio 2.2.3 : How to Start Programming -1'.In this video, we process button click, and display how man. We have to set an onClickListner to the element which we are going to use to navigate between pages (in this case button). To navigate from activity_main.xml to activity_main2.xml we have to write the code in MainActivity.java file.


This is a user-wide build cache that is now turned on by default with Android Studio 2.3. (We can navigate between pages using pretty much every element, not necessarily button).ĭon’t forget to give id’s to the buttons which we will need in MainActivity.java file. Build Cache: Introduced but disabled by default in Android Studio 2.2, Build Cache is an underlying build optimization for faster builds in Android Studio.By caching exploded AARs and pre-dexed external libraries, the new build cached leads to faster clean builds. In this video we will learn, how to open a new Activity from a Button click. We can do that by adding few lines of code.įor that open android studio and create a new project.Ĭreate new project > Empty Activity >Next > Enter name of the project > FinishĬreate two activies that we can navigate in using a button. For this we will create a new Intent and pass it to the startActivity method.Exa. After clicking on the play button new window will open in that select Android Virtual Device (AVD) and click OK like as shown below. Switching between pages in an application is one of the basic features of an app. To run android applications we need to click on Run button or press Shift + F10 like as shown below.
