Saturday, December 15, 2018

how to calculate balance with previous value.

Consider this example, which uses a non-temporary table... 
DROP TABLE IF EXISTS temp;

CREATE TABLE temp
(slno INT NOT NULL AUTO_INCREMENT PRIMARY KEY
,debit INT null
,credit INT null
);


INSERT INTO temp VALUES
(1,10,0),
(2,0,40),
(3,50,0),
(4,0,10),
(5,0,10);

SELECT * FROM temp;
+------+-------+--------+
| slno | debit | credit |
+------+-------+--------+
|    1 |    10 |      0 |
|    2 |     0 |     40 |
|    3 |    50 |      0 |
|    4 |     0 |     10 |
|    5 |     0 |     10 |
+------+-------+--------+

SELECT x.slno
     , x.debit
     , x.credit
     , SUM(y.bal) balance 
  FROM
     ( 
       SELECT *,debit-credit bal FROM temp
     ) x
  JOIN
     ( 
       SELECT *,debit-credit bal FROM temp
     ) y
    ON y.slno <= x.slno
 GROUP 
    BY x.slno;

+------+-------+--------+---------+
| slno | debit | credit | balance |
+------+-------+--------+---------+
|    1 |    10 |      0 |      10 |
|    2 |     0 |     40 |     -30 |
|    3 |    50 |      0 |      20 |
|    4 |     0 |     10 |      10 |
|    5 |     0 |     10 |       0 |
+------+-------+--------+---------+

Note, my balance differs from yours - but I assume that's because you made a mistake!?!

Source

Monday, November 19, 2018

Git Tags - what, why, when and how

Git TAGS - What | Why | When | How
Today We will learn: -------------------------------
1. What are tags / releases
2. Why should i create TAGs
3. When to create TAGs
4. How to create TAGs in git

create | show | publish | delete

Step 1:
Checkout the branch where you want to create the tag
git checkout "branch name"
example : git checkout master
________________________________________________________


Step 2:
Create tag with some name
git tag "tag name"
example : git tag v1.0
git tag -a v1.0 -m "ver 1 of .." (to create annotated tags)
________________________________________________________

Step 3:
Display or Show tags
git tag
git show v1.0
git tag -l “v1.*”
________________________________________________________

Step 4:
Push tags to remote
git push origin v1.0
git push origin --tags
git push --tags (to push all tags at once)
________________________________________________________

Step 5:
Delete tags (if required only) to delete tags from local :
git tag -d v1.0
git tag --delete v1.0

to delete tags from remote :
git push origin -d v1.0
git push origin --delete v1.0
git push origin :v1.0
to delete multiple tags at once:
git tag -d v1.0 v1.1 (local)
git push origin -d v1.0 v1.1 (remote)


________________________________________________________

Checking out TAGS

 We cannot checkout tags in git
We can create a branch from a tag and checkout the branch
git checkout -b "branch name" "tag name" example :
git checkout -b ReleaseVer1 v1.0
 ________________________________________________________
Creating TAGS from past commits
git tag "tag name" "reference of commit"
example : git tag v1.2 5fcdb03




source

how to see git log and diff

source
How to see logs and diff in Git

git log --stat


  • git log --stat
to show all where file was changed.
how may lines are modified added or deletion like this.


 new_file.txt | 1 +
 1 file changed, 1 insertion(+)


  • git log -p
You will see like this.
    new added p

diff --git a/new_file.txt b/new_file.txt
index 8646659..b5f7bcb 100644
--- a/new_file.txt
+++ b/new_file.txt
@@ -1 +1,2 @@
 this is new file
+now added p word
\ No newline at end of file


Different between commit 

after change the file , where is changed to show this. you need to check differ.
  • git diff
 $ git diff
diff --git a/new_file.txt b/new_file.txt
index b5f7bcb..7f6d181 100644
--- a/new_file.txt
+++ b/new_file.txt
@@ -1,2 +1,4 @@
 this is new file
-now added p word
\ No newline at end of file
+now added p word
+changed
+another
\ No newline at end of file


Only changes file show

  • git diff --word-diff
$ git diff --word-diff

diff --git a/new_file.txt b/new_file.txt
index b5f7bcb..b11d6b6 100644
--- a/new_file.txt
+++ b/new_file.txt
@@ -1,2 +1,4 @@
this is new file
now {+new+}  added p word
{+changed+}
{+another+}

Fetch and Pull


when you work a branch with team you need checkout branch.
before work or push you need to pull first.

if anyone change their branch you must pull first and then push.

