0% found this document useful (0 votes)
6 views

MAD Very IMP Program Code

The document outlines the MSBTE Campus Academy's initiative to enhance technical education in Maharashtra through various training programs and workshops. It includes detailed programming examples for mobile application development, such as sending emails, capturing photos, and sending SMS messages, along with their respective XML and Java code. Additionally, it emphasizes the importance of soft skills and holistic development for students in the modern workforce.

Uploaded by

shreyashbhunje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

MAD Very IMP Program Code

The document outlines the MSBTE Campus Academy's initiative to enhance technical education in Maharashtra through various training programs and workshops. It includes detailed programming examples for mobile application development, such as sending emails, capturing photos, and sending SMS messages, along with their respective XML and Java code. Additionally, it emphasizes the importance of soft skills and holistic development for students in the modern workforce.

Uploaded by

shreyashbhunje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

MSBTE 2025 SUMMER EXAMS

Mobile Application
Development

MSBTE CAMPUS
ACADEMY
8830687180
9175956461
COMPANY
NAME
MSBTE SUMMER EXAM 2025

MSBTE CAMPUS
ACADEMY
The MSBTE Campus Academy is an initiative by the Maharashtra
State Board of Technical Education (MSBTE) aimed at enhancing
the quality of technical education in the state. The academy
focuses on providing students with industry-relevant skills and
knowledge through various training programs, workshops, and
certification courses. It collaborates with industry experts and
educational institutions to deliver cutting-edge curriculum and
practical experience. The MSBTE Campus Academy also
emphasizes holistic development by incorporating soft skills and
personality development modules, preparing students to meet
the demands of the modern workforce effectively.
MSBTE CAMPUS ACADEMY
MSBTE SUMMER EXAMS 2025

VERY IMP PROGRAMS

Output
Menifest
JAVA
XML
MSBTE CAMPUS
ACADEMY
Table of Contents
Program to send Email 03
Program to Capture a photo 04
Program to send a SMS Message 05
Activity Lifecycle (Toast all methods) 06
Program to play an audio 07
Program to play a Video 08
How to create simple database in SQLite 09
Program for Explicit Intent 10
Program for Implicit Intent 11
DatePicker and TimePicker 12
Contact Us 13
Program to send Email
XML file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
tools:context=".MainActivity">

<TextView android:layout_width="match_parent" android:layout_height="wrap_content"


android:textSize="40dp"
android:text="Email Sender"
android:gravity="center"
android:textStyle="bold"/>

<EditText android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:hint="Email Address"/>

<EditText android:id="@+id/subject"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:hint="Subject"/>

<EditText android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:hint="Email Body"/>

<Button
android:id="@+id/send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginLeft="150dp"
android:text="send" />

</LinearLayout>
Program to send Email
Java file:
package com.example.emailsender;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent; import android.os.Bundle; import android.view.View; import


android.widget.Button; import android.widget.EditText;

public class MainActivity extendsAppCompatActivity {

EditText email1,subject,message; Button send;


@Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); email1=findViewById(R.id.email);
subject=findViewById(R.id.subject); message=findViewById(R.id.message);
send=findViewById(R.id.send);

send.setOnClickListener(new View.OnClickListener() { @Override


public void onClick(View view) {
String mail=email1.getText().toString();
String sub=subject.getText().toString();
String msg=message.getText().toString();

Intent email=new Intent(Intent.ACTION_SEND);


email.putExtra(Intent.EXTRA_EMAIL,new String[]{mail});
email.putExtra(Intent.EXTRA_SUBJECT,sub);
email.putExtra(Intent.EXTRA_TEXT,msg);
email.setType("text/palain");

startActivity(Intent.createChooser(email,"Choose an email app"));


}
});

email1.setText("");
subject.setText("");
message.setText("");

}
}
Program to send Email
Manifest File:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.an
droid.com/tools" package="com.example.emailsender">

<application android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"

android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true"
android:theme="@style/Theme.EmailSender" tools:targetApi="31">
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />


</intent-filter>
</activity>
</application>

</manifest>
MSBTE CAMPUS
ACADEMY
BEST ONLINE LEARNING PLATFORM

Live
All Study Recording Complete
Session
Material Session Practice +
Placements
Program to Capture a photo
XML File:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
android:orientation="vertical"
tools:context=".MainActivity">

<Button
android:id="@+id/camera_button"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_marginStart="150dp"
android:text="Camera" />

