{"id":26751554,"url":"https://github.com/sayed3li97/todoapp-android","last_synced_at":"2025-03-28T12:18:36.647Z","repository":{"id":198676348,"uuid":"168023652","full_name":"sayed3li97/ToDoApp-Android","owner":"sayed3li97","description":" Simple Android To-do app. One Activity that displays a list of data which is stored in an Array List. A Flotation Action Button (FAB) is used to show a dialog box with an input field for the user to add new items to his list. This project is part of a workshop titled \"Introduction to Android\" aimed to help beginners get into Android.","archived":false,"fork":false,"pushed_at":"2021-12-10T11:00:13.000Z","size":326,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-10-06T11:41:46.556Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sayed3li97.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-01-28T19:34:01.000Z","updated_at":"2023-10-06T11:41:47.773Z","dependencies_parsed_at":null,"dependency_job_id":"9152c024-e794-4126-8dd1-694e59d4eb0f","html_url":"https://github.com/sayed3li97/ToDoApp-Android","commit_stats":null,"previous_names":["sayed3li97/todoapp-android"],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FToDoApp-Android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FToDoApp-Android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FToDoApp-Android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FToDoApp-Android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sayed3li97","download_url":"https://codeload.github.com/sayed3li97/ToDoApp-Android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246026095,"owners_count":20711581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-28T12:18:35.330Z","updated_at":"2025-03-28T12:18:36.323Z","avatar_url":"https://github.com/sayed3li97.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ToDoApp\nSimple Android To-do app. One Activity displays a list of data that is stored in an Array List. \nA Flotation Action Button (FAB) shows a dialog box with an input field for the user to add new items to his list. \nThis project is part of a workshop titled \"Introduction to Android\" to help beginners get into Android.\n\n# Screenshots \n\u003cimg src=\"/screenshot/screenshot1.png\" width=\"220\" height=\"400\"\u003e \u003cimg src=\"/screenshot/screenshot2.png\" width=\"220\" height=\"400\"\u003e \n\u003cimg src=\"/screenshot/screenshot3.png\" width=\"220\" height=\"400\"\u003e \n\n# Step to re-create \n\n\n1. Create a new project in Android Studio (Choose the Empty Activity)\n2. [Dwnload this Image](app/src/main/res/drawable/plus.png) and insert it into the drawable folder inside your project\n3. Navigate to app/res/layout/activity_main.xml\n4. Open the \"Text\" view and replace the XML code with the below Code \nThe Code below will add to elements to the Layout:\n    1. ListView that will display all the data in a List \n    2. A FAB button \n```\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003candroid.support.constraint.ConstraintLayout  xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\"\u003e\n\n    \u003cListView\n        android:id=\"@+id/listView1\"\n        android:layout_height=\"fill_parent\"\n        android:layout_width=\"fill_parent\" /\u003e\n\n\n    \u003candroid.support.design.widget.FloatingActionButton\n        android:id=\"@+id/fab\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_gravity=\"bottom\"\n        android:layout_margin=\"16dp\"\n        android:clickable=\"true\"\n        android:src=\"@drawable/plus\"\n    app:layout_constraintBottom_toBottomOf=\"parent\"\n    app:layout_constraintRight_toRightOf=\"parent\" /\u003e\n\n\u003c/android.support.constraint.ConstraintLayout \u003e\n```\n\n5. Open the java file for the main Activity by opening the MainActivity.java from the following path app/java/\"The first folder\"/MainActivity.java\n6. Replace the Code in that file with the below Code (\"Don't remove the first line starting with the package\")\n\n```\n\nimport android.app.AlertDialog;\nimport android.content.DialogInterface;\nimport android.support.design.widget.FloatingActionButton;\nimport android.support.design.widget.Snackbar;\nimport android.support.v7.app.AppCompatActivity;\nimport android.os.Bundle;\nimport android.text.InputType;\nimport android.view.View;\nimport android.widget.ArrayAdapter;\nimport android.widget.EditText;\nimport android.widget.ListView;\n\nimport java.util.ArrayList;\n\npublic class MainActivity extends AppCompatActivity {\n\n    //Define an Array list to store all the data that will be displyed\n    ArrayList\u003cString\u003e items = new ArrayList\u003cString\u003e();\n\n    //Variable to store the dialog text input\n    private String m_Text = \"\";\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        //Add data to the array\n        items.add(\"Milk\");\n        items.add(\"Butter\");\n        items.add(\"Yogurt\");\n        items.add(\"Toothpaste\");\n        items.add(\"Ice Cream\");\n\n        //Define a listview\n        ListView listView1 = (ListView) findViewById(R.id.listView1);\n\n        //Define an array adapter\n        final ArrayAdapter\u003cString\u003e adapter = new ArrayAdapter\u003cString\u003e(this,\n                android.R.layout.simple_list_item_1, items);\n\n        //Connect the Listview to the adapter\n        listView1.setAdapter(adapter);\n\n        //Defining the Fab Button\n        FloatingActionButton fab = findViewById(R.id.fab);\n\n        //Add onclick listener to the Fab button that will trigger when the fab button is clicked\n        fab.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View view) {\n\n                //Creating the dialog box\n                AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);\n                builder.setTitle(\"Add to the list\");\n\n                // Set up the input\n                final EditText input = new EditText(MainActivity.this);\n                // Specify the type of input expected; this, for example, sets the input as a password, and will mask the text\n                input.setInputType(InputType.TYPE_CLASS_TEXT );\n\n                //Ading the Edit text to the dialog bo\n                builder.setView(input);\n\n                // Set up the buttons\n                builder.setPositiveButton(\"OK\", new DialogInterface.OnClickListener() {\n                    @Override\n                    public void onClick(DialogInterface dialog, int which) {\n                        m_Text = input.getText().toString();\n                        items.add(m_Text);\n                    }\n                });\n                //Set up the Cancel button\n                builder.setNegativeButton(\"Cancel\", new DialogInterface.OnClickListener() {\n                    @Override\n                    public void onClick(DialogInterface dialog, int which) {\n                        dialog.cancel();\n                    }\n                });\n\n                //To show the Dialog box\n                builder.show();\n\n                //To update the list View\n                adapter.notifyDataSetChanged();\n\n            }\n        });\n\n\n    }\n\n}\n\n```\nThank you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayed3li97%2Ftodoapp-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsayed3li97%2Ftodoapp-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayed3li97%2Ftodoapp-android/lists"}