Android Assignments
Android Assignments
<TextView
android:text = "Login Page"
android:layout_width="wrap_content"
android:layout_height = "wrap_content"
android:id = "@+id/textView1"
android:textSize = "35dp"
android:layout_marginTop="20dp"
android:layout_alignParentTop = "true"
android:layout_centerHorizontal = "true" />
<EditText
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:id = "@+id/editText1"
android:hint = "Enter Username"
android:focusable = "true"
android:textColorHighlight = "#ff7eff15"
android:textColorHint = "#ffff25e6"
android:layout_marginTop = "46dp"
android:layout_below = "@+id/textView1"
android:layout_alignParentLeft = "true"
android:layout_alignParentStart = "true"
android:layout_alignParentRight = "true"
android:layout_alignParentEnd = "true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:id="@+id/editText2"
android:layout_marginTop = "30dp"
android:layout_below="@+id/editText1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/editText1"
android:layout_alignEnd="@+id/editText1"
android:textColorHint="#ffff299f"
android:hint="Enter Password" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Attempts Left:"
android:id="@+id/textView2"
android:layout_below="@+id/editText2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textSize="25dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:id="@+id/button"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/textView1"
android:layout_toStartOf="@+id/textView1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:id="@+id/button2"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/textView1"
android:layout_toEndOf="@+id/textView1" />
</RelativeLayout>
//[Link]
package [Link].login_page;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
TextView attempts;
int counter = 3;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
login = (Button)findViewById([Link]);
username = (EditText)findViewById([Link].editText1);
password = (EditText)findViewById([Link].editText2);
cancel = (Button)findViewById([Link].button2);
attempts = (TextView)findViewById([Link].textView2);
[Link](new [Link]() {
@Override
public void onClick(View v) {
if([Link]().toString().equals("admin") &&
[Link]().toString().equals("admin")) {
[Link](getApplicationContext(),
"Welcome",Toast.LENGTH_SHORT).show();
}
else{
[Link](getApplicationContext(), "Something Went
Wrong",Toast.LENGTH_SHORT).show();
[Link]([Link]);
[Link]([Link]);
counter--;
[Link]([Link](counter));
if (counter == 0) {
[Link](false);
}
}
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
*******************************************************************************/
NAME:- Rasal Pratiksha Ganesh
ROLL NO. :-7402
ASSIGNMENT NO.:-4
ASSIGNMENT NAME:- Create an Android application which examine, that a phone
number, which a user has entered is in the given format. * Area
code should be one of the following: 040, 041, 050, 0400, 044 *
There should 6- 8 numbers in telephone number (+ area code).
*************************************************************************************
//activity_main.xml
<LinearLayout
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<EditText
android:id="@+id/phone_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Phone Number"
android:padding="50dp"
android:textSize="15dp"
android:layout_marginTop="100dp" />
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Check"
android:textSize="25dp" />
</LinearLayout>
//[Link]
package [Link].examine_phone_number;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
EditText phone_number;
Button button;
Matcher m;
String pattern="^(040|041|050|0400|044)([0-9]{6,8})$";
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
phone_number = findViewById([Link].phone_number);
button = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
Pattern r = [Link](pattern);
if (!phone_number.getText().toString().isEmpty()) {
m = [Link](phone_number.getText().toString().trim());
} else {
Toast t = [Link](getApplicationContext(), "Please Enter Mobile
Number", Toast.LENGTH_SHORT);
[Link]();
}
if ([Link]()) {
Toast t = [Link](getApplicationContext(), "Match",
Toast.LENGTH_SHORT);
[Link]();
} else {
Toast t = [Link](getApplicationContext(), "No match",
Toast.LENGTH_SHORT);
[Link]();
}
}
});
}
}
********************************************************************************/
NAME:- Rasal Pratiksha Ganesh
ROLL NO. :-7402
ASSIGNMENT NO.:-6
ASSIGNMENT NAME:- Create an Android application, which show to the user 5-10
quiz questions. All questions have 4 possible options and one
right option exactly. Application counts and shows to the user
how many right answers were right and shows the result to user.
*************************************************************************************
//activity_main.xml
<LinearLayout
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:id="@+id/score"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:textSize="25dp"
android:gravity="center"/>
<TextView
android:id="@+id/question"
android:layout_width="match_parent"
android:layout_height="235dp"
android:textSize="20dp"
android:gravity="center" />
<Button
android:id="@+id/answer1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15dp" />
<Button
android:id="@+id/answer2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15dp" />
<Button
android:id="@+id/answer3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15dp" />
<Button
android:id="@+id/answer4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15dp" />
</LinearLayout>
//[Link]
package [Link];
public String questions[] = {"Who developed C?", "Who developed PHP?", "Who
developed Java?", "Who developed Linux?", "Who developed C++?"};
//[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
TextView score,question;
Button answer1,answer2,answer3,answer4;
private Questions questions=new Questions();
private String canswer;
private int score1=0;
private int question_length=[Link];
Random r;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
score = findViewById([Link]);
question = findViewById([Link]);
answer1 = findViewById([Link].answer1);
answer2 = findViewById([Link].answer2);
answer3 = findViewById([Link].answer3);
answer4 = findViewById([Link].answer4);
r = new Random();
[Link]("Score:"+score1);
update_question([Link](question_length));
[Link](new [Link]() {
@Override
public void onClick(View v) {
if([Link]()==canswer)
{
score1++;
[Link]("Score:"+score1);
update_question([Link](question_length));
}
else
{
gameOver();
}
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
if([Link]()==canswer)
{
score1++;
[Link]("Score:"+score1);
update_question([Link](question_length));
}
else
{
gameOver();
}
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
if([Link]()==canswer)
{
score1++;
[Link]("Score:"+score1);
update_question([Link](question_length));
}
else
{
gameOver();
}
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
if([Link]()==canswer)
{
score1++;
[Link]("Score:"+score1);
update_question([Link](question_length));
}
else
{
gameOver();
}
}
});
}
*************************************************************************************
//activity_main.xml
<EditText
android:id="@+id/edt1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/button4"
android:layout_alignRight="@+id/button4"
android:layout_below="@+id/edt1"
android:layout_marginTop="94dp"
android:text="1" />
<Button
android:id="@+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/button1"
android:layout_toLeftOf="@+id/button3"
android:layout_toStartOf="@+id/button3"
android:text="2" />
<Button
android:id="@+id/button3"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/button2"
android:layout_centerHorizontal="true"
android:text="3" />
<Button
android:id="@+id/button4"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/button1"
android:layout_toLeftOf="@+id/button2"
android:text="4" />
<Button
android:id="@+id/button5"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/button4"
android:layout_alignLeft="@+id/button2"
android:layout_alignStart="@+id/button2"
android:text="5" />
<Button
android:id="@+id/button6"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button3"
android:layout_alignStart="@+id/button3"
android:layout_below="@+id/button3"
android:text="6" />
<Button
android:id="@+id/button7"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/button4"
android:layout_toLeftOf="@+id/button2"
android:text="7" />
<Button
android:id="@+id/button8"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button5"
android:layout_alignStart="@+id/button5"
android:layout_below="@+id/button5"
android:text="8" />
<Button
android:id="@+id/button9"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button6"
android:layout_alignStart="@+id/button6"
android:layout_below="@+id/button6"
android:text="9" />
<Button
android:id="@+id/buttonadd"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/edt1"
android:layout_alignRight="@+id/edt1"
android:layout_alignTop="@+id/button3"
android:layout_marginLeft="46dp"
android:layout_marginStart="46dp"
android:layout_toRightOf="@+id/button3"
android:text="+" />
<Button
android:id="@+id/buttonsub"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/buttonadd"
android:layout_alignLeft="@+id/buttonadd"
android:layout_alignRight="@+id/buttonadd"
android:layout_alignStart="@+id/buttonadd"
android:layout_below="@+id/buttonadd"
android:text="-" />
<Button
android:id="@+id/buttonmul"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/buttonsub"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="@+id/buttonsub"
android:layout_below="@+id/buttonsub"
android:text="*" />
<Button
android:id="@+id/button10"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/button7"
android:layout_toLeftOf="@+id/button2"
android:text="." />
<Button
android:id="@+id/button0"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button8"
android:layout_alignStart="@+id/button8"
android:layout_below="@+id/button8"
android:text="0" />
<Button
android:id="@+id/buttonC"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button9"
android:layout_alignStart="@+id/button9"
android:layout_below="@+id/button9"
android:text="C" />
<Button
android:id="@+id/buttondiv"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/buttonmul"
android:layout_alignLeft="@+id/buttonmul"
android:layout_alignRight="@+id/buttonmul"
android:layout_alignStart="@+id/buttonmul"
android:layout_below="@+id/buttonmul"
android:text="/" />
<Button
android:id="@+id/buttoneql"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/buttondiv"
android:layout_alignLeft="@+id/button10"
android:layout_alignRight="@+id/buttondiv"
android:layout_alignStart="@+id/button10"
android:layout_below="@+id/button0"
android:layout_marginTop="37dp"
android:text="=" />
</RelativeLayout>
//[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]() + "1");
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]() + "2");
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]() + "3");
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]() + "4");
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]() + "5");
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]() + "6");
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]() + "7");
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]() + "8");
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]() + "9");
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]() + "0");
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
if (crunchifyEditText == null) {
[Link]("");
} else {
mValueOne = [Link]([Link]() + "");
crunchifyAddition = true;
[Link](null);
}
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
mValueOne = [Link]([Link]() + "");
mSubtract = true;
[Link](null);
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
mValueOne = [Link]([Link]() + "");
crunchifyMultiplication = true;
[Link](null);
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
mValueOne = [Link]([Link]() + "");
crunchifyDivision = true;
[Link](null);
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
mValueTwo = [Link]([Link]() + "");
if (crunchifyAddition == true) {
[Link](mValueOne + mValueTwo + "");
crunchifyAddition = false;
}
if (mSubtract == true) {
[Link](mValueOne - mValueTwo + "");
mSubtract = false;
}
if (crunchifyMultiplication == true) {
[Link](mValueOne * mValueTwo + "");
crunchifyMultiplication = false;
}
if (crunchifyDivision == true) {
[Link](mValueOne / mValueTwo + "");
crunchifyDivision = false;
}
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]("");
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]() + ".");
}
});
}
}
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Customer Details"
android:textSize="25dp"
android:layout_gravity="center" />
<Button
android:id="@+id/show"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Show All Customers"
android:textAllCaps="false" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text1"
android:hint="Data" />
</LinearLayout>
//[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
public void onCreate(SQLiteDatabase db) {
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
//[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
// below line is to add on click listener for our add course button.
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link](new [Link]() {
@Override
public void onClick(View v) {
database = [Link]();
if(cursor != null){
[Link]();
}
[Link]("CUST_ID", cust_id);
[Link]("CUST_NAME", cust_name);
[Link]("CUST_ADDRESS", cust_address);
[Link]("CUST_PHONE", cust_phone);
[Link]("CUSTOMER", null, values);
}
}
<RelativeLayout
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
tools:context=".MainActivity">
<ImageSwitcher
android:id="@+id/image1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
</ImageSwitcher>
<Button
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="Previous" />
<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="300dp"
android:layout_marginLeft="300dp"
android:layout_marginBottom="-7dp"
android:text="Next" />
</RelativeLayout>
//[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
sw = findViewById([Link].image1);
previous = findViewById([Link]);
next = findViewById([Link]);
[Link](new [Link]() {
@Override
public View makeView() {
ImageView imageView = new ImageView(getApplicationContext());
[Link]([Link].FIT_CENTER);
return imageView;
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]);
[Link]([Link]);
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link]);
}
});
}
}
********************************************************************************/
NAME:- Rasal Pratiksha Ganesh
ROLL NO. :-7402
ASSIGNMENT NO.:-12
ASSIGNMENT NAME:- Write an application to accept two numbers from the user, and
displays them, but reject input if both numbers are greater
than 10 and asks for two new numbers.
*************************************************************************************
//activity_main.xml
<LinearLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="250dp"
tools:context=".MainActivity">
<EditText
android:id="@+id/num1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter First Number" />
<EditText
android:id="@+id/num2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Second Number" />
<Button
android:id="@+id/check_num"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Check" />
<TextView
android:id="@+id/n1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/n2"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textdata"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
//[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
EditText num1,num2;
Button check_num;
TextView textdata,num1_show,num2_show;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
num1 = findViewById([Link].num1);
num2 = findViewById([Link].num2);
check_num = findViewById([Link].check_num);
textdata = findViewById([Link]);
num1_show = findViewById([Link].n1);
num2_show = findViewById([Link].n2);
check_num.setOnClickListener(new [Link]() {
@Override
public void onClick(View v) {
int n1=[Link]([Link]().toString());
int n2=[Link]([Link]().toString());
if(n1>10 && n2>10)
{
[Link](getApplicationContext(),"Please Enter Numbers Smaller
Than 10",Toast.LENGTH_SHORT).show();
[Link]("");
[Link]("");
}
else
{
num1_show.setText("Number 1 = "+n1+"\n");
num2_show.setText("Number 2 = "+n2+"\n");
[Link]("Both Numbers Are Smaller Than 10");
[Link]("");
[Link]("");
}
}
});
}
}
********************************************************************************
//activity_main.xml
<EditText
android:id="@+id/editTextName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:ems="10"
android:hint="Enter Name"
android:inputType="textPersonName" />
<EditText
android:id="@+id/editTextEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:ems="10"
android:hint="Enter Email"
android:inputType="textPersonName" />
<EditText
android:id="@+id/editTextMobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:ems="10"
android:hint="Enter Mobile Number"
android:inputType="textEmailAddress" />
<EditText
android:id="@+id/editTextDob"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:ems="10"
android:hint="Enter Date of Birth (DD/MM/YYYY)"
android:inputType="date" />
<EditText
android:id="@+id/editTextAge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:ems="10"
android:hint="Enter Age"
android:inputType="number" />
<Button
android:id="@+id/buttonSubmit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Submit" />
</LinearLayout>
//[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends Activity implements [Link] {
[Link](this);
}
try {
Pattern pattern = [Link]("^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]
+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
Matcher matcher = [Link](argEditText);
return [Link]();
} catch (Exception e) {
[Link]();
return false;
}
}
public boolean validCellPhone(String number)
{
return [Link](number).matches();
}
public boolean checkDateFormat(String date) {
if (date == null || /(0[1-9]|1[0-
2])/[0-9]{4}$"))
return false;
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
try {
[Link](date);
return true;
} catch (Exception e) {
return false;
}
}
@Override
public void onClick(View view) {
if (view == buttonSubmit) {
submitForm();
}
}
}