but if you fatch all branch to your repository, you can write 'git fetch origin master'

  • git pull origin master
  • git push origin master

  • git checkout -b dev
  • git checkout -b dev-amirul
  •  
  • git checkout dev
  •  
  • git branch
  • git push origin dev.


















Thursday, November 15, 2018

Host file added windows 10, 8

For Windows 10 and 8
  1. Press the Windows key.
  2. Type Notepad in the search field.
  3. In the search results, right-click Notepad and select Run as administrator.
  4. From Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts
  5. Make the necessary changes to the file.
  6. Click File > Save to save your changes.
For Windows 7 and Vista
  1. Click Start > All Programs > Accessories.
  2. Right-click Notepad and select Run as administrator.
  3. Click Continue on the Windows needs your permission UAC window.
  4. When Notepad opens, click File > Open.
  5. In the File name field, type C:\Windows\System32\Drivers\etc\hosts.
  6. Click Open.
  7. Make the necessary changes to the file.
  8. Click File > Save to save your changes.
For Windows NT, Windows 2000, and Windows XP
  1. Click Start > All Programs > Accessories > Notepad.
  2. Click File > Open.
  3. In the File name field, type C:\Windows\System32\Drivers\etc\hosts.
  4. Click Open.
  5. Make the necessary changes to the file.
  6. Click File > Save to save your changes.

Wednesday, November 14, 2018

laravel project from github setup step by step




1. Pull Laravel/php project from git provider.
 
 
 
2. Rename .env.example file to .env inside your project root and fill the database information. (windows wont let you do it, so you have to open your console cd your project root directory and run mv .env.example .env )
 
windows: copy .env.exmple to .env
 
3.  create database name and set .env file as your phpmyadmin setting.

4. Open the console and cd your project root directory

Run composer install or php composer.phar install
 
 
5. Run php artisan key:generate
6. Run php artisan migrate
7. Run php artisan db:seed to run seeders, if any.
8. Run php artisan serve

Tuesday, November 13, 2018

use back4app.com for parsing data from server very easy







Step 1 - Set up

At the beginning of each Parse activity, import the following:
1
2
3
4
5
6
7
8
9
10
11
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseUser;  


Step 2 - Sign Up

Signing up basically involves saving a new object of class ParseUser, shown as “User” in your app Dashboard, and setting at least two of its pre-defined attributes: username and password. In order to set these attributes, two specific methods of this class are used: ParseUser.setUsername() and ParseUser.setPassword().
The method used for saving the new user on the Dashboard is ParseUser.signUpInBackground(), which may come together with a callback function.
Note: Objects of this special class are not saved on the Dashboard with ParseObject.save() method.
To make SignUpActivity work, follow these steps:
  1. Import into your SignUpActivity, in addition to the dependencies imported in Step 1:
    1
    import com.parse.SignUpCallback;
    
  2. To implement user registration, simply use the following code:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    ParseUser user = new ParseUser();
    // Set the user's username and password, which can be obtained by a forms
    user.setUsername(<Insert Username Here>);
    user.setPassword(<Insert User Password Here>);
    user.signUpInBackground(new SignUpCallback() {
        @Override
        public void done(ParseException e) {
            if (e == null) {
                alertDisplayer("Sucessful Sign Up!","Welcome" + <Insert Username Here> + "!");
            } else {
                ParseUser.logOut();
                Toast.makeText(SignUpActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
           }
        }
    });
    
    In the example project, this code is placed inside a SIGN UP button callback.
    Also, username and password are caught using Edit Texts.
  3. It’s interesting to add an additional method to display Alert Dialogs and make the process look more professional. The method below do this:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    private void alertDisplayer(String title,String message){
           AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this)
                   .setTitle(title)
                   .setMessage(message)
                   .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                       @Override
                       public void onClick(DialogInterface dialog, int which) {
                           dialog.cancel();
                           // don't forget to change the line below with the names of your Activities
                           Intent intent = new Intent(SignUpActivity.this, LogoutActivity.class);
                           intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
                           startActivity(intent);
                       }
                   });
           AlertDialog ok = builder.create();
           ok.show();
       }
    

Step 3 - Log in

