0
이것은 초보자/멍청한 질문입니다.하지만 사용자가 데이터를 입력하는 데 InputActivity.java와 activity_input.xml을 사용하고 싶습니다.android studio 2.3의 입력과 출력
InputActivity.java
을package com.lukmanyahoo.denny.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class InputActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_input);
}
//Send data to HasilActivity.java
}
는 activity_input.xml는
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.lukmanyahoo.denny.myapplication.InputActivity">
<EditText
android:id="@+id/editText"
android:layout_width="569dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginLeft="636dp"
android:layout_marginStart="16dp"
android:layout_marginTop="15dp"
android:ems="10"
android:hint="@string/umur"
android:inputType="number"
app:layout_constraintBottom_toTopOf="@+id/editText"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="DuplicateIds,NotSibling,RtlHardcoded"
app:layout_constraintVertical_bias="0.251" />
<EditText
android:id="@+id/editText2"
android:layout_width="569dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="@string/daerah"
android:inputType="textPersonName"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText"
tools:ignore="MissingConstraints,RtlHardcoded" />
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="@string/jurusan"
android:textSize="30sp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:ignore="MissingConstraints"
android:layout_marginTop="32dp"
app:layout_constraintTop_toBottomOf="@+id/editText2"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" />
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="569dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
tools:ignore="RtlHardcoded">
<RadioButton
android:id="@+id/radioButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/informatika" />
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="569dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/sistem_informasi"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="178dp" />
</RadioGroup>
<Button
android:id="@+id/button3"
android:layout_width="569dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/kirim"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/radioGroup"
tools:ignore="RtlHardcoded" />
</android.support.constraint.ConstraintLayout>
내 응용 프로그램의 출력 부에 대한 코드는 다음과 같다 : 상기 입력에 대한 코드는 다음과 같다
HasilActivity.java
package com.lukmanyahoo.denny.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class HasilActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hasil);
}
}
이 응답 시간을내어210 개
activity_hasil.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.lukmanyahoo.denny.myapplication.HasilActivity">
<TableLayout
android:layout_width="568dp"
android:layout_height="791dp"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/umur"
android:textStyle="bold" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
tools:layout_editor_absoluteX="58dp"
tools:layout_editor_absoluteY="169dp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/daerah"
android:textStyle="bold" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" " />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/jurusan"
android:textStyle="bold" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" " />
</TableRow>
</TableLayout>
</android.support.constraint.ConstraintLayout>
감사합니다. 나는 여기서 새로운 질문을한다. 당신의 InputActivity에서