1. List attributes to develop simple button
2.explain date&time picker with its method
3. Syntax for intent -filter tag
4. Activity lifecycle
5. Need of permission in android
6. Signify sqlite database
7. List sensors & explain 1
8. Steps to publish android application
9. Explain zoom control (in/out)with example
A. Capture image using camera and display
B. wap to display circular progress bar
1. List attributes to develop simple button :
-
1. id
Used to specify the id of the view
2. text
Used to the display text of the button
3. textColor
Used to the display color of the text
4. textSize
Used to the display size of the text
5. textStyle
Used to the display style of the text like Bold, Italic, etc
7. textAllCaps
Used to display text in Capital letters
8. background
Used to set the background of the view
9. padding
Used to set the padding of the view
10. visibility
Used to set the visibility of the view
11 gravity
Used to specify the gravity of the view like center, top, bottom, etc
2.explain date&time picker with its method
-
date and time :
allows selecting a date and time by editing the displayed values in the control
date picker :
allows you to select the date consisting of day, month and year in your custom user interface.
methods :
1. getDayOfMonth()
This method gets the selected day of month
2. getMonth()
This method gets the selected month
3. getYear()
This method gets the selected year
4. setMaxDate(long maxDate)
This method sets the maximal date supported by this DatePicker in milliseconds since January 1, 1970 00:00:00 in getDefault() time zone
5. setMinDate(long minDate)
This method sets the minimal date supported by this NumberPicker in milliseconds since January 1, 1970 00:00:00 in getDefault() time zone
6. setSpinnersShown(boolean shown)
This method sets whether the spinners are shown
7. updateDate(int year, int month, int dayOfMonth)
This method updates the current date
8. getCalendarView()
This method returns calendar view
9. getFirstDayOfWeek()
This Method returns first day of the week
time picker :
allows you to select the time of day in either 24 hour or AM/PM mode
methods :
1. is24HourView()
This method returns true if this is in 24 hour view else false
2. isEnabled()
This method returns the enabled status for this view
3. setCurrentHour(Integer currentHour)
This method sets the current hour
4. setCurrentMinute(Integer currentMinute)
This method sets the current minute
5. setEnabled(boolean enabled)
This method set the enabled state of this view
6. setIs24HourView(Boolean is24HourView)
This method set whether in 24 hour or AM/PM mode
7.setOnTimeChangedListener(TimePicker.OnTimeChangedListener onTimeChangedListener)
This method Set the callback that indicates the time has been adjusted by the user
3 . Syntax for intent -filter tag :
android:label="string resource"
android:priority="integer" >
. . .
4. Activity lifecycle :
- Every Activity in android has lifecycle like created, started, resumed, paused, stopped or destroyed. These different states are known as Activity Lifecycle.
-Activity is one of the building blocks of Android OS
-Activity is a screen that user interact with
-is controlled by 7 methods of android.app.Activity class
-The android Activity is the subclass of Context Theme Wrapper class.
methods:
1. onCreate
called when activity is first created
2.onStart
called when activity is becoming visible to the user
3.onResume
called when activity will start interacting with the user
4.onPause
called when activity is not visible to the user
5.onStop
called when activity is no longer visible to the user.onRestartcalled after your activity is stopped, prior to start.
6.onDestroy
called before the activity is destroyed.
5. Need of permission in android
--api refrence for the manifest tag that declares your apps required permissions
-permissions help support user privacy by protecting access to the following:
1.Restricted data,
such as system state and a user's contact information.
2. Restricted actions, such as connecting to a paired device and recording audio.
install-time permissions,
-Users grant dangerous permissions to an app when they install or update the app.
runtime permissions,
-the permission is requested at the run time during the running of the app.
special permissions.
-those permissions that are neither Normal permissions nor Dangerous permissions.
6. Signifiy sqlite database
-used to store data inside the user's device in the form of a Text file.
-We can perform so many operations on this data such as adding new data, updating, reading, and deleting this data
Automotive axes
Base sensors
Accelerometer
Ambient temperature
Magnetic field sensor
Gyroscope
Heart Rate
Light
Proximity
Pressure
Relative humidity
Composite sensor types
Activity composite sensors
Linear acceleration
Significant motion
Step detector
Step counter
Tilt detector
Attitude composite sensors
Rotation vector
Game rotation vector
Gravity
Geomagnetic rotation vector
Orientation (deprecated)
Uncalibrated sensors
Accelerometer uncalibrated
Gyroscope uncalibrated
Magnetic field uncalibrated
Hinge angle
Interaction composite sensors
Wake up gesture
Pick up gesture
Glance gesture
pressure :
getDefaultSensor(SENSOR_TYPE_PRESSURE) returns a non-wake-up sensor
-is calculated from atmospheric pressure information of the current position and sea level pressure information by using the API provided in Android.
A pressure sensor (also known as barometer) reports the atmospheric pressure in hectopascal (hPa).
The readings are calibrated using
Temperature compensation
Factory bias calibration
Factory scale calibration
8. Steps to publish android application
-
Table of contents
Step 1: Create a Google Developer account
Step 2: Add a Merchant Account
Step 3: Prepare the Documents
Step 4: Study Google Developer Policies
Step 5: Technical Requirements
Step 6: Creating the App on the Google Console
Step 7: Store Listing
Step 8: Content Rating
Step 9: Pricing the Application
Step 10: roll out release to punblish your app
A:wap to display circular progress bar
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"
android:orientation="vertical"
android:gravity="center"
tools:context=".MainActivity">
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
Button mBtnRound,mBtnLine;
ProgressBar mProgressRound,mProgresLine;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mBtnRound = findViewById(R.id.mBtnRound);
mBtnLine = findViewById(R.id.mBtnStrate);
mProgressRound = findViewById(R.id.mProgresRound);
mProgresLine = findViewById(R.id.mProgresLine);
mBtnRound.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mProgressRound.setVisibility(View.VISIBLE);
}
});
mBtnLine.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mProgresLine.setVisibility(View.VISIBLE);
Thread thread = new Thread(){
@Override
public void run() {
super.run();
for (int i = 0; i <= 100;){
try {
sleep(1000);
}
catch (InterruptedException m){
m.printStackTrace();
}
mProgresLine.setProgress(i);
i=i+20;
}
}
};
thread.start();
}
});
}
}
A. Capture image using camera and display
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"
android:orientation="vertical"
android:gravity="center"
tools:context=".MainActivity">
android:id="@+id/BtnCamera"
android:textColor="#ffffff"
android:textAllCaps="false"
android:text="Take Photo"
android:layout_margin="50dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:id="@+id/ImgCamera"
android:background="#F6F4F4"
android:layout_marginTop="10dp"
android:layout_width="250dp"
android:layout_height="200dp"/>
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
Button BtnCamera;
ImageView ImgCamera;
private static final int Call_to_camera = 200;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
BtnCamera = findViewById(R.id.BtnCamera);
ImgCamera = findViewById(R.id.ImgCamera);
BtnCamera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA)!= PackageManager.PERMISSION_GRANTED){
Toast.makeText(getApplicationContext(),"Give Permission to CAMERA",Toast.LENGTH_LONG).show();
ActivityCompat.requestPermissions(Activity50Multimedia.this,new String[]{Manifest.permission.CAMERA},1);
}
else {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, Call_to_camera);
}
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Call_to_camera && resultCode == RESULT_OK) {
Bitmap imagephoto = (Bitmap)data.getExtras().get("data");
ImgCamera.setImageBitmap(imagephoto);
}
}
}