Anna University: N PRITHVI (2016105610) A SAI KUMAR (2016105582)
Anna University: N PRITHVI (2016105610) A SAI KUMAR (2016105582)
Anna University: N PRITHVI (2016105610) A SAI KUMAR (2016105582)
SUBMITTED BY
N PRITHVI (2016105610)
A SAI KUMAR(2016105582)
KP HARISH (2016105028)
S SRI HARIHARAN(2016105592)
1
TABLE OF CONTENTS
1 INTRODUCTION 3
2 MOTIVATION 3
3 DESIGN STEPS 4
5 CODE 7
6 RESULTS 13
7 CONCLUSION 14
2
INTRODUCTION:
Android is a mobile operating system based on a modified version of the Linux kernel
and other open source software, designed primarily for touchscreen mobile devices such
as smartphones and tablets. Android is developed by a consortium of developers known
as the Open Handset Alliance, with the main contributor and commercial marketer being
Google.
Applications ("apps"), which extend the functionality of devices, are written using the
Android software development kit (SDK) and, often, the Java programming language.
Java may be combined with C/C++,] together with a choice of non-default runtimes that
allow better C++ support. The Go programming language is also supported, although
with a limited set of application programming interfaces (API)
MOTIVATION:
Every smart phone has an messaging app which is in built. But it is mostly a standard
template and lacks features. Chat box aims to address those issues by adding a dark
mode to prevent eye strain making the messaging experience more convenient and
stramlined.It has a dedicated switch to toggle between dark mode and normal mode
whenever the user wants.
3
DESIGN STEPS:
4
5. Make Project window is open (select View > Tool Windows > Project)
and the Android view is selected from the drop-down list at the top of that
window. The following files are then modified:
This XML file defines the layout for the activity's user interface (UI). It
contains a TextView element with the text "Hello, World!"
The manifest file describes the fundamental characteristics of the app and
defines each of its components.
5
6. Connect your device to your development machine with a USB cable.
7. Enable USB debugging in the Developer options window.
8. In Android Studio, select your app from the run/debug configurations
drop-down menu in the toolbar.
9. In the toolbar, select the device that you want to run your app on from the
target device drop-down menu.
6
CODE:
Mainactivity:(java)
package com.example.demoapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import android.Manifest;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.Toast;
EditText txt_pNumber,txt_message;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txt_message=(EditText)findViewById(R.id.txt_message);
txt_pNumber=(EditText)findViewById(R.id.txt_phone_number);
MyMessage();
}
else{
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.SEND_SMS},0);
}
}
7
private void MyMessage() {
if (!txt_pNumber.getText().toString().equals("")|| !txt_message.getText().toString().equals("")) {
}
else {
Toast.makeText(this, "Enter Phone Number or Message", Toast.LENGTH_SHORT).show();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[]
grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode){
case 0:
Activityxml:(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"
android:padding="20dp"
android:id="@+id/ab"
tools:context=".MainActivity">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Phone Number:"
android:layout_marginTop="10dp"
android:textSize="22sp"
android:inputType="phone"
android:id="@+id/txt_phone_number"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_marginTop="10dp"
android:hint="Enter Message:"
android:gravity="top"
android:textSize="22sp"
android:id="@+id/txt_message"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Send"
android:textSize="25sp"
android:layout_marginTop="10dp"
android:onClick="btn_send"
/>
<Switch
android:id="@+id/switch1"
android:layout_width="370dp"
android:layout_height="148dp"
android:checked="true"
android:onClick="darkmode"
9
android:switchTextAppearance="@style/TextAppearance.AppCompat.Large"
android:text="dark mode"
android:textOff="OFF"
android:textOn="ON" />
</LinearLayout>
10
RESULTS:
Default mode:
11
Dark mode:
CONCLUSION:
12