Logging in creates a Session object, which points to the User logged in. If login is successful, ParseUser.getCurrentUser() returns a User object, and a Session object is created in the Dashboard. Otherwise, if the target username does not exist, or the password is wrong, it returns null.
The method used to perform the login action is ParseUser.logInInBackground(), which requires as many arguments as the strings of username and password, and may call a callback function.
Note: After signing up, login is performed automatically.
To make LoginActivity work, follow these steps:
  1. Import into your LoginActivity, in addition to the dependencies imported in the Step 1:
    1
    import com.parse.LogInCallback;
    
  2. To implement user login function, simply use the code:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    ParseUser.logInInBackground(<Insert Username Here>, <Insert User Password Here>, new LogInCallback() {
        @Override
        public void done(ParseUser parseUser, ParseException e) {
            if (parseUser != null) {
                alertDisplayer("Sucessful Login","Welcome back" + <Insert Username Here> + "!");
            } else {
                ParseUser.logOut();
                Toast.makeText(LoginActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
            }
        }
    });
    
    In the example project, this code is placed inside a LOG IN button callback.
    Also, username and password are caught using Edit Texts.
    The method alertDisplayer is the same that you added in the SignUpActivity, don’t forget to change its Intent arguments though.

Step 4 - Log Out

Logging out deletes the active Session object for the logged User. The method used to perform log out is ParseUser.logOut().
To implement user log out, simply use the code below, in the LogoutActivity:
1
2
3
// logging out of Parse
ParseUser.logOut();
alertDisplayer("So, you're going...", "Ok...Bye-bye then");
In the example project, this code is placed inside a LOG OUT button callback.
The method alertDisplayer is the same that you added in the LoginActivity and SignUpActivity, don’t forget to change its Intent arguments though.

Step 5 - Test your app

  1. Run your app and create a couple of users, also try logging in again after registering them.
  2. Login at Back4App Website.
  3. Find your app and click on Dashboard > Core > Browser > User.
At this point, you should see your users as displayed below:
Note: Using the codes displayed above, every time you log in with a user, a Session is opened in your Dashboard, but when the user logs out that particular Session ends. Also, whenever an unsuccessful login or sign up attempt occurs, the Session opened in Parse Server Dashboard is deleted.

It’s done!

At this stage, you can log in, register or log out of your app using Parse Server core features through Back4App!


Login RegistrationSource

back4app CRUD operation

Adminca

Sunday, November 11, 2018

selectable button in android studio | click a button show hovor in android studio

Today I will discuss about android studio button selection. How we can use a hover effect in this button. .

here the code , you use this code snap to your drawer folder and give a name as you want.
then you use this as a background in your button which is stayed in layout section.



thanks , I will talk to you another topics later.

Friday, November 9, 2018

Espresso dependencies

/*Espresso testing */
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

Full code of dependency:CODE



Toast message check




Code END




Saturday, November 3, 2018

how to create custome Matcher in Espresso android studio

Create a class name  ErrorMatcher in androidTest folder.


public class ErrorMatcher {



@NonNull

public static Matcher withError(final Matcher stringMatcher) {

return new BoundedMatcher(TextView.class) {


@Override

public void describeTo(final Description description) {
description.appendText("error text: ");
stringMatcher.describeTo(description);
}


@Override

public boolean matchesSafely(final TextView textView) {
return stringMatcher.matches(textView.getError().toString());
}
};
}
}


# Maching logic is to match the subtext of the textview with only the error message.

#describeTo method only for debug.

# you can use this as your custom matcher in the test case as shown in below.

===================


@Test 

public void testLoginMandatory()
{
    onView(withId(R.id.email_sign_in_button)).perform(click());
    onView(ErrorMatcher.withError(Matchers.
            containsString("The field is required"))).check(matches(isDisplayed()));

}



Source







Saturday, October 27, 2018

laravel project setup in ubuntu machine laravel 5.7 version.


At first you need to install composer in your machine,

Introduction

Composer  is a popular dependency management tool for PHP, created mainly to facilitate installation and updates for project dependencies. It will check which other packages a specific project depends on and install them for you, using the appropriate versions according to the project requirements.

This tutorial will explain how to install and get started with Composer on an Ubuntu 18.04 system.



  • sudo apt-get update
  • sudo apt install composer





Source here

for bootstrap configure

laravel task management project




For permission any file :

Laravel >= 5.4
php artisan cache:clear 
chmod -R 777 storage/
composer dump-autoload


How to Install Eclipse IDE in Ubuntu machine.

In this tutorial we will show you how to install the latest Eclipse in Ubuntu 18.04 machine.


Install Java:


  • sudo apt-get install default-jre

Install eclipse:


  1. sudo snap install --classic eclipse

after successfully installed of Eclipse , you should see the following output

  • eclipse 4.8.0 from 'snapcrafters' installed

Monday, October 15, 2018

HSC ICT MCQ






Privacy Policy



Privacy Policy

amirul Islam built the HSC ICT HUB app as a Free app. This SERVICE is provided by
amirul Islam at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure
of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in
relation to this policy. The Personal Information that I collect is used for providing and improving
the Service. I will not use or share your information with anyone except as described
in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is
accessible at HSC ICT HUB unless otherwise defined in this Privacy Policy.

Information Collection and Use

For a better experience, while using our Service, I may require you to provide us with certain
personally identifiable information. The information that I request will be retained on your device and is not collected by me in any way.

The app does use third party services that may collect information used to identify you.

Link to privacy policy of third party service providers used by the app

Log Data

I want to inform you that whenever you use my Service, in a case of
an error in the app I collect data and information (through third party products) on your phone
called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address,
device name, operating system version, the configuration of the app when utilizing my Service,
the time and date of your use of the Service, and other statistics.

Cookies

Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers.
These are sent to your browser from the websites that you visit and are stored on your device's internal
memory.

This Service does not use these “cookies” explicitly. However, the app may use third party code and
libraries that use “cookies” to collect information and improve their services. You have the option to
either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose
to refuse our cookies, you may not be able to use some portions of this Service.

Service Providers

I may employ third-party companies and individuals due to the following reasons:

  • To facilitate our Service;
  • To provide the Service on our behalf;
  • To perform Service-related services; or
  • To assist us in analyzing how our Service is used.

I want to inform users of this Service that these third parties have access to
your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However,
they are obligated not to disclose or use the information for any other purpose.

Security

I value your trust in providing us your Personal Information, thus we are striving
to use commercially acceptable means of protecting it. But remember that no method of transmission over
the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee
its absolute security.

Links to Other Sites

This Service may contain links to other sites. If you click on a third-party link, you will be directed
to that site. Note that these external sites are not operated by me. Therefore, I strongly
advise you to review the Privacy Policy of these websites. I have no control over
and assume no responsibility for the content, privacy policies, or practices of any third-party sites
or services.

Children’s Privacy

These Services do not address anyone under the age of 13. I do not knowingly collect
personally identifiable information from children under 13. In the case I discover that a child
under 13 has provided me with personal information, I immediately delete this from
our servers. If you are a parent or guardian and you are aware that your child has provided us with personal
information, please contact me so that I will be able to do necessary actions.

Changes to This Privacy Policy

I may update our Privacy Policy from time to time. Thus, you are advised to review
this page periodically for any changes. I will notify you of any changes by posting
the new Privacy Policy on this page. These changes are effective immediately after they are posted on
this page.

Contact Us

If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact
me.

This privacy policy page was created at privacypolicytemplate.net
and modified/generated by App
Privacy Policy Generator



Thursday, December 21, 2017

how to selected color in drawer item - কিভাবে DrawerItem সিলেক্টেড item কে color করা যায়

drawer_item_color.xml


<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="#101010"        android:state_checked="true" />
    <item android:color="#4D5D6C" />
</selector>


<android.support.design.widget.NavigationView    android:id="@+id/nav_view"    android:layout_width="wrap_content"    android:layout_height="match_parent"    android:layout_gravity="start"    android:fitsSystemWindows="true"    android:background="#EFEFEF"    app:itemIconTint="@color/bgcolor"    app:itemTextColor="@color/drawer_item_color" // এখানে ব্যবহার করা হয়েছে।
    app:headerLayout="@layout/nav_header_main"    app:menu="@menu/activity_main_drawer" />




কোন item ইউজার click করলে সেই item টি বিশেষ color করে দিয়া যাবে।

Navigation DrawerLayout নিয়ে কাজ করতে এটি জানা লাগবে। 
ভাল থাকুন  

How to know AM PM from the Hours- কিভাবে জাভাতে AM and PM নিয়ে কাজ করা যাই


 আজ আমরা দেখবো- কিভাবে android app তৈরি করার সময় অনেক সময় ২৪ ঘণ্টা মধ্যে ১২ ঘন্টা নিয়ে কাজ করার সময় am or pm দেখাতে হবে।
সে ক্ষেত্রে আমরা খুব সহজে use করতে পারি।

নিছে আমার একটি application এর কোড দিয়ে দিলাম। 
আশা করি আমার কোন একটি প্রোজেক্ট কাজে লাগবে।
আপনার ও লাগতে পারতে।


public void endTime(View view) {
        // Get Current Time        final Calendar c = Calendar.getInstance();
        mHour = c.get(Calendar.HOUR_OF_DAY);
        mMinute = c.get(Calendar.MINUTE);
        final SimpleDateFormat dateFormat = new SimpleDateFormat("hh.mm aa");


        // Launch Time Picker Dialog        TimePickerDialog timePickerDialog = new TimePickerDialog(this,
                new TimePickerDialog.OnTimeSetListener() {

                    @Override                    public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                        if(hourOfDay>= 0 && hourOfDay < 12){
                            timecountend = hourOfDay + " : "+minute+ " AM";
                        }else {
                            if(hourOfDay == 12){
                                timecountend = hourOfDay + " : "+minute+ " PM";
                            }else {
                                hourOfDay = hourOfDay -12;
                                timecountend = hourOfDay + " : "+minute+ " PM";
                            }
                        }

                        mHour = hourOfDay;
                        mMinute = minute;

                        etEnd.setText(timecountend);

                    }
                }, mHour, mMinute, false);
        timePickerDialog.show();



}


