To build an Android application for managing contacts using Android Studio, Java and SQLite3.
To build an Android application for managing contacts using Android Studio, Java and SQLite3.
Java is one of the most popular programming languages in the world. Java classes run on Android Runtime (ART), a specialized virtual machine.
The Android Studio IDE is the best way you can build an android application with utmost ease. It is based on IntelliJ IDEA and also the official environment for Google's operating system. Features like real-time profilers, intelligent code editor and fast emulator makes the work in Android Studio fun. Android SDK is the official development kit for Android App development.
The main aim is to build a Contact Application which can be used by a user to make calls, store contact numbers in their respective local storage and also provide a simple way to delete them too. This will be kind of a basic phone book application. This project will also include brief usage of SQLite3 database for local storage of data.
This project consists of the following stages: 
Loading Page

Login Page

Registration Page

Recycler View List

Contact Details and Calling

To build an Android application for managing contacts using Android Studio, Java and SQLite3.
Java is one of the most popular programming languages in the world. Java classes run on Android Runtime (ART), a specialized virtual machine.
The Android Studio IDE is the best way you can build an android application with utmost ease. It is based on IntelliJ IDEA and also the official environment for Google's operating system. Features like real-time profilers, intelligent code editor and fast emulator makes the work in Android Studio fun. Android SDK is the official development kit for Android App development.
The main aim is to build a Contact Application which can be used by a user to make calls, store contact numbers in their respective local storage and also provide a simple way to delete them too. This will be kind of a basic phone book application. This project will also include brief usage of SQLite3 database for local storage of data.
This project consists of the following stages: 
Loading Page

Login Page

Registration Page

Recycler View List

Contact Details and Calling