<ImageView android:id="@+id/click_image"
android:layout_width="350dp"
android:layout_height="450dp"
android:layout_marginStart="30dp"
android:layout_marginTop="70dp"
android:layout_marginBottom="10dp" />

</LinearLayout>
Program to Capture a photo
Java File:
package com.example.capture_photo;
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 extendsAppCompatActivity { private static final int
pic_id = 123;
Button camera_open_id;
ImageView click_image_id;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
camera_open_id=findViewById(R.id.camera_button);
click_image_id=findViewById(R.id.click_image);

camera_open_id.setOnClickListener(new View.OnClickListener() { @Override


public void onClick(View view) {
Intent camera_intent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(camera_intent,pic_id);
}
});

}
protected void onActivityResult(int requestCode,int resultCode,Intent data)
{
super.onActivityResult(requestCode,resultCode,data);

if(requestCode==pic_id)
{
Bitmap photo=(Bitmap) data.getExtras().get("data");
click_image_id.setImageBitmap(photo);
}

}
}
Program to Capture a photo
Manifest File:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="h
ttp://schemas.android.com/tools">

<uses-permission android:name="android.permission.CAMERA"/>
<application android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher" android:label="@string/app_name"
android:supportsRtl="true" android:theme="@style/Theme.Capture_photo"
tools:targetApi="33">
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />


</intent-filter>
</activity>
</application>

</manifest>
MSBTE CAMPUS
ACADEMY
BEST ONLINE LEARNING PLATFORM

Live
All Study Recording Complete
Session
Material Session Practice +
Placements
Program to send a SMS Message
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">

<EditText android:id="@+id/number"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="40dp" android:ems="10" android:hint="Mobile
Number" android:inputType="textPersonName"

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.836" />

<EditText android:id="@+id/message"

android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="136dp" android:ems="10"
android:hint="Your Message" android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/send" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:hint="SEND"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:onClick="Message_Send"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Program to send a SMS Message
Java File:
package com.example.messenger1;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.telephony.SmsManager; import android.text.Editable;
import android.view.View; import android.widget.Button; import
android.widget.EditText; import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

Button send;
EditText number,msg;
SmsManager sms=SmsManager.getDefault(); @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

send=findViewById(R.id.send); number=findViewById(R.id.number);
msg=findViewById(R.id.message);

send.setOnClickListener(new View.OnClickListener() { @Override


public void onClick(View view) {

}
});
}

public void Message_Send(View v)


{
String num=number.getText().toString(); String message=msg.getText().toString();

sms.sendTextMessage(num,null,message,null,null);
Toast.makeText(this, "Message Sent...!", Toast.LENGTH_SHORT).show();
}
}
Program to send a SMS Message
Manifest File:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http:/
/schemas.android.com/tools" package="com.example.messenger1">

<application android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true"
android:theme="@style/Theme.Messenger1" tools:targetApi="31">
<activity

android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />


</intent-filter>
</activity>
</application>

<uses-permission android:name="android.permission.SEND_SMS" />


</manifest>
MSBTE CAMPUS
ACADEMY
BEST ONLINE LEARNING PLATFORM

Live
All Study Recording Complete
Session
Material Session Practice +
Placements
Activity Lifecycle (Toast all methods)
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">

<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Activity Lifecycle (Toast all methods)
Java File:
package com.example.activity_lifecycle;
import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
Toast.makeText(this, "Created", Toast.LENGTH_SHORT).show();
}

@Override
protected void onStart(){ super.onStart();
Toast.makeText(this, "Started", Toast.LENGTH_SHORT).show();
}

@Override
protected void onPause(){ super.onPause();
Toast.makeText(this, "paused", Toast.LENGTH_SHORT).show();
}

@Override
protected void onResume() { super.onResume();
Toast.makeText(this, "Resume", Toast.LENGTH_SHORT).show();
}

@Override
protected void onDestroy() { super.onDestroy();
Toast.makeText(this, "Destory", Toast.LENGTH_SHORT).show();
}

@Override
protected void onStop(){ super.onStop();
Toast.makeText(this, "Stopped", Toast.LENGTH_SHORT).show();
}
}
MSBTE CAMPUS
ACADEMY
BEST ONLINE LEARNING PLATFORM

Live
All Study Recording Complete
Session
Material Session Practice +
Placements
Program to play an audio
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/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp"
android:text="Audio Controller" />

<Button
android:id="@+id/button1" style="?
android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginTop="48dp"
android:text="start" />

<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_toRightOf="@+id/button1"
android:text="pause" />