Monday, December 18, 2017

How to use day month year in android and java ক্যালেন্ডার ব্যবহার করে দিন বের করার জন্য জাভা প্রোগ্রাম-

দিন মাস বছর ঘন্টা মিনিট সেকেন্ড বের করতে হয় কিভাবে সেটা দেখবো

আজ আমি দেখাবো কিভাবে দিন বের করা যায়। আমি আমার একটি অ্যাাপ নিয়ে কাজ করার সময় দেখলাম মোবাইলে আজকের দিন বের করতে হচ্ছে তা নিয়ে কাজ করতে হবে। ইউজার কে বলতে হবে আজ আপনার কি কি কাজ আছে।
চলুন কথা না বলে শুরু করা যাক----



SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);


switch(dayOfWeek)
{
    case Calendar.SUNDAY:
        pos =1;
        break;
    case Calendar.MONDAY:
        pos =2;
        break;
    case Calendar.TUESDAY:
        pos =3;
        break;
    case Calendar.WEDNESDAY:
        pos =4;
        break;
    case Calendar.THURSDAY:
        pos =5;
        break;
    case Calendar.FRIDAY:
        pos =6;
        break;
    case Calendar.SATURDAY:
        pos =0;
        break;
}

এখানে switch case ব্যবহার করা হয়ছে। 
যা আমাদের দিন বের  DAY_OF_WEEK পূর্ণসংখ্যা রিটার্ণ করে। 

