[ Tech News ] Firefox Quantum, Open Challenge To Chrome

To all chrome lovers, I think it's time you should take a look at Firefox Quantum. Firefox new version that is Quantum, is quite a browser. As said by Firefox it is twice as fast from it's previous versions.




From Layman terms, it's blazing fast, secure and more over it doesn't take much of your memory. So, I have been using it for 7 days, and I think, I am quite happy by using it. Unlike chrome, your privacy is not compromised, neither your memory nor speed.

Verdict : I think this may bring revolution in browser's history. If you are chrome lover, it's time to change your browser. For Firefox user, it's a gift from them browse on it .

Read More at Firefox Page

[Android Tutorial] Press back button twice to exit app

Few Apps have the feature to close the app when back button is pressed twice. This feature comes handy when there is accidental press of back button. This feature allows the user to close the app only when back button is pressed twice.

Today we will be showing you how to implement this on your own app.

We will be using a custom toast to demonstrate this features. But you may want to try this on default toast settings too.

We will be using this on the MainActivity.java file but you may want to use accordingly to any class file. Preferred is the home activity file.

Step 1 Create a variable of integer type and assign its value to 0.
Ex - int count = 0;
Step 2 Create a method onBackPressed() to  override the default back settings.

Paste the following code -

public void onBackPressed()
{
    if(count == 1)
    {
        count=0;
        finish();
    }
    else    {
        
        LayoutInflater inflater = getLayoutInflater();
        View layout = inflater.inflate(R.layout.custom_toast,
                (ViewGroup) findViewById(R.id.custom_toast_container));

        TextView text = (TextView) layout.findViewById(R.id.text);
        text.setText("Press Back again to Exit");

        final Toast toast = new Toast(getApplicationContext());
        toast.setGravity(Gravity.BOTTOM, 0, 0);
        toast.setDuration(Toast.LENGTH_LONG);
        toast.setView(layout);
        toast.show();
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override            public void run() {
                toast.cancel();
            }
        }, 800);
        count++;
    }

    return;
}



Step 3 Create a new .xml file named custom_toast.xml inside the res/layout/ directory.
Paste the following code - 
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:id="@+id/custom_toast_container"    android:orientation="horizontal"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:padding="8dp"    android:background="#FFF"    >
    <ImageView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginRight="8dp"        tools:ignore="ContentDescription,RtlHardcoded" />
    <TextView android:id="@+id/text"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:textColor="#FF4C4C"        />
</LinearLayout>


Step 4 Now run the app it should work perfectly.
Step 5 Enjoy! profit.
Screenshots:-

Comments