Video of the day

Video Example

Blog Archive

Powered by Blogger.

Translate Page Any Language

Follow Us

Our

Follow Us

We want to make contribution to the world by producing finest and smartest better!
Showing posts with label AndroidProgramming. Show all posts
Showing posts with label AndroidProgramming. Show all posts

Android Studio Project Online Shopping

- 36 comments

Android Online Shopping Project  Source code


Android E-commerce Source Code and Project

Use this project for online shopping. E-commerce application is an Android base project. It allows the user to easily select and buy their products from the app. This project runs you will need Android Studio. So before you run the project make sure that you have Android Studio on your computer.


About the Project

This whole project has only one concept, which is to provide a wide range of products to reach their customers. Customers can select Categories of products they want to buy. Also, they can schedule their shipping details. they have to provide the proper shipping details. Here, when they run the project they can see the welcome screen of this project. In order to run the project, first, install Android Studio. Then import the project from the studio’s homepage. Your project set up will automatically start. All the Gradle build files will automatically install inside your project root directory. Run the project and set up your virtual device and run the emulator. The project will start and there you can see different lists and options from this commerce site. Here, in this project, you can select different types of products like clothes, cars, mobiles, music and many more items. Then from those options, they can select any type of product you want to buy. See this source code.


Project Features for User

Add to cart
buy product
Add product


Project Features for Admin

Add product
Confirm Order
Shipment Detail.


Main Activity

import android.app.ProgressDialog;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.example.productapp.Model.Users;
import com.example.productapp.Prevalent.Prevalent;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

import io.paperdb.Paper;

public class MainActivity extends AppCompatActivity {
    private Button joinNowButton, loginButton;
    private ProgressDialog loadingBar;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        joinNowButton = (Button) findViewById(R.id.main_join_now_btn);
        loginButton = (Button) findViewById(R.id.main_login_btn);
        loadingBar = new ProgressDialog(this);
        Paper.init(this);

        loginButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this, LoginActivity.class);
                startActivity(intent);
            }
        });
        joinNowButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view)
            {
                Intent intent = new Intent(MainActivity.this, RegisterActivity.class);
                startActivity(intent);
            }
        });
        String UserPhoneKey = Paper.book().read(Prevalent.UserPhoneKey);
        String UserPasswordKey = Paper.book().read(Prevalent.UserPasswordKey);
        if (UserPhoneKey != "" && UserPasswordKey != "")
        {
            if (!TextUtils.isEmpty(UserPhoneKey)  &&  !TextUtils.isEmpty(UserPasswordKey))
            {
                AllowAccess(UserPhoneKey, UserPasswordKey);

                loadingBar.setTitle("Already Logged in");
                loadingBar.setMessage("Please wait.....");
                loadingBar.setCanceledOnTouchOutside(false);
                loadingBar.show();
            }
        }
    }
    private void AllowAccess(final String phone, final String password)
    {
        final DatabaseReference RootRef;
        RootRef = FirebaseDatabase.getInstance().getReference();
        RootRef.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                if (dataSnapshot.child("Users").child(phone).exists()){

                    Users usersData = dataSnapshot.child("Users").child(phone).getValue(Users.class);
                    if (usersData.getPhone().equals(phone))
                    {
                        if (usersData.getPassword().equals(password))
                        {
                            Toast.makeText(MainActivity.this, "Please wait, you are already logged in...", Toast.LENGTH_SHORT).show();
                            loadingBar.dismiss();

                            Intent intent = new Intent(MainActivity.this, HomeActivity.class);
                            Prevalent.currentOnlineUser = usersData;
                            startActivity(intent);

                        }
                        else {
                            loadingBar.dismiss();
                            Toast.makeText(MainActivity.this,"Password is incorrect",Toast.LENGTH_SHORT).show();
                        }
                    }
                }
                else {
                    Toast.makeText(MainActivity.this, "Account with this " + phone + " number do not exists.", Toast.LENGTH_SHORT).show();
                    loadingBar.dismiss();
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });
    }
}


Online Shopping Project Graphical User Interface


                          



Main Activity 