আপনি আপনার মত করে ব্যবহার করে পারবেন। আমার প্রজেক্ট থেকে এই আংশ টুকু এখানে রেখে দিলাম আপনার জন্য সাথে পরবর্তিতে আমিও ব্যবহার করতে পারবো 

ভাল থাকুন-- 


Friday, December 15, 2017

sqlite database - contact info save - android studio


MainActivity.java


public class MainActivity extends AppCompatActivity {

    EditText Name, Phone;
    DatabaseHandler databaseHandler = new DatabaseHandler(this);
    Contact contact = new Contact();

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Name = (EditText) findViewById(R.id.etName);
        Phone = (EditText) findViewById(R.id.etPhone);


       /* //reading all contact
        List<Contact> contactList = databaseHandler.getAllContacts();
        StringBuffer stringBuffer = new StringBuffer();
        for (Contact contact : contactList) {
            String s = contact.get_name() + contact.get_phone_name();            stringBuffer.append(s);        }



        //Toast.makeText(getApplicationContext(),stringBuffer,Toast.LENGTH_LONG).show();
*/    }

    public void saveContact(View view) {
        String name = Name.getText().toString();
        String phone = Phone.getText().toString();

        if(name.isEmpty() || phone.isEmpty()){

            Toast.makeText(getApplicationContext(),"Cannot empty",Toast.LENGTH_LONG).show();

        }else {

            contact =  new Contact(name,phone);
            databaseHandler.addContact(contact);
            Toast.makeText(getApplicationContext(),"Insert successufuly",Toast.LENGTH_LONG).show();
        }

    }

    public void showContact(View view) {
        Intent intent= new Intent(this,ShowContacts.class);
        startActivity(intent);
    }
}



================xml=============


<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:id="@+id/activity_main"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:paddingBottom="@dimen/activity_vertical_margin"    android:paddingLeft="@dimen/activity_horizontal_margin"    android:paddingRight="@dimen/activity_horizontal_margin"    android:paddingTop="@dimen/activity_vertical_margin"    tools:context="com.edupointbd.amirul.contacts1.MainActivity">

    <EditText        android:background="#cfcfce"        android:id="@+id/etName"        android:layout_marginTop="20dp"        android:textSize="30sp"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:hint="Enter Name" />
    <EditText        android:layout_marginTop="20dp"        android:background="@color/colorAccent"        android:id="@+id/etPhone"        android:textSize="30sp"        android:layout_below="@+id/etName"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:hint="Phone Number" />
    <Button        android:text="Save info"        android:layout_marginTop="50dp"        android:background="#123456"        android:textColor="#fff"        android:id="@+id/save"        android:onClick="saveContact"        android:layout_below="@+id/etPhone"        android:layout_width="match_parent"        android:layout_height="wrap_content" />
    <Button        android:text="Show info"        android:layout_marginTop="50dp"        android:background="#123456"        android:textColor="#fff"        android:onClick="showContact"        android:layout_below="@+id/save"        android:layout_width="match_parent"        android:layout_height="wrap_content" />
