How to make back button twice to close an activity in Android?

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

937 Views

Sometimes we click back button unintentionally, When you click on a back button it will close your application or will go back to another activity. To avoid this problem, This example demonstrates how to make back button twice to close an activity.Step 1 - Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 - Add the following code to res/layout/activity_main.xml.     Step 3 - Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.os.VibrationEffect; ... Read More

MySQL DATE_FORMAT '%M' is used for short month?

Arjun Thakur
Updated on 30-Jul-2019 22:30:24

175 Views

The %M Date Format is not used for displaying short months like Jan for January, Feb for February, etc. You need to use DATE_FORMAT() function with %b format for short month. The syntax is as follows:SELECT DATE_FORMAT(yourColumnName, '%d-%b-%y') AS anyVariableName FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table DateFormatMonthDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> ShippingDate date,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command. The ... Read More

What are scavengers?

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

1K+ Views

Scavengers are also known as decomposers. They feed on the dead bodies and thus those who are dependent on decaying smelly matter. Some of the popular examples of decomposers are vultures, crows, hyenas, etc. It is a common myth that these scavengers are only carnivorous. They are even herbivores.Scavengers As Animal or BirdScavengers of dead plant material include termites that build nests in grasslands and then collect dead plant material for consumption within their accommodation i.e. the nest.Coprovores: Animals which consume feces, such as dung beetles are known as Coprovores.Detritivores: Animals that collect small particles of a dead animal or a ... Read More

Why we mention in MySQL WHERE 1=0?

George John
Updated on 30-Jul-2019 22:30:24

5K+ Views

The condition 1=0 can be used to stop the query from returning any rows. It returns empty set.The syntax is as follows:SELECT *FROM yourTableName WHERE 1=0;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table ConditionDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(10),    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command. The query is as follows:mysql> insert into ConditionDemo(Name) values('Larry'); Query OK, 1 row affected (0.10 sec) mysql> ... Read More

Can MySQL INT type be non-zero NULL?

Chandu yadav
Updated on 30-Jul-2019 22:30:24

362 Views

You can set the INT column to value NULL.The column INT type a nullable column. The syntax is as follows:INSERT INTO yourTableName(yourIntColumnName) values(NULL);To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table nullableIntDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Price int,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.80 sec)Insert the record as NULL for a int column ‘Price’. The query is as follows:mysql> insert into nullableIntDemo(Price) values(NULL); Query OK, 1 row affected (0.11 sec) mysql> insert into ... Read More

Why is Wuthering Heights a classic Victorian novel?

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

4K+ Views

Victorian writers were focusing on the dialogue and immediate action was witnessed by Wuthering Heights because it was tagged as a ‘rude’ and ‘coarse‘ piece of writing. Later commentators like C.P. Sanger in his famous essay, The Structure of Wuthering Heights, published in 1926, demonstrated in detail the accuracy of novel’s time scheme, topography, legal processes, and the strange symmetry of the family tree.Wuthering Heights As A ClassicWuthering Heights is not only a classic novel but also a pioneering text of the Gothic genre. It feels chaotic human emotions, with realness mixed with themes of death and supernatural events. Even ... Read More

How to remove shadow below action bar in Android?

Arjun Thakur
Updated on 30-Jul-2019 22:30:24

2K+ Views

By default, android provides shadow for action bar. This example demonstrates How to remove shadow below the action bar.Step 1 - Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 - Add the following code to res/layout/activity_main.xml.     Step 3 - Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    int view = R.layout.activity_main;    TextView text;    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)    @Override    protected void onCreate(Bundle savedInstanceState) ... Read More

Are punctuation marks a guide to good communication?

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

394 Views

Punctuation marks date back to at least the 5th century BC when there were hardly any insights to writing and there were only capital letters. While the basic rules of communication are not difficult to understand, still a confusion always bothers us during our interaction using British English or American English.Uses of Punctuation MarksThey help us in depicting our emotions in a better manner.Quotation marks to emphasize words and phrases.Quotation marks are used for purposes of dialogue, quotes, and titles.Comma, semicolon are also used to denote minor pauses while sleeping.Ellipses indicate the omission of words within something that is being quoted.Punctuation ... Read More

What is the difference between on, over, and above?

Vihan Rodrigues
Updated on 30-Jul-2019 22:30:24

6K+ Views

All these are prepositions and impart a sense of being something on the top of some other object. Therefore, we can say that all of them have a similar meaning-not largely but at least to some extent. However, similar meaning yet varied definitions still confuse many learners. So, here I explain the correct and simple definition along with the usage of these three confusing words.1. OnDefinition: Having covered something; part of the surfaceA simple definition of ‘On’ is-One thing is covering the other. Generally, it touches the other object or its surface. Also, it can a part of the surface in ... Read More

How do I add to each row in MySQL?

George John
Updated on 30-Jul-2019 22:30:24

589 Views

You can add a value to each row in MySQL using UPDATE command.Let us see when your column is an integer. The syntax is as follows:UPDATE yourTableName SET yourIntegerColumnName = yourIntegerColumnName+anyValue; UPDATE yourTableName SET yourIntegerColumnName = anyValue WHERE yourIntegerColumnName IS NULL;You can add a value for a date column name. The syntax is as follows:UPDATE yourTableName SET yourDateColumnName = DATEADD(yourDateColumnName, INTERVAL anyIntegerMonth)To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table addEachRowValue    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Amount int,    -> ShippingDate ... Read More

Advertisements