<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_toRightOf="@+id/button2" android:text="stop" />

</RelativeLayout>
Program to play an audio
XML File:
package com.example.audioplayer;
import androidx.appcompat.app.AppCompatActivity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;

public class MainActivity extendsAppCompatActivity {


Button start,pause,stop;
@Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

start=findViewById(R.id.button1);
pause=findViewById(R.id.button2);
stop=findViewById(R.id.button3);

final MediaPlayer mp=new MediaPlayer(); try{

mp.setDataSource(Environment.getExternalStorageDirectory().getPath()+"/Music/maine.
mp3");

mp.prepare();
}catch(Exception e){e.printStackTrace();}

start.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

mp.start();
}
});
pause.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) { mp.pause();
}
});
stop.setOnClickListener(new View.OnClickListener() { @Override
public void onClick(View v) { mp.stop();
}
});
}
}
MSBTE CAMPUS
ACADEMY
BEST ONLINE LEARNING PLATFORM

Live
All Study Recording Complete
Session
Material Session Practice +
Placements
Program to play a Video
XML File:
<RelativeLayout xmlns:androclass="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<VideoView android:id="@+id/videoView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" />

</RelativeLayout>
Program to play a Video
Java File:
package com.example.videoplayer;
import androidx.appcompat.app.AppCompatActivity;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.Menu;
import android.widget.MediaController;
import android.widget.VideoView;

public class MainActivity extends AppCompatActivity {


protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

VideoView videoView =findViewById(R.id.videoView1);

MediaController mediaController= new MediaController(this);


mediaController.setAnchorView(videoView);

Uri uri=Uri.parse(Environment.getExternalStorageDirectory().getPath()+"/media/1.mp4");

videoView.setMediaController(mediaController); videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.start();

}
MSBTE CAMPUS
ACADEMY
BEST ONLINE LEARNING PLATFORM

Live
All Study Recording Complete
Session
Material Session Practice +
Placements
How to create simpledatabase in
XML File: SQLite
<?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">

<EditText android:id="@+id/etPassword3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="68dp"
android:layout_marginTop="448dp"
android:drawableLeft="@drawable/ic_baseline_vpn_key_24"
android:ems="10"
android:hint=" Re-Enter Password"
android:inputType="textPassword"
android:textSize="20dp"
app:layout_constraintBottom_toTopOf="@+id/btRegister"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />

<EditText android:id="@+id/etMobile"

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="216dp"
android:drawableLeft="@drawable/ic_baseline_contact_phone_24"
android:ems="10"
android:hint=" Mobile Number"
android:inputType="number"
android:textSize="20dp"
app:layout_constraintBottom_toTopOf="@+id/etPassword2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.388"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.026" />

<EditText android:id="@+id/etUsername2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="68dp"
android:layout_marginTop="216dp"
android:drawableLeft="@drawable/ic_baseline_person_24"
android:ems="10"
android:hint=" Username"
android:inputType="textPersonName"
android:textSize="20dp"
app:layout_constraintBottom_toTopOf="@+id/etPassword2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.723" />
How to create simpledatabase in
XML File: SQLite
<Button
android:id="@+id/btRegister"
android:layout_width="165dp"
android:layout_height="47dp"
android:text="Register"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.439"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/etPassword2"
app:layout_constraintVertical_bias="0.58" />

<EditText android:id="@+id/etPassword2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="68dp"
android:layout_marginTop="376dp"
android:drawableLeft="@drawable/ic_baseline_vpn_key_24"
android:ems="10"
android:hint=" Password"
android:inputType="textPassword"
android:textSize="20dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView android:id="@+id/textView2"

android:layout_width="296dp"
android:layout_height="72dp"
android:layout_marginStart="68dp"
android:layout_marginTop="68dp"
android:text="Registration"
android:textColor="@color/purple_200"
android:textSize="50dp"
android:textStyle="bold"

app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
How to create simpledatabase in
JAVA File: SQLite
package com.example.loginandauthenticationusingotp;

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;

public class MainActivity extends AppCompatActivity {

EditText etMobile,etUsername,etPass,etRepass; Button btRegister;


@Override
protected void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);
btRegister=findViewById(R.id.btRegister);
etMobile=findViewById(R.id.etMobile);
etUsername=findViewById(R.id.etUsername2);
etPass=findViewById(R.id.etPassword2);
etRepass=findViewById(R.id.etPassword3);
btRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

