Android Programming-8 Create New App Page

Hi guys in this tutorial we will create  new java and xml page

In my previous tutorial, I started the java programming. If you have not read it yet, I recommend you read it first.

https://ittutorial.org/android-programming-7-java-programming/

 

As I mentioned in the previous tutorial, application screen consist of java and xml page,for this when we create a new screen we need definition xml and java page.For the create java class, right click the  com.example folder and select the new–> java class.

 

When we first define the class, the class is created as empty as above. we extend the AppCompatActivity class and define the oncreate function. In the oncreate method we must define SetContentView method. This method associate the java and xml page.

 

package com.example.mac.makale;

import android.os.Bundle;

public class YeniSayfaActivity extends AppCompatActivity{

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

}
}

 

Right click the  Layout folder and select the new –> layout.  We do not need any modify on the xml file. we can start writing code.

About Kübra Hebeş

Bilgisayar Mühendisi

Leave a Reply

Your email address will not be published. Required fields are marked *