<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"
    android:background="@drawable/welcome"
    tools:context=".MainActivity">
    <ImageView
        android:id="@+id/app_logo"
        android:layout_width="300dp"
        android:layout_height="100dp"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="60dp"
        android:src="@drawable/applogo"
        />
    <TextView
        android:id="@+id/app_slogan"
        android:layout_width="248dp"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentTop="true"
        android:layout_marginEnd="80dp"
        android:layout_marginTop="142dp"
        android:text="Find, Discover, Choose and Buy anything online."
        android:textAlignment="center"
        android:textColor="@color/colorPrimary"
        android:textSize="30sp"
        android:textStyle="bold|italic"
        />
    <Button
        android:id="@+id/main_login_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true"
        android:layout_marginBottom="10dp"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:background="@drawable/buttons"
        android:padding="20dp"
        android:textAllCaps="false"
        android:textSize="18sp"
        android:text="Already have an Account? Login"
        android:textColor="@android:color/white"
        />

    <Button
        android:id="@+id/main_join_now_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/main_login_btn"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:background="@drawable/input_design"
        android:padding="20dp"
        android:textAllCaps="false"
        android:textSize="18sp"
        android:text="Join Now"
        android:textColor="@android:color/white"
        />

</RelativeLayout>

Online Shopping App Project 

Password: Subscribe

Project Link: Online Shopping



 Online Shopping Project

Online Shopping Project


Why android studio not work

- No comments
How to fixed android studio error

Today and tomorrow android is going most popular in the world. This was a silly project in the initial time. In this time, It is the most popular open source OS in the world. Now increasing this famous.
Basic Requirement
Step 1: Intel Virtual Technology Enabled Form Bios Setting

Step 2: If install Previous Clean Install fill from AppData and System File.

Step 3: System must be connected with internet.
Step 4: System configuration anyhow but for faster not necessary use 4=GB ram and use SSD or solid state drive




Step 5: Update Your Graphics driver on your system
Step 6: Update USB plugin diver from your operating system to run project on your phone
Step 7: Download Android Studio from Android website.
Step 8: Download SDK from Android website.

Step 9: Download JDK or Java Development Kit from oracle website



How to work Button action in android studio

- No comments
Create XML code for the design

activity_main.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"
>
<EditText
android:id="@+id/F"
android:layout_width="151dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="39dp"
android:ems="10"
android:inputType="numberDecimal"
android:textSize="30dp"
android:importantForAutofill="no" />
<EditText
android:id="@+id/S"
android:layout_width="151dp"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/F"
android:layout_alignParentEnd="true"
android:ems="10"
android:inputType="numberDecimal"
android:textSize="30dp"/>
<Button
android:id="@+id/Add"
android:layout_width="151dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="123dp"
android:text="Add"
android:textSize="25dp"
/>
<Button
android:id="@+id/Sub"
android:layout_width="151dp"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/S"
android:layout_alignParentTop="true"
android:layout_marginStart="5dp"
android:layout_marginTop="118dp"
android:text="Sub"
android:textSize="25dp"
/>
<TextView
android:id="@+id/Result"
android:layout_width="151dp"
android:layout_height="47dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="192dp"
android:text="Result"
android:textSize="30sp"
/>
</RelativeLayout>

Create Class
But use your own package this creat default  package
MainActivity.class
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;


public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private EditText F,S;
    private Button Add, Sub;
    private TextView Result;
    Double Num1,Num2,Sum;

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Add =(Button)findViewById(R.id.Add);
        Sub =(Button)findViewById(R.id.Sub);
        Add.setOnClickListener(this);
        Sub.setOnClickListener(this);


    }

    @Override    public void onClick(View v) {
        F =(EditText) findViewById(R.id.F);
        S =(EditText) findViewById(R.id.S);
        Result = (TextView) findViewById(R.id.Result);
        Num1 =Double.parseDouble(F.getText().toString());
        Num2 = Double.parseDouble(S.getText().toString());
        if (v.getId()==R.id.Add){
            Sum=Num1+Num2;
            Result.setText(Double.toString(Sum));
        }
       else if (v.getId()==R.id.Sub){
            Sum=Num1-Num2;
            Result.setText(Double.toString(Sum));
        }
    }
}