This task is all about the concepts that will be needed in building our application. Checkout the Requirements given below for more details.
The main purpose of this task is for you to have a basic knowledge of the life cycle methods of an Android application and how to communicate and transfer data between your activities.
It's time to work on the actual project. We'll start off by creating the basic structure of the project. [NOTE: The file structure is of a typical Android project. You are free to refer to official documentations for the file structure.]
build.gradle file. Gradle is a build system commonly used in all java applications to automate building, testing and deployment. build.gradle contains scripts to automate several tasks like simply copying some file from one directory to other. It contains compiledSdkVersion, buildTypes and dependencies. The following Dependencies need to be added:
appcompat - maven dependency for using various frameworksrecyclerview - dependency for using the recycler view in our appcardview - for using cardview class with the viewholder classconstraint-layout - for designing in constraint layoutdependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
implementation 'com.android.support:design:28.0.0-rc01'
implementation 'de.hdodenhof:circleimageview:3.0.0'
}
com.example.[appname] by creating new classes under this directory.
.xml files can be found in the layout folder of the res directory. In the activity.xml file we can design our activity screen using XML and drag & drop methods..xml file to your class activity files.drawable folder under res (resource) directory will contain all your images, designs etc. files needed for the frontend.Intents will be come handy here.You should be able to create a basic layout of your app with few activities. [NOTE: For this task we are just expecting empty files for the classes. The content of these files are discussed in the next sections.]
The basic idea of our application is that multiple users can register on the application and store details of various contacts and access the same on login. In this milestone, we'll be accepting user data on registration which needs to be fed to the database and then while login the user will be authenticated when the user enters a valid input in the placeholders and clicks on the Login button.
Registration activity. The Login activity will require only username and password. Intents can be used here to take the values of these placeholders and transfer it across our list of activity classes.UserData class which will contain the way in which data will be stored in our database. Idea is to have objects of users in which each object shall contain username and mobile number.DatabaseHelper class which will be used to connect SQLite3. SQLiteOpenHelper is used to create an object to create tables, open or manage the database. Here also define the schema of the database by executing a create table query in the onCreate() method in DatabaseHelper class.
Registration activity class to call our DatabaseHelper class using an object of SQLiteHelper to send the data inserted in the placeholders to DatabaseHelper class where these will be fed to the database. This method shall contain the username, mobile number, password as the arguments.insert method in DatabaseHelper class which will receive the arguments from Registration activity and feed it to the database using ContentValues. You can have the return type of this insert method as Boolean to check whether the data has been successfully inserted or not. ContentValues is a map like class that matches string key and inserts the data given into it as arguments into the tableLogin activity class we have fields for username and password. We need to check that if this user is present in our database or not and then if there is a user present we need to authenticate that the user has entered correct password or not.
check_username method in DatabaseHelper class which receives the username as argument to check if it is present in the database or not.match method in our DatabaseHelper class which receives username and password as arguments and checks if the password matches with the password present in the database.match method we have to use cursor for iterating through the table stored in the database. Cursor basically contains the result of a query made against a database in android. Use the getCount() method of Cursor which returns the number of matches, if it returns zero hence no matches found and user is not present in the database.You should be able to write the necessary content for the Registration and Login activities. The data coming in from the Registration activity should be passed to the DatabaseHelper which feeds it to the database. The Login activity shall call an authentication method of DatabaseHelper class to authenticate the user.
In this task the aim is to build a custom recycler view for our list in which the data present in the database will be shown.
ViewGroup which helps in building and displaying large sets of data efficiently. In our case, we will use it to build a list of items which shall display the username, phone number and a delete button for each element in the list. ViewHolder class provides all the functionality for each list items. To implement a custom RecyclerView we would need a Custom Adapter also. Adapter associates the data with the ViewHolder class.getAllContacts() in the DatabaseHelper class which returns all the data present in the database by iterating through it using Cursor. This is first needed to get the data in an ArrayList. Then we move onto creating our recycler view.ContactsView class which is basically the RecyclerView wrapper class. This class calls on the RecyclerViewAdapter class with arguments as the ArrayList of UserData. This also defines the layout of the list i.e. whether you want a vertical list or a horizontal list. It contains two methods -
onCreate()- calls the RecyclerViewAdapter class and sends the ArrayList of UserData as argument. It also manages the layout of the list view. This method will call the next method loadContactList().loadContactList() - This method should have an instance of the database which is used to call using the DatabaseHelper object to get the list of data stored in the database. It also calls the getAllContacts()to populate the adapter list in the next step.RecyclerViewAdapter class which will denote each row of the database. In this class we should have an ArrayList of UserData to receive the same from ContactsView. Each of the views in the list will contain username, phone number and a delete button. Each of the list view item is represented by RecyclerViewAdapter.onCreateViewHolder() - used to populate the list receiving data from UserData.getItemCount() - returns the number of rows in the list.ViewHolder() - contains a database instance and deleting method. The delete button is used with a onClickListener event to delete the current list item when this button is clicked.deleteContact() method in the DatabaseHelper class that receives aUserData to be deleted and deletes that data from the database.By the end of this milestone, you should have a working RecyclerView list populated with the data in the database with each item having username, mobile number & delete button.
By now we have almost come to the end of our project. The only part left is to create a details page from which we can make a call and also store image in the contact details. We will also be using a circular card view for some customization to our details page. Displaying an image is done using ImageView but it is difficult to create circular view with it. Hence we will use card view library to make our task simple. The activity_contact__details file corresponding to the ContactDetails class can also be used to modify the changes.
ContactDetails activity class along with call button, mobile number and profile photo.onClickListener methods, one for camera access and clicking the image, while the other is for making a calling method which is implemented by using Intent methods for performing the call function.
public static final int CAMERA_REQUEST=9999;
// mention these in the onclick listener functions
Intent callintent = new Intent(Intent.ACTION_CALL); // for call
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // for camera
bitmap and then store. Before inserting into database, you need to convert your Bitmap image into byte array first then apply it using database query.bitmap image has to be stored in the database using an instance of it. It should call a method InsertImage() in DatabaseHelper class which takes in the bitmap image and converts it into a byte array. The InsertImage() method inserts the image into the database using the two arguments byte array and username. Query commands are executed here. It uses the Cursor again to search for the corresponding username and then with the help of ContentValues inserts into the database.ContactView activity. [NOTE: The Adapter has to be modified to store an image view.]You should be able to develop the details page along with the basic functionalities of calling function and image capture function.