









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A lab sheet for the Basic Views of Android Studio course at VIT-AP University. The lab sheet contains instructions for completing four programming tasks related to Android Studio, including exploring text types, displaying a toast message, reading a name from EditText and displaying it, and performing basic arithmetic operations. sample code in both Java and XML, as well as input and output screenshots for each task. The lab sheet also includes instructions for saving and uploading the completed file.
Typology: Assignments
1 / 16
This page cannot be seen from the preview
Don't miss anything!
Code: XML:
android:inputType="textPostalAddress" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.865" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/editTextPhone" app:layout_constraintVertical_bias="0.225" /> </androidx.constraintlayout.widget.ConstraintLayout>
CODE JAVA EditText a1,t1; Button b1=findViewById(R.id.button2); a1=findViewById(R.id.id_1); b1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { TextView t=findViewById(R.id.textView6); String s =a1.getText().toString(); t.setText("hello " +s);
} });
app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.0" />
Button plus=findViewById(R.id.button); Button minus=findViewById(R.id.button2); Button multiply=findViewById(R.id.button3); Button divide=findViewById(R.id.button4); plus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int num1 = Integer.parseInt(e1.getText().toString()); int num2 = Integer.parseInt(e2.getText().toString()); TextView tv = findViewById(R.id.textView); tv.setText(Integer.toString(num1 + num2)); } }); minus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int num1 = Integer.parseInt(e1.getText().toString()); int num2 = Integer.parseInt(e2.getText().toString()); TextView tv = findViewById(R.id.textView); tv.setText(Integer.toString(num1 - num2)); } }); multiply.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int num1 = Integer.parseInt(e1.getText().toString()); int num2 = Integer.parseInt(e2.getText().toString()); TextView tv = findViewById(R.id.textView); tv.setText(Integer.toString(num1 * num2)); } }); divide.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int num1 = Integer.parseInt(e1.getText().toString()); int num2 = Integer.parseInt(e2.getText().toString()); TextView tv = findViewById(R.id.textView); tv.setText(Integer.toString(num1 / num2)); } }); } } XML: