Found 2041 Articles for Mobile Development

How to prevent going back to the previous activity in Android?

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

1K+ Views

There are so many situations, where we should not call back action when user click on back button.This example demonstrates how to integrate Android Login and register form.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/actvity_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.Toast; public class MainActivity extends AppCompatActivity {    int view = R.layout.activity_main;    @RequiresApi(api = ... Read More

How to get Custom circle button in android?

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

4K+ Views

This example demonstrates how to get Custom circle button in android.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/actiivity_main.xml.     In the above code, we have taken the button with a round_button background. so create round_button.xml in drawable folder and add the following code.                                                   ... Read More

How to determine if running on a rooted device or not in Android?

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

2K+ Views

In some cases, we should not allow application should run on rooted devices for payment gateways. This example demonstrates how to determine if running on a rooted device or not.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.     In the above code, we have taken a text view. It contains information about root.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; ... Read More

How to check email Address Validation in Android on edit Text

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

3K+ Views

This example demonstrates how to check email Address Validation in Android on edit Text.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.         In the above code, we have taken edit text and button. When the user clicks on a button, it will check edit text data and validate that data.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import ... Read More

How to add shadow Effect for a Text in Android?

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

2K+ Views

This example demonstrates how to add shadow Effect for a Text in Android.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.     In the above code, we have taken a text view with shadow properties as shown below -android:shadowColor = "#000" android:shadowDx = "-2" android:shadowDy = "-2" android:shadowRadius = "1"In the above tags indicates about shadow color, Axis's(X, Y) and shadow radius for text view.Step 3 − Add the following code to src/MainActivity.javapackage ... Read More

How do I programmatically “restart” an Android app?

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

2K+ Views

There are some situations, we need to restart whole application programmatically. This example demonstrates how do I programmatically “restart” an Android app.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.     In the above code, we have taken a text view. When the user clicks on text view, it will restart the whole application.package com.example.andy.myapplication; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; ... Read More

How can I get the current screen orientation in Android?

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

2K+ Views

In some situation, we need to find an android activity orientation. This example demonstrates how to integrate Android Login and registration form.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.     In the above code, we have taken a text view. According to screen orientation, text view going to update the text.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; ... Read More

How to verify enter number is phone number or not using regex in android?

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

2K+ Views

This example demonstrates how to verify enter number is phone number or not, using regex in android.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.         In the above code, we have taken Edit text and text view. when the user clicks on text view, it will take data from edit text and valid the data.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; ... Read More

How to remove shadow below action bar in Android?

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

1K+ 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

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

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

637 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

Advertisements