You are on page 1of 5

13.

TODO List – Mini Project

Software Requirements Specification:


TABLE OF CONTENTS:

 Application information
 Applications Description
 Application features
 How to install
 Source code

Application information:
 Version: “1.0”
 Updated on: 27.11.2021
 Released on: 27.11.2021
 Download size: 4 mb

Application Description:
It an application where we write can create the list such as shopping list, book list, and
many more. If you are an Android user, you can see in your play store there are so many
todo list application exist such as TickTick, Anydo, Todoist, and more.

Application features:
 Works offline
 Save TODO items
 Save notes
 Simple and good looking UI
 Responsive and easy to use

How to install:
(Instructions are based on the latest android version 12L)
Installing after exporting:

 Go to your phone Settings page


 Tap Applications
 Click on Special app access
 Click on Install unknown apps
 Allow access
 Go back to downloads/file manager
 Click on the apk to install

Installing via android studio:

 Download the source code


 Open the source code in android studio
 Connect your android device and turn on USB Debugging

or
 Use the inbuilt virtual emulator
 Run the app

Source code:
activity_main.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=".MainActivity">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="63dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
<EditText
android:id="@+id/text_edit"
android:layout_width="274dp"
android:layout_height="match_parent"
android:hint="Enter the item" />
<Button
android:id="@+id/button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Enter" />
</LinearLayout>
<ListView
android:id="@+id/listview"
android:layout_width="434dp"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp" />
</LinearLayout>

Mainactivity.java:
package com.example.todo;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.*;
import java.util.ArrayList;

public class MainActivity extends AppCompatActivity implements View.OnClickListener,


AdapterView.OnItemLongClickListener {
private EditText ed;
private Button adding_items;
private ListView item_list;
private ArrayList<String> values=new ArrayList<String>();
private ArrayAdapter<String> adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ed = findViewById(R.id.text_edit);
adding_items = findViewById(R.id.button);
item_list = findViewById(R.id.listview);
adding_items.setOnClickListener(this);
item_list.setOnItemLongClickListener(this);
}

@Override
public void onClick(View view) {
String add_item=ed.getText().toString();
if(values.contains(add_item))
{
Toast.makeText(getBaseContext(),"Item Already Exist", Toast.LENGTH_LONG).show();
}
else
{
values.add(add_item);
adapter=new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_list_item_1,values);
item_list.setAdapter(adapter);
ed.setText("");
}
}

@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long l)
{
final int removing_item=position;
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage("Do you want to delete").setPositiveButton("Ok", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
values.remove(removing_item);
adapter.notifyDataSetChanged();
Toast.makeText(getBaseContext(), "Item Deleted", Toast.LENGTH_LONG).show();
}
}).setNegativeButton("Cancel", null).show();
return true;
}
}
Sample Output:

Result:
Thus the mini project – todo list app has been executed successfully.

You might also like