d. Locate codes to open the new screen.
A new screen may be initiated from clicking a button in previous screen, a clicking at menu item, or any other alternative. in this example we use the first one. Clicking a button in the first screen to open a new screen. For this purpose, button onClick Method has been modified to do this. below is the code how we set the button: Button btnEdu = (Button)findViewById(R.id.btnEdu); public void onClick(View arg0) { // TODO Auto-generated method stub } }); The code bold (ed) is for starting a new screen. firstly, instantiate aIntent class with parameters. one of its parameter is a class to handle the new screen ( EducationData.class ). and there is a command to begin starting the new screen. it is startSubActivity(). startSubActivity() is a method to start the screen, with first parameter is an intent, and the second is a result code request from the new screen, when the new screen is closed. On this example we pass -1 value as a second parameter denote that we have no request code resulted from this screen. In the next example we will use this. e. Compile and Run the code First Screen Second Screen: A New Screen Ok, good luck, and have a nice try! Was this information helpfull ? |