{"id":963,"date":"2023-09-22T14:26:22","date_gmt":"2023-09-22T06:26:22","guid":{"rendered":"https:\/\/swordofmorning.com\/?p=963"},"modified":"2025-10-09T13:55:19","modified_gmt":"2025-10-09T05:55:19","slug":"android-development-01","status":"publish","type":"post","link":"https:\/\/swordofmorning.com\/index.php\/2023\/09\/22\/android-development-01\/","title":{"rendered":"Android Development 01 Challenge 1"},"content":{"rendered":"<p><center>\u53c2\u8003\u89c6\u9891\uff1a<a href=\"https:\/\/www.youtube.com\/watch?v=fis26HvvDII&t=3601s\" target=\"_blank\"  rel=\"nofollow\" >Android Development for Beginners - Full Course<\/a><\/center><\/p>\n<h2>\u4e00\u3001MainActivity.java<\/h2>\n<pre><code class=\"language-java\">package com.example.challenge_1;\n\nimport androidx.appcompat.app.AppCompatActivity;\n\nimport android.os.Bundle;\nimport android.view.View;\nimport android.widget.EditText;\nimport android.widget.TextView;\n\npublic class MainActivity extends AppCompatActivity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n    }\n\n    public void Register(View view)\n    {\n        TextView textView_display = findViewById(R.id.TextView_Display);\n        EditText edtText_uname = findViewById(R.id.EdtText_Username);\n        EditText editText_pwd = findViewById(R.id.EdtText_Password);\n\n        textView_display.setText(&quot;Uname: &quot; + edtText_uname.getText().toString() + &quot;, Pwd: &quot; + editText_pwd.getText().toString());\n    }\n}<\/code><\/pre>\n<h2>\u4e00\u3001activity_main.xml<\/h2>\n<pre><code class=\"language-xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\n&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\n    xmlns:app=&quot;http:\/\/schemas.android.com\/apk\/res-auto&quot;\n    xmlns:tools=&quot;http:\/\/schemas.android.com\/tools&quot;\n    android:layout_width=&quot;match_parent&quot;\n    android:layout_height=&quot;match_parent&quot;\n    tools:context=&quot;.MainActivity&quot;&gt;\n\n&lt;!-- Username --&gt;\n    &lt;EditText\n        android:id=&quot;@+id\/EdtText_Username&quot;\n        android:layout_width=&quot;300dp&quot;\n        android:layout_height=&quot;100dp&quot;\n        android:layout_marginTop=&quot;100dp&quot;\n        android:ems=&quot;10&quot;\n        android:hint=&quot;Username&quot;\n        android:inputType=&quot;text&quot;\n        android:textSize=&quot;48dp&quot;\n        app:layout_constraintEnd_toEndOf=&quot;parent&quot;\n        app:layout_constraintStart_toStartOf=&quot;parent&quot;\n        app:layout_constraintTop_toTopOf=&quot;parent&quot;\n    \/&gt;\n\n&lt;!-- Password --&gt;\n    &lt;EditText\n        android:id=&quot;@+id\/EdtText_Password&quot;\n        android:layout_width=&quot;300dp&quot;\n        android:layout_height=&quot;100dp&quot;\n        android:layout_marginTop=&quot;200dp&quot;\n        android:ems=&quot;10&quot;\n        android:hint=&quot;Password&quot;\n        android:inputType=&quot;textPassword&quot;\n        android:textSize=&quot;48dp&quot;\n        app:layout_constraintEnd_toEndOf=&quot;parent&quot;\n        app:layout_constraintStart_toStartOf=&quot;parent&quot;\n        app:layout_constraintTop_toTopOf=&quot;parent&quot;\n    \/&gt;\n\n&lt;!-- Register BTN --&gt;\n    &lt;Button\n        android:id=&quot;@+id\/Btn_Register&quot;\n        android:layout_width=&quot;200dp&quot;\n        android:layout_height=&quot;100dp&quot;\n        android:layout_marginTop=&quot;400dp&quot;\n        android:text=&quot;Register&quot;\n        android:textSize=&quot;48dp&quot;\n        app:layout_constraintEnd_toEndOf=&quot;parent&quot;\n        app:layout_constraintStart_toStartOf=&quot;parent&quot;\n        app:layout_constraintTop_toTopOf=&quot;parent&quot;\n        android:onClick=&quot;Register&quot;\n    \/&gt;\n\n&lt;!-- TextView --&gt;\n    &lt;TextView\n        android:id=&quot;@+id\/TextView_Display&quot;\n        android:layout_width=&quot;500dp&quot;\n        android:layout_height=&quot;100dp&quot;\n        android:layout_marginTop=&quot;600dp&quot;\n        app:layout_constraintEnd_toEndOf=&quot;parent&quot;\n        app:layout_constraintStart_toStartOf=&quot;parent&quot;\n        app:layout_constraintTop_toTopOf=&quot;parent&quot;\n    \/&gt;\n\n&lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u53c2\u8003\u89c6\u9891\uff1aAndroid Development for Beginners &#8211; Full Course \u4e00\u3001MainActivi &#823","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51],"tags":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/swordofmorning.com\/index.php\/wp-json\/wp\/v2\/posts\/963"}],"collection":[{"href":"https:\/\/swordofmorning.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swordofmorning.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swordofmorning.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swordofmorning.com\/index.php\/wp-json\/wp\/v2\/comments?post=963"}],"version-history":[{"count":1,"href":"https:\/\/swordofmorning.com\/index.php\/wp-json\/wp\/v2\/posts\/963\/revisions"}],"predecessor-version":[{"id":964,"href":"https:\/\/swordofmorning.com\/index.php\/wp-json\/wp\/v2\/posts\/963\/revisions\/964"}],"wp:attachment":[{"href":"https:\/\/swordofmorning.com\/index.php\/wp-json\/wp\/v2\/media?parent=963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swordofmorning.com\/index.php\/wp-json\/wp\/v2\/categories?post=963"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swordofmorning.com\/index.php\/wp-json\/wp\/v2\/tags?post=963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}