Mad ct1 Q.B Ans
Mad ct1 Q.B Ans
1. Hardware Companies: These are companies that manufacture hardware components for
smartphones and other mobile devices. This includes companies like Samsung, HTC, LG, Motorola,
Sony, and others. They contribute by producing Android-powered devices, including smartphones,
tablets, wearables, and other gadgets.
2. Software Companies: These companies develop software applications, middleware, and other
solutions that run on the Android platform. They may provide tools for app development, security
solutions, productivity software, and various other applications. Examples include Google (which
develops the Android operating system itself), as well as other software companies that create apps for
the Android ecosystem.
3. Handset Manufacturers: These are companies that specialize in designing, manufacturing, and
distributing mobile handsets. They produce a variety of devices, ranging from entry-level smartphones to
flagship models with advanced features. Examples include Samsung, Xiaomi, OnePlus, Huawei, and
many others.
4. Mobile Operators (Carriers): These are telecommunications companies that provide mobile network
services to consumers. They offer cellular connectivity, data plans, and other services to users of
Android devices. Examples include T-Mobile, Verizon, AT&T, Vodafone, and others. Mobile operators
may also work closely with handset manufacturers to offer subsidized devices and exclusive deals to
their customers.
6. Commercialization Companies: This category may include companies involved in various aspects of
commercializing Android devices, such as marketing, distribution, retail, and other related services.
These companies help bring Android-powered devices to market and promote their adoption among
consumers. Examples could include retail chains, marketing agencies, and distributors specializing in
mobile devices.
9) What is android SDK.
The android SDK(software development kit ) provides to test android applications, the API libraries,
sample code, developer tools, and tutorials which help you to build, test and debug apps for Android.
Android SDK is made up of two main parts: the tools and packages. When you first install the SDK,
all you obtain are basic tools. These are executable and supporting files that help you develop
applications. The packages are the records specific to a particular version of android(called a platform)
or a particular add-on to a platform.
JAVA file
package com.example.ct1_1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
<ImageView
android:layout_width="250dp"
android:layout_height="250dp"
android:src="@drawable/me"
android:id="@+id/img"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="50dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bhoomi Manuja"
android:id="@+id/name"
android:textSize="25sp"
app:layout_constraintTop_toBottomOf="@id/img"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="30dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="manujabhoomi@gmail.com"
android:id="@+id/email"
app:layout_constraintTop_toBottomOf="@id/name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="10dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click."
android:id="@+id/btn"
app:layout_constraintTop_toBottomOf="@id/email"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="20dp"/> add toast msg below
</androidx.constraintlayout.widget.ConstraintLayout>
JAVA file
package com.example.ct1_2;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b1;
b1=findViewById(R.id.btn);
b1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Toast.makeText(MainActivity.this, "You are viewing Bhoomi Manuja's profile.",
Toast.LENGTH_SHORT).show();
}
});
}
}
<EditText
android:id="@+id/et"
android:ems="10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter your text here"/>
<Button
android:id="@+id/bt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/et"
android:text="Button 1"/>
<Button
android:id="@+id/bt2"
android:layout_width="wrap_content" add toast msg below
android:layout_height="wrap_content" textfield mein text daalke o/p likhna
android:layout_below="@id/bt1" vahi toast msg mein aayega kyuki phir
android:text="Button 2"/>
</RelativeLayout>
JAVA file
package com.example.ct1_3;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b1,b2;
EditText text;
text=findViewById(R.id.et);
b1=findViewById(R.id.bt1);
b2=findViewById(R.id.bt2);
b1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
Toast.makeText(MainActivity.this,"Button 1 Clicked. Your Text-"+text.getText(),
Toast.LENGTH_LONG).show();
}
});
b2.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Toast.makeText(MainActivity.this,"Button 2 Clicked. Your
Text-"+text.getText(),Toast.LENGTH_SHORT).show();
}
});
}
}
<TableLayout
android:id="@+id/tableLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*">
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Subject"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Marks"
android:textStyle="bold"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="C"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="83"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PHP"/>
<TextView
android:layout_width="wrap_content" add toast msg below
android:layout_height="wrap_content"
android:text="85"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Python
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="78"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DSU"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="80"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DBMS" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="76"/>
</TableRow>
</TableLayout>
<Button
android:id="@+id/cal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Percentage"/>
</LinearLayout>
JAVA file
package com.example.ct1_4;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b1;
b1 = findViewById(R.id.cal);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Percentage: 80.4%", Toast.LENGTH_SHORT).show();
}
});
}
}
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:text="Character"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:text="Boolean"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Datatypes in Object-Oriented Programming"
android:id="@+id/layout"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:text="Integer"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right" ` add toast msg below
android:text="Floating Point"/>
</FrameLayout>
JAVA file
package com.example.ct1_5;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView t1;
t1=findViewById(R.id.layout);
t1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(MainActivity.this, "Layout: Frame Layout.", Toast.LENGTH_SHORT).show();
}
});
}
}
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter Name"
android:id="@+id/name"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter Age" add toast msg below
android:id="@+id/age"/> textfields mein naam, age daalke o/p likhna
<Button vahi toast msg mein aayega kyuki phir
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Display"
android:id="@+id/btn"/>
</LinearLayout>
JAVA file
package com.example.ct1_6;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b1;
EditText n,a;
n=findViewById(R.id.name);
a=findViewById(R.id.age);
b1=findViewById(R.id.btn);
b1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
Toast.makeText(MainActivity.this,"Name: "+n.getText()+", Age: "+a.getText(),
Toast.LENGTH_LONG).show();
}
});
}
}
11)write a program to accept username and password from user using textview and edittext.
XML file
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/user"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="UserName"/>
<EditText
android:id="@+id/et1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:layout_toRightOf="@+id/user"/>
<TextView
android:id="@+id/pass"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/user"
android:text="Password"/> add toast msg below
<EditText textfields mein naam, pass daalke o/p likhna
android:id="@+id/et2" vahi toast msg mein aayega kyuki phir
android:layout_marginTop="50dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/pass"
android:ems="10"
android:inputType="textPassword"/>
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/et2"
android:text="Submit"/>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
JAVA file
package com.example.ct1_8;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
12)write a program to display 3 student basic information in table form using tablelayout.
XML file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Student Information"
android:id="@+id/info"
android:textSize="20dp"/>
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/info"
android:id="@+id/tb">
<TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="SrNo." />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Name"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Age"/>
</TableRow>
<TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="1"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="ABC"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="17"/>
</TableRow>
<TableRow>
<TextView
android:layout_height="wrap_content" add Toast msg below
android:layout_width="wrap_content"
android:text="2"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="DEF"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="12"/>
</TableRow>
<TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="3"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="GHI"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="14"/>
</TableRow>
</TableLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click"
android:id="@+id/btn"
android:layout_below="@+id/tb"/>
</RelativeLayout>
JAVA file
package com.example.ct1_7;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b1;
b1=findViewById(R.id.btn);
b1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
Toast.makeText(MainActivity.this,"ABC is Oldest.", Toast.LENGTH_LONG).show();
}
});
}
}
13)write a program to place name, age and mobile number centrally on the display screen using
Absolute layout.
XML file
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout 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:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:context=".MainActivity"
android:orientation="vertical"
android:layout_gravity="center"
tools:ignore="Deprecated">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="0dp"
android:layout_y="0dp"
android:text="Name: Bhoomi Manuja"
android:textSize="30sp"
android:layout_margin="20dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age: 18"
android:textSize="30sp"
android:layout_margin="20dp"
android:layout_x="100dp"
android:layout_y="50dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Phone No.: 2383823932"
android:textSize="30sp"
android:layout_margin="20dp"
android:layout_x="0dp"
android:layout_y="100dp"/>
</AbsoluteLayout>
JAVA file
package com.example.ct1_9;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
14)write a program to create togglebutton to display on/off bluetooth on the display screen.
XML file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/toggleButton"
android:textOn="Bluetooth ON"
android:textOff="Bluetooth Off"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="300dp"
android:layout_height="300dp"/>
</RelativeLayout>
JAVA file
package com.example.exp8_1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import android.widget.ToggleButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
togglebutton=findViewById(R.id.toggleButton);
imageview=findViewById(R.id.imageView);
imageview.setImageDrawable(getResources().getDrawable(R.drawable.bluetooth_on));
togglebutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (togglebutton.isChecked())
imageview.setImageDrawable(getResources().getDrawable( R.drawable.bluetooth_off ));
else
imageview.setImageDrawable(getResources().getDrawable(R.drawable.bluetooth_on ));
}
});
}
}
SELECTOR.XML file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@drawable/bluetooth_on"/>
<item android:state_checked="false" android:drawable="@drawable/bluetooth_off"/>
</selector>
15) write a program to create login form for social networking site.
XML file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/login"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="LOGIN PAGE"/>
<TextView
android:id="@+id/user"
android:layout_marginTop="60dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="UserName"/>
<EditText
android:id="@+id/et1"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:layout_toRightOf="@+id/user"/> add toast msg below
<TextView
android:id="@+id/pass"
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/user"
android:text="Password"/>
<EditText
android:id="@+id/et2"
android:layout_marginTop="70dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/pass"
android:ems="10"
android:inputType="textPassword"/>
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/et2"
android:text="Submit"/>
</RelativeLayout>
JAVA file
package com.example.ct1_10;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1=findViewById(R.id.btn);
b1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
u=findViewById(R.id.et1);
p=findViewById(R.id.et2);
Toast.makeText(MainActivity.this,"Logged in Successfully.", Toast.LENGTH_LONG).show();
}
});
}
}
16) Describe various installation steps of android studio and its environment.
Steps for installing Android Studio:
1. Go to the Android Studio website
2. Click Download Android Studio
3. Open the folder where you downloaded and saved the Android Studio installation (.exe) file.
4. Double-click the downloaded file.
5. If you see a User Account Control dialog about allowing the installation to make changes to your
computer, click Yes to confirm the installation.
6. Click Next to start the installation.
7. Run the downloaded executable file.
8. Choose the components.
9. Accept the default installation settings for all steps.
10. Install any recommended SDK packages.
11. Click Finish when the installation is done to launch Android Studio.
12. Download the latest SDK tools and SDK platforms using the Android SDK Manager.
13. Install updated packages if needed.