BUILDING SOCIAL MEDIA ANDROID APPLICATION FROM SCRATCH.

Today we will be learning how to build social media application using Android studio and java programing language. Taken this course will expose you to:

⦁ How to create new project in android Studio.

⦁ How to connect your project to firebase database.

⦁ How to give permissions in android project manifest.

⦁ How to query firebase database.

⦁ How to use recycler view.

To mention a few, Technology Surge will be teaching you step - by step to create this application and also expose you to other programing languages. First of all, how things are going to be done on this platform. Updated source codes will be pasted on this blog so students can download the source code and use it in their project.

Check: If Windows firewall an enough protection?

CREATING A NEW PROJECT.

Do this to create a new project in android studio:

1. Open your android studio IDE and click on new project and select empty activity. Note: make sure you select Java as the language.

activitymain_xml

Copy and paste the xml code to your xml activity by opening the res folder, layout folder and finally activitymain_xml.

<?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/login"

       android:layout_width="match_parent"

       android:layout_height="wrap_content"

       android:layout_marginLeft="20dp"

       android:layout_marginTop="100dp"

       android:layout_marginRight="20dp"

       android:fontFamily="sans-serif-black"

       android:gravity="center"

       android:text="Login"

       android:textColor="@color/teal_200"

       android:textSize="50dp" />



   <TextView

       android:id="@+id/slogan"

       android:layout_width="match_parent"

       android:layout_height="wrap_content"

       android:layout_below="@id/login"

       android:layout_marginLeft="20dp"

       android:layout_marginRight="20dp"

       android:fontFamily="sans-serif-light"

       android:gravity="center"

       android:text="Login to this test login page"

       android:textColor="@color/black" />



   <EditText

       android:id="@+id/login_email"

       android:layout_width="match_parent"

       android:layout_height="wrap_content"

       android:layout_below="@+id/slogan"

       android:layout_marginLeft="20dp"

       android:layout_marginTop="20dp"

       android:layout_marginRight="20dp"

       android:hint="Email"

       android:fontFamily="sans-serif-light"

       />



   <EditText

       android:id="@+id/login_password"

       android:layout_width="match_parent"

       android:layout_height="wrap_content"

       android:layout_below="@+id/login_email"

       android:layout_marginLeft="20dp"

       android:layout_marginTop="10dp"

       android:layout_marginRight="20dp"

       android:hint="Password"

       android:inputType="textPassword"

       android:fontFamily="sans-serif-light"

       />

   <Button

       android:id="@+id/login_button"

       android:layout_width="match_parent"

       android:layout_height="wrap_content"

       android:layout_below="@+id/login_password"

       android:layout_marginTop="50dp"

       android:layout_marginLeft="100dp"

       android:layout_marginRight="100dp"

       android:text="Login"

       android:textAllCaps="false"

       android:background="@color/purple_200"

       android:textColor="@color/black"

       />

   <TextView

       android:id="@+id/already_have_account"

       android:layout_width="match_parent"

       android:layout_height="wrap_content"

       android:layout_below="@+id/login_button"

       android:text="Don't have an account?Rigister"

       android:layout_marginRight="20dp"

       android:layout_marginLeft="20dp"

       android:gravity="center"

       android:textColor="@color/black"

       android:fontFamily="sans-serif-light"

       />

</RelativeLayout>

Compy and paste this source code in the main activity.


MainActivity.java

Copy and paste the main activity java code to the main activity of your android app.

package com.example.rocky;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import android.widget.EditText;

public class MainActivity extends AppCompatActivity 

{

    private EditText email;

    private EditText password;



    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        email = findViewById(R.id. login_email);

        password = findViewById(R.id. login_password);

    }

}
Next Post Previous Post
No Comment
Add Comment
comment url