P13 code

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Java

package com.example.prac13;

import android.app.Activity;
import android.text.InputFilter.LengthFilter
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

@SuppressWarnings("ALL")
public abstract class MainActivity<method> extends Activity implements
OnClickListener, P13 {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b1;
b1 = (Button) findViewById(R.id.button);
b1.setOnClickListener(this);
}

@Override
public boolean OnCreateOptionsMenu(Menu menu){
//Inflate the menu;this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main,menu);
return true;
}

@Override
public void OnClick() {
OnClick();
}

@Override
public void onClick(View arg)
{

/* TODO Auto-generated */
EditText t1= (EditText)findViewById(R.id.editText1);
String s1=t1.getText().toString();
Toast.makeText(this,s1,Toast.LENGTH_LONG).show();
}
}
Xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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:id="@+id/relativeLayout"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
tools:ignore="MissingPrefix">

<TextView
Android:id="@+id/textView2"
Android:layout_width="wrap_content"
Android:layout_height="wrap_content"
Android:layout_marginStart="48dp"
Android:layout_marginTop="72dp"
Android:text="Name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="HardcodedText" />

<EditText
Android:id="@+id/editTextTextPersonName"
Android:layout_width="wrap_content"
Android:layout_height="48dp"
Android:layout_marginStart="168dp"
Android:layout_marginTop="56dp"
Android:ems="10"
Android:inputType="textPersonName"
Android:text="Enter Your Name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="Autofill,HardcodedText,LabelFor" />

<Button
Android:id="@+id/button"
Android:layout_width="wrap_content"
Android:layout_height="wrap_content"
Android:layout_marginStart="160dp"
Android:layout_marginTop="120dp"
Android:text="Submit"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="HardcodedText,MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy