Академический Документы
Профессиональный Документы
Культура Документы
>
<LinearLayout
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=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView3"
android:layout_width="125dp"
android:layout_height="56dp"
android:text="TextView"
tools:layout_editor_absoluteX="110dp"
tools:layout_editor_absoluteY="174dp" />
<TextView
android:id="@+id/textView4"
android:layout_width="125dp"
android:layout_height="74dp"
android:text="TextView"
tools:layout_editor_absoluteX="110dp"
tools:layout_editor_absoluteY="256dp" />
</LinearLayout>
================================================================================
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
tools:layout_editor_absoluteX="161dp"
tools:layout_editor_absoluteY="268dp" />
<EditText
android:id="@+id/textView"
android:layout_width="168dp"
android:layout_height="62dp"
android:hint="TextView"
tools:layout_editor_absoluteX="121dp"
tools:layout_editor_absoluteY="171dp" />
<EditText
android:id="@+id/textView2"
android:layout_width="152dp"
android:layout_height="62dp"
android:hint="TextView"
tools:layout_editor_absoluteX="125dp"
tools:layout_editor_absoluteY="86dp" />
</LinearLayout>
===================================================================================
=========
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".Main2Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</activity>
</application>
</manifest>
==================================
package com.example.pract7;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Button btn;
btn=findViewById(R.id.btn1);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText txt1;
EditText txt2;
txt1=findViewById(R.id.textView);
txt2=findViewById(R.id.textView2);
String str1;
String str2;
str1=txt1.getText().toString();
str2=txt2.getText().toString();
}
});
}
}
==========================================================
package com.example.pract7;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
Intent itn2=getIntent();
String str3=itn2.getStringExtra("fname");
String str4=itn2.getStringExtra("sname");
TextView txt3;
TextView txt4;
txt3=findViewById(R.id.textView3);
txt4=findViewById(R.id.textView4);
txt3.setText(str3);
txt4.setText(str4);
}
}
==========================================================================