String mob=etMobile.getText().toString();
String name=etUsername.getText().toString();
String pass=etPass.getText().toString();
String repass=etRepass.getText().toString();
if(pass.equals(repass))
{
DBManager db=new DBManager(Registration.this);
db.open(mob,name,pass);
etMobile.setText("");
etUsername.setText("");
etPass.setText("");
etRepass.setText("");
Toast.makeText(Registration.this, "Registration Successfull...", Toast.LENGTH_SHORT).show();
}

else
{
Toast.makeText(Registration.this, "Entered password is not matchingwith previous...",
Toast.LENGTH_SHORT).show();
}

}
});
}
}
How to create simpledatabase in
Database Helper: SQLite
package com.example.loginandauthenticationusingotp;

public class DatabaseHelper {


public staticfinal int DB_VERSION = 1;
public static final String DB_NAME = "login_info";
public staticfinal String TABLE_NAME= "login_table";

public staticfinal String KEY_ID = "id";


public static final String KEY_NAME= "name";
public static final String KEY_NO = "mobile";
public static final String KEY_PASS = "pass";
}
How to create simpledatabase in
DBManager: SQLite
package com.example.loginandauthenticationusingotp;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper; import android.os.Bundle;
import android.util.Log; import android.widget.Toast;

import androidx.annotation.Nullable;

public classDBManager extends SQLiteOpenHelper {

static String stringValue; publicstatic String mobile;


public DBManager(Context context) { super(context,DatabaseHelper.DB_NAME,null,
DatabaseHelper.DB_VERSION);
}

@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
String create= "create table "+DatabaseHelper.TABLE_NAME+" ("+DatabaseHelper.KEY_ID+" Integer primary
key autoincrement
,"+DatabaseHelper.KEY_NO+" varchar(50),"+DatabaseHelper.KEY_NAME +" varchar(50)
,"+DatabaseHelper.KEY_PASS+" varchar(50)"+" )";

sqLiteDatabase.execSQL(create);
}

public void open(String mob,String name,String pass)

{
SQLiteDatabase db=getWritableDatabase(); ContentValues values=new ContentValues();
values.put(DatabaseHelper.KEY_NO,mob); values.put(DatabaseHelper.KEY_NAME,name);
values.put(DatabaseHelper.KEY_PASS,pass); System.out.println("This line is ex");
// Toast.makeText(Registration.class, "Mob: "+mob+"Name : "+name+"Pass : "+pass,
Toast.LENGTH_SHORT).show();
db.insert(DatabaseHelper.TABLE_NAME,null,values); db.close();
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

}
}
MSBTE CAMPUS
ACADEMY
BEST ONLINE LEARNING PLATFORM

Live
All Study Recording Complete
Session
Material Session Practice +
Placements
Program for Explicit Intent
XML File:
Activity_main.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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<Button
android:id="@+id/conti"
android:layout_width="178dp"
android:layout_height="56dp"
android:layout_marginBottom="41dp"
android:backgroundTint="#E13813"
android:text="Continue"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView" />

<ImageView android:id="@+id/imageView"
android:layout_width="423dp"
android:layout_height="157dp"
android:layout_marginBottom="212dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginTop="252dp"
app:layout_constraintBottom_toTopOf="@+id/button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"

app:srcCompat="@drawable/laundry" />

</androidx.constraintlayout.widget.ConstraintLayout>
Program for Explicit Intent
XML File:
Activity_home_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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=".HomeScreen">

<TextView android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Home screen" />
</LinearLayout>
Program for Explicit Intent
Java File:
MainActivity.java

package com.example.intentdemo;

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;

import java.net.NoRouteToHostException; import java.util.BitSet;

public class MainActivity extendsAppCompatActivity {

Button conti;
private static final int CAMERA_REQUEST=1888; ImageView imageView;
Button photo; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
conti=findViewById(R.id.conti);

conti.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i=new Intent(MainActivity.this, HomeScreen.class);
startActivity(i);
}
});

}
Program for Explicit Intent
Java File:
HomeScreen.java
package com.example.intentdemo;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

public class HomeScreen extendsAppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_screen);
}
}
MSBTE CAMPUS
ACADEMY
BEST ONLINE LEARNING PLATFORM

