{"id":13649,"date":"2020-01-21T17:52:49","date_gmt":"2020-01-21T17:52:49","guid":{"rendered":"https:\/\/ittutorial.org\/?p=13649"},"modified":"2020-01-23T13:15:34","modified_gmt":"2020-01-23T13:15:34","slug":"android-programming-9-switching-between-application-pages","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/android-programming-9-switching-between-application-pages\/","title":{"rendered":"Android Programming -9 Switching Between Application Pages"},"content":{"rendered":"<p style=\"margin-top: 0pt;margin-bottom: 11pt;font-family: Calibri\"><span style=\"font-size: 11.25pt;color: #444444;background: white\">Hi guys in this tutorial <\/span><span style=\"font-size: 11.0pt\">we will coding switching that between application page<\/span><span style=\"font-size: 11.25pt;color: #444444;background: white\">.<\/span><\/p>\n<p style=\"margin-top: 0pt;margin-bottom: 11pt;font-family: Calibri\"><span style=\"font-size: 11.25pt;color: #444444;background: white\">In my previous tutorial, I talked about the <\/span><span style=\"font-size: 11.0pt\">created new java and xml page<\/span><span style=\"font-size: 11.25pt;color: #444444;background: white\">. If you have not read it yet, I recommend you read it first.<\/span><\/p>\n<p><a href=\"https:\/\/ittutorial.org\/android-programming-8-create-new-app-page\/\">https:\/\/ittutorial.org\/android-programming-8-create-new-app-page\/<\/a><\/p>\n<pre>package com.example.mac.makale;\r\n\r\nimport android.content.Intent;\r\nimport android.support.v7.app.AppCompatActivity;\r\nimport android.os.Bundle;\r\nimport android.util.Log;\r\nimport android.view.View;\r\nimport android.widget.Button;\r\nimport android.widget.EditText;\r\nimport android.widget.TextView;\r\n\r\npublic class MainActivity extends AppCompatActivity {\r\nEditText kullanici_adi,sifre;\r\nButton login;\r\nTextView mesaj;\r\n\u00a0\u00a0\u00a0 @Override\r\n\u00a0\u00a0\u00a0 protected void onCreate(Bundle savedInstanceState) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 super.onCreate(savedInstanceState);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 setContentView(R.layout.activity_main);\r\n\r\nkullanici_adi=(EditText)findviewbyid(R.id.user);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sifre=(EditText)findviewbyid(R.id.password);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 login=(Buton)findviewbyid(R.id.login);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 mesaj=(TextView)findviewbyid(R.id.text);\r\n\r\nlogin.setOnClickListener(new View.OnClickListener() {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 @Override\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public void onClick(View v) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (kullanici_adi.getText()==\"kubrahebes\" &amp;&amp; sifre.getText()==\"12345\") {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Intent yeni_sayfa =new Intent(MainActivity.this, Anasayfa.Activity);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 start activity(yeni_sayfa);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 mesaj.setText(\"Ba\u015far\u0131s\u0131z Giri\u015f !!!\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 });\r\n\u00a0\u00a0\u00a0 }\r\n}<\/pre>\n<p style=\"margin: 0in;font-family: Calibri;font-size: 11.0pt\">If we examine our example;<\/p>\n<p style=\"margin: 0in;font-family: Calibri;font-size: 11.0pt\">We have already mentioned this example in the previous article. Today we&#8217;re going to go over it and take our existing code a step further. We will redirect users to the new page with the correct username and password. Users who entered their username and password incorrectly will remain on the same page and will show the error message.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin: 0in;font-family: Calibri;font-size: 11.0pt\">if we examine coding step by step ;<\/p>\n<p style=\"margin: 0in;font-family: Calibri;font-size: 11.0pt\">First of all we define the global variables that we used component which on xml page. Then we use findviewbyid method for each component. we write buton setonclick function for get user action. After that we check variable. if the users enter the right username and password, they will going to the main screen. We will made this action with the intent class. we must create intent class&#8217;s object with 2 parameter for using this. First parameter for available screen information, the second parameter is the page to go to.<\/p>\n<p style=\"margin: 0in;font-family: Calibri;font-size: 11.0pt\">After creating an object from intent class, We give startActivity as a parameter. In this way, the intent variable that we have created is activated according to the conditions we have mentioned. And it will redirect the user to the next page with the correct username and password.<\/p>\n<p style=\"margin: 0in;font-family: Calibri;font-size: 9.0pt;color: #595959\">\n","protected":false},"excerpt":{"rendered":"<p>Hi guys in this tutorial we will coding switching that between application page. In my previous tutorial, I talked about the created new java and xml page. If you have not read it yet, I recommend you read it first. https:\/\/ittutorial.org\/android-programming-8-create-new-app-page\/ package com.example.mac.makale; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; &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-13649","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\/13649","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=13649"}],"version-history":[{"count":2,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/13649\/revisions"}],"predecessor-version":[{"id":13654,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/13649\/revisions\/13654"}],"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=13649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=13649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=13649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}