Package Import Import Import Import Import Import Import Public Class Extends
Package Import Import Import Import Import Import Import Public Class Extends
myapplication1;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
EditText etfTest ;
Button BtClick;
String text;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
BtClick=findViewById(R.id.BtClick);
etfTest=findViewById(R.id.etfTest);
BtClick.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
text=etfTest.getText().toString();
Toast.makeText(MainActivity.this,text,Toast.LENGTH_SHORT).show();
}
});
activitylayout.xml
<EditText
android:id="@+id/etfTest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="BtClick"
android:textsize="30sp"
android:id="@+id/BtClick"
android:layout_below="@+id/e
Practice class android make by ilias ahmed