Live
All Study Recording Complete
Session
Material Session Practice +
Placements
Program for Implicit Intent
XML File:

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<EditText android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/urlText"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:ems="10" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnNavigate"
android:layout_below="@+id/urlText"
android:text="Navigate"
android:layout_centerHorizontal="true" />
</RelativeLayout>
Program for Implicit Intent
Java File:
package com.example.implicit_intent;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final EditText editText= (EditText)findViewById(R.id.urlText);
Button btn = (Button) findViewById(R.id.btnNavigate);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String url = editText.getText().toString();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
}
});
}
}
MSBTE CAMPUS
ACADEMY
BEST ONLINE LEARNING PLATFORM

Live
All Study Recording Complete
Session
Material Session Practice +
Placements
DatePicker and TimePicker
XML File:
Activity_main.xml

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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">

<Button
android:layout_width="150dp"
android:layout_height="50dp"
android:text="Timepicker"
android:id="@+id/tpicker"
/>
<Button
android:layout_width="150dp"
android:layout_height="50dp"
android:text="Datepicker"
android:id="@+id/dpicker"
/>
</LinearLayout>
DatePicker and TimePicker
XML File:
Activity_time_pickerdemo.xml

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout 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"
android:orientation="vertical"
tools:context=".TimePickerdemo">

<TimePicker
android:id="@+id/tp"
android:layout_width="match_parent"
android:layout_height="500dp"
android:timePickerMode="spinner"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:textStyle="bold"
android:textSize="30dp"
android:layout_gravity="center"
android:id="@+id/tv_tp"
/>

</LinearLayout>
DatePicker and TimePicker
XML File:
Activity_time_pickerdemo.xml

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal"
tools:context=".DatePickerdemo">

<DatePicker
android:layout_width="match_parent"
android:layout_height="500dp"
android:datePickerMode="calendar"
android:id="@+id/dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:textSize="30dp"
android:id="@+id/tv_dp"
/>
</LinearLayout>
DatePicker and TimePicker
Java File:
MainActivity.java

package com.example.timepicker;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle; import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {


Button tpicker,dpicker;

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

tpicker=findViewById(R.id.tpicker);
dpicker=findViewById(R.id.dpicker);

tpicker.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i=new Intent(MainActivity.this,TimePickerdemo.class); startActivity(i);
}
});

dpicker.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

Intent i=new Intent(MainActivity.this,DatePickerdemo.class); startActivity(i);


}
});
DatePicker and TimePicker
Java File:
TimePickerdemo.java

package com.example.timepicker;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TimePicker;
import android.widget.TextView;

public class TimePickerdemo extends AppCompatActivity {


TimePicker tp;
TextView tv_tp; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_time_pickerdemo);
tv_tp=findViewById(R.id.tv_tp); tp=findViewById(R.id.tp);

tp.setOnTimeChangedListener(new
android.widget.TimePicker.OnTimeChangedListener() {
@Override
public void onTimeChanged(
android.widget.TimePicker timePicker, int i, int i1) { tv_tp.setText("Current
Time : "+tp.getCurrentHour()+" :
"+tp.getCurrentMinute());
}
});
}
}
DatePicker and TimePicker
Java File:
DatePickerdemo.java

package com.example.timepicker;
import androidx.appcompat.app.AppCompatActivity; import
android.os.Build;
import android.os.Bundle;
import android.widget.DatePicker; import android.widget.TextView;

public class DatePickerdemo extends AppCompatActivity {

DatePicker dp; TextView tv; @Override


protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_date_pickerdemo);

dp=findViewById(R.id.dp); tv=findViewById(R.id.tv_dp);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {


dp.setOnDateChangedListener(new DatePicker.OnDateChangedListener() {
@Override
public void onDateChanged(DatePicker datePicker, int i, int i1, int i2) {
tv.setText("Date Selected : "+dp.getDayOfMonth()+" - "+dp.getMonth()+" -
"+dp.getYear());
}
});
}
}
}
DatePicker and TimePicker
Manifest File:

<?xml version="1.0" encoding="utf-8"?>


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.TimePicker"
tools:targetApi="31">
<activity android:name=".DatePickerdemo"
android:exported="false" />

<activity android:name=".TimePickerdemo"
android:exported="false" />
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="
android.intent.action.MAIN" />

<category android:name="
android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
MSBTE CAMPUS
ACADEMY
BEST ONLINE LEARNING PLATFORM

Live
All Study Recording Complete
Session
Material Session Practice +
Placements
Our Team GREAT TEAMWORK

VISHAL CHAVARE

If you need any help, click on Click Here


below.

CLICK HERE

KALPESH KULKARNI

If you need any help, click on Click Here


below.

CLICK HERE
Contact Us
www.msbtecampus.com

[email protected]

8830687180
9175956461

You might also like