</RelativeLayout>


========================================================

package com.edupointbd.amirul.contacts1;

/** * Created by Amirul on 13-Dec-17. */
public class TableInfo {

    private TableInfo() {

    }

    public static class TableContacts{
        // Database Name        public static final String DATABASE_NAME = "contactsManager";

        // Contacts table name        public static final String TABLE_CONTACTS = "contacts";

        // Contacts Table Columns names        public static final String KEY_ID = "id";
        public static final String KEY_NAME = "name";
        public static final String KEY_PH_NO = "phone_number";

      public static   String CREATE_CONTACTS_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_CONTACTS + "("                + KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT,"                + KEY_PH_NO + " TEXT" + ")";

    }

}

============================================================

DatabaseHandler.java

package com.edupointbd.amirul.contacts1;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import java.util.ArrayList;
import java.util.List;

/** * Created by Amirul on 13-Dec-17. */
public class DatabaseHandler extends SQLiteOpenHelper {
    // Database Version    private static final int DATABASE_VERSION = 1;


    public DatabaseHandler(Context context) {
        super(context, TableInfo.TableContacts.DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override    public void onCreate(SQLiteDatabase db) {
        db.execSQL(TableInfo.TableContacts.CREATE_CONTACTS_TABLE);

    }

    @Override    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

        // Drop older table if existed        db.execSQL("DROP TABLE IF EXISTS " + TableInfo.TableContacts.TABLE_CONTACTS);

        // Create tables again        onCreate(db);
    }


    void addContact(Contact contact) {

        SQLiteDatabase database = this.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put(TableInfo.TableContacts.KEY_NAME, contact.get_name());
        values.put(TableInfo.TableContacts.KEY_PH_NO, contact.get_phone_name());

        //insert row        database.insert(TableInfo.TableContacts.TABLE_CONTACTS, null, values);
        database.close();

    }

    //getting single contact
    Contact getContact(int id) {

        String[] projection = {
                TableInfo.TableContacts.KEY_ID,
                TableInfo.TableContacts.KEY_NAME,
                TableInfo.TableContacts.KEY_PH_NO,
        };

        SQLiteDatabase db = this.getReadableDatabase();

        Cursor cursor = db.query(TableInfo.TableContacts.TABLE_CONTACTS, projection, TableInfo.TableContacts.KEY_ID + "=?", new String[]{String.valueOf(id)}, null, null, null, null);

        if (cursor != null) {
            cursor.moveToFirst();
        }
        Contact contact = new Contact(Integer.parseInt(cursor.getString(0)), cursor.getString(1), cursor.getString(2));
        return contact;
    }

    //getting all contacts
    public List<Contact> getAllContacts() {


        List<Contact> contactList = new ArrayList<>();
        //select all query        String selectQuery = "SELECT * FROM " + TableInfo.TableContacts.TABLE_CONTACTS;
        SQLiteDatabase database = this.getWritableDatabase();

        Cursor cursor = database.rawQuery(selectQuery, null);

        //looping throw all roe anf adding the list        if (cursor.moveToFirst()) {

            do {
                Contact contact = new Contact();
                contact.set_id(Integer.parseInt(cursor.getString(0)));
                contact.set_name(cursor.getString(1));
                contact.set_phone_name(cursor.getString(2));

                contactList.add(contact);

            } while (cursor.moveToNext());

        }
            cursor.close();
        //return contact list        return contactList;


    }

    //updating single contact
    public int UpdateContact(Contact contact) {

        SQLiteDatabase database = this.getWritableDatabase();

        ContentValues values = new ContentValues();

        values.put(TableInfo.TableContacts.KEY_NAME, contact.get_name());
        values.put(TableInfo.TableContacts.KEY_PH_NO, contact.get_phone_name());

        //update row
        return database.update(TableInfo.TableContacts.TABLE_CONTACTS, values, TableInfo.TableContacts.KEY_ID + " = ?", new String[]
                {String.valueOf(contact.get_id())});
    }

    //delete row
    public int deleteContact(Contact contact) {
        SQLiteDatabase database = this.getWritableDatabase();
        int de =database.delete(TableInfo.TableContacts.TABLE_CONTACTS, TableInfo.TableContacts.KEY_ID + " =? ",
                new String[]{String.valueOf(contact.get_id()) });


        database.close();
        return contact.get_id();
    }
}

========================================================

Contact.java

