{"id":13171,"date":"2019-12-03T20:16:35","date_gmt":"2019-12-03T20:16:35","guid":{"rendered":"https:\/\/ittutorial.org\/?p=13171"},"modified":"2020-01-16T08:21:59","modified_gmt":"2020-01-16T08:21:59","slug":"android-programming-6-introduction-to-java-programming","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/android-programming-6-introduction-to-java-programming\/","title":{"rendered":"Android Programming-6 Introduction to Java programming"},"content":{"rendered":"<p>Hi guys in this tutorial we will start to java programming.<\/p>\n<p>In my previous tutorial, I talked about the imageview components. If you have not read it yet, I recommend you read it first.<\/p>\n<p><a href=\"https:\/\/ittutorial.org\/android-programming-5-imageview-components\/\">https:\/\/ittutorial.org\/android-programming-5-imageview-components\/<\/a><\/p>\n<p>With the xml components that we have learned , we can design and code applications in many different scenarios. So we will now examine the Java code on the back of these components.<\/p>\n<pre>package com.example.teka.icim_rahat;\r\nimport android.app.Activity;\r\nimport android.view.View;\r\nimport android.widget.Button;\r\nimport android.widget.EditText;\r\nimport android.widget.ImageView;\r\nimport android.widget.Toast;\r\n\r\npublic class MainActivity extends AppCompatActivity {\r\n\r\nEditText kullanici_adi, sifre;\r\nButton gris;\r\n\r\n\r\n@Override\r\nprotected void onCreate(Bundle savedInstanceState) {\r\nsuper.onCreate(savedInstanceState);\r\nsetContentView(R.layout.activity_main);\r\n\r\n\/\/tan\u0131mlamalar\r\nkullanici_adi= (EditText) findViewById(R.id.kullanici);\r\nsifre = (EditText) findViewById(R.id.sifre);\r\ngris = (Button) findViewById(R.id.gris);\r\n\r\n<\/pre>\n<pre> \/\/ gri\u015f buttonuna t\u0131klan\u0131nca\r\n                gris.setOnClickListener(new View.OnClickListener() {\r\n                    @Override\r\n                    public void onClick(View v) {\r\n                        Toast.makeText(MainActivity.this, \"Giri\u015f Butonuna T\u0131klad\u0131n\u0131z\" , Toast.LENGTH_SHORT).show();<\/pre>\n<p>If we examine our example;<\/p>\n<p>First of all we need to import all libraries which we will use.\u00a0After import we define the MainActivity class.\u00a0We designed and coded xml application files to be displayed on the phone screen\u00a0we need an Activity class so\u00a0MainActivity class is too important.\u00a0Activity class have specific functions.\u00a0The most important of these is the onCreate function.\u00a0This function works when the activity class is created.<\/p>\n<p>When we write code, we need to know these functions very well and write our codes into the function we need accordingly.\u00a0Otherwise, our application will not work correctly.\u00a0We will examine these functions in more detail in our next tutorial.<\/p>\n<p>Before defining the Oncreate function, we define our global variables that we will use in the application.\u00a0If you remember when coding xml, all the components were defined id.\u00a0With the findviewbyid function of java codes, we assign values to global variables.<\/p>\n<p>To activate the click feature of the button component, we create the setOnClickListener function of the button.\u00a0In this function, we need to write the codes of the events that we want to be clicked on the button.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi guys in this tutorial we will start to java programming. In my previous tutorial, I talked about the imageview components. If you have not read it yet, I recommend you read it first. https:\/\/ittutorial.org\/android-programming-5-imageview-components\/ With the xml components that we have learned , we can design and code applications in many different scenarios. So &hellip;<\/p>\n","protected":false},"author":44,"featured_media":8094,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[7017,7011,7007,7005,7015,4746,7009,7008,7010,7024,3319,7021,7026,7016,7022,7025,7018,7019,7020,7006,7014,7023,7012,7013],"class_list":["post-13171","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-android","tag-android-app-development","tag-android-app-development-software","tag-android-button-color-xml","tag-android-coding","tag-android-development-basics","tag-android-programming","tag-android-programming-language","tag-android-programming-tutorial","tag-android-programming-with-java","tag-android-project","tag-android-studio","tag-android-studio-basic-example","tag-android-studio-basic-projects","tag-android-studio-first-app","tag-android-studio-lessons","tag-android-studio-projects","tag-android-studio-tutorial","tag-android-studio-tutorial-for-beginners","tag-android-studio-tutorial-point","tag-android-xml-coding","tag-create-mobile-app-without-coding","tag-java-android-developer","tag-mobil-app-maker","tag-mobile-application-make"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/04\/featured-860x280.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/13171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/users\/44"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=13171"}],"version-history":[{"count":3,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/13171\/revisions"}],"predecessor-version":[{"id":13657,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/13171\/revisions\/13657"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/8094"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=13171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=13171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=13171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}