package com.edupointbd.amirul.contacts1;

/** * Created by Amirul on 13-Dec-17. */
public class Contact {

    //private varible    private int _id;
    private String _name;
    private String _phone_name;

    //constractor
    public Contact() {

    }

    //Constructor    public Contact(int _id, String _name, String _phone_name) {
        this._id = _id;
        this._name = _name;
        this._phone_name = _phone_name;
    }


    //Constructor without id    public Contact(String _name, String _phone_name) {
        this._name = _name;
        this._phone_name = _phone_name;
    }

    public int get_id() {
        return _id;
    }

    public void set_id(int _id) {
        this._id = _id;
    }

    public String get_name() {
        return _name;
    }

    public void set_name(String _name) {
        this._name = _name;
    }

    public String get_phone_name() {
        return _phone_name;
    }

    public void set_phone_name(String _phone_name) {
        this._phone_name = _phone_name;
    }
}

======================================================================


package com.edupointbd.amirul.contacts1;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.github.clans.fab.FloatingActionButton;
import com.github.clans.fab.FloatingActionMenu;



public class UpdateDelete extends AppCompatActivity {

    private FloatingActionMenu fam;
    private FloatingActionButton fabEdit, fabDelete, savedata;
    TextView idShow, nameShow, phoneShow;
    String namef= null;
    String phonef= null;
    int idgrobal=0;

    DatabaseHandler databaseHandler = new DatabaseHandler(this);
    Contact contact = new Contact();
    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_update_delete);

        idShow = (TextView)findViewById(R.id.tvshowId);
        nameShow = (TextView)findViewById(R.id.tvshowName);
        phoneShow = (TextView)findViewById(R.id.tvshowPhone);

        Intent intent = getIntent();
        String id = intent.getStringExtra("ID");
        String name = intent.getStringExtra("NAME");
        String phone = intent.getStringExtra("PHONE");


        namef = name;
        phonef = phone;
        int idn = Integer.valueOf(id);
        idgrobal = idn;

        contact = new Contact(idn,name,phone);

        idShow.setText(id);
        nameShow.setText(name);
        phoneShow.setText(phone);

        savedata = (FloatingActionButton) findViewById(R.id.savefab);
        fabDelete = (FloatingActionButton) findViewById(R.id.deletefab);
        fabEdit = (FloatingActionButton) findViewById(R.id.editfab);
        fam = (FloatingActionMenu) findViewById(R.id.fab_menu);

        //handling menu status (open or close)        fam.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() {
            @Override            public void onMenuToggle(boolean opened) {
                if (opened) {
                 //   showToast("Menu is opened");                } else {
                 //   showToast("Menu is closed");                }
            }
        });

        //handling each floating action button clicked        fabDelete.setOnClickListener(onButtonClick());
        fabEdit.setOnClickListener(onButtonClick());
        savedata.setOnClickListener(onButtonClick());

        fam.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {
                if (fam.isOpened()) {
                    fam.close(true);
                }
            }
        });



        //Toast.makeText(getApplicationContext(), "id "+id+" name"+name+" phone"+phone, Toast.LENGTH_SHORT).show();    }

    private View.OnClickListener onButtonClick() {

        return new View.OnClickListener() {
            @Override            public void onClick(View view) {
                if (view == savedata) {
                    showToast("Save Data successfully");

                } else if (view == fabDelete) {

                    //alert dialog                    AlertDialog.Builder builder = new AlertDialog.Builder(UpdateDelete.this);

                    builder.setTitle(Html.fromHtml("<font color='#FF7F27'>Delete Data</font>"));
                    String  nam= "Are you Delete "+ namef+"  ? ";
                    builder.setMessage(nam);
                    builder.setIcon(R.drawable.amirul);


                    builder.setPositiveButton("YES", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {

                            int de = databaseHandler.deleteContact(contact);
                            showToast(String.valueOf(de));
                            Intent intent = new Intent(getApplicationContext(),ShowContacts.class);
                            startActivity(intent);
                            finish();
                        }
                    });


                    builder.setNeutralButton("CANCEL", new DialogInterface.OnClickListener()     {
                        public void onClick(DialogInterface dialog, int id) {
                            Toast.makeText(getApplicationContext(),"CANCEL",Toast.LENGTH_LONG).show();
                        }
                    });
                    AlertDialog alert = builder.create();
                    alert.show();


                   // showToast("Button Delete clicked");                }
                else if (view == fabEdit) {

                    LayoutInflater li = LayoutInflater.from(UpdateDelete.this);
                    View view1 =li.inflate(R.layout.update,null);

                    AlertDialog.Builder builder = new AlertDialog.Builder(UpdateDelete.this);
                    builder.setView(view1);

                    final EditText namedialog = (EditText)view1.findViewById(R.id.etUpdateName);
                    final EditText phonedialog = (EditText)view1.findViewById(R.id.etUpdatephone);
                    namedialog.setText(namef);
                    phonedialog.setText(phonef);



                    //set dialog message                    builder.setCancelable(false)
                            .setPositiveButton("Update", new DialogInterface.OnClickListener() {
                                @Override                                public void onClick(DialogInterface dialog, int which) {

                                  databaseHandler.UpdateContact(new Contact(idgrobal,namedialog.getText().toString(),phonedialog.getText().toString()));
                                    Intent intent = new Intent(getApplicationContext(),ShowContacts.class);
                                    startActivity(intent);
                                    finish();
                                    showToast("Updated successfully");
                                   // Toast.makeText(getApplicationContext(),"CANCEL"+name +" "+phone,Toast.LENGTH_LONG).show();
                                }
                            })
                            .setNegativeButton("cencle", new DialogInterface.OnClickListener() {
                                @Override                                public void onClick(DialogInterface dialog, int which) {

                                }
                            });

                    //create alert dialog
                    AlertDialog alertDialog = builder.create();

                    //show dialog                    alertDialog.show();


                }
                fam.close(true);
            }
        };
    }

    private void showToast(String msg) {
        Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
    }
}

========================xml=============================================

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    xmlns:fab="http://schemas.android.com/apk/res-auto"    android:id="@+id/activity_update_delete"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical"    android:paddingBottom="@dimen/activity_vertical_margin"    android:paddingLeft="@dimen/activity_horizontal_margin"    android:paddingRight="@dimen/activity_horizontal_margin"    android:paddingTop="@dimen/activity_vertical_margin"    tools:context="com.edupointbd.amirul.contacts1.UpdateDelete">

    <TextView        android:id="@+id/tvshowId"        android:text="Name"        android:textSize="25dp"        android:layout_width="match_parent"        android:layout_height="wrap_content" />
    <TextView        android:id="@+id/tvshowName"        android:text="Name"        android:gravity="center"        android:background="#123456"        android:layout_marginTop="5sp"        android:textColor="#fff"        android:textSize="18sp"        android:layout_width="match_parent"        android:layout_height="wrap_content" />
    <TextView        android:id="@+id/tvshowPhone"        android:text="Name"        android:gravity="center"        android:background="#567890"        android:layout_marginTop="5sp"        android:textColor="#fff"        android:textSize="18sp"        android:layout_width="match_parent"        android:layout_height="wrap_content" />

    <com.github.clans.fab.FloatingActionMenu        android:id="@+id/fab_menu"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_alignParentBottom="true"        android:layout_alignParentRight="true"        android:paddingBottom="@dimen/activity_horizontal_margin"        android:paddingRight="@dimen/activity_horizontal_margin"        fab:menu_backgroundColor="#ccffffff"        fab:menu_fab_label="Choose an action"        fab:fab_colorNormal="#DA4336"        fab:fab_colorPressed="#E75043"        fab:fab_colorRipple="#99FFFFFF"        fab:fab_showShadow="true"        fab:menu_labels_colorNormal="#333333"        fab:menu_labels_colorPressed="#444444"        fab:menu_labels_colorRipple="#66FFFFFF"        fab:menu_labels_showShadow="true"        fab:menu_labels_maxLines="-1"        fab:menu_labels_position="left"        fab:menu_openDirection="up"        fab:fab_shadowColor="#66000000"        fab:menu_labels_ellipsize="end"        fab:menu_labels_singleLine="true">

        <com.github.clans.fab.FloatingActionButton            android:id="@+id/editfab"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:src="@android:drawable/ic_menu_edit"            fab:fab_label="Edit "            fab:fab_size="mini" />

        <com.github.clans.fab.FloatingActionButton            android:id="@+id/savefab"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:src="@android:drawable/ic_menu_save"            fab:fab_label="Save"            fab:fab_size="mini"            layout_height="" />

        <com.github.clans.fab.FloatingActionButton            android:id="@+id/deletefab"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:src="@android:drawable/ic_menu_delete"            fab:fab_label="Delete"            fab:fab_size="mini" />

    </com.github.clans.fab.FloatingActionMenu>
</LinearLayout>



=====================dont forget==========================

compile 'com.android.support:appcompat-v7:25.3.1'compile 'com.android.support:cardview-v7:25.0.0'compile 'com.android.support:recyclerview-v7:25.0.0'compile 'com.android.support:design:25.3.1'compile 'com.github.clans:fab:1.6.4'