Found 1952 Articles for Apps/Applications

How to make a smooth image rotation in Android?

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

1K+ Views

This example demonstrates how to make a smooth image rotation 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 and image view. When you click on text view, Image will get rotate in anti clock direction.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.view.View; import android.view.animation.Animation; import android.view.animation.LinearInterpolator; ... Read More

How to get battery level and state in Android?

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

2K+ Views

This example demonstrates how to get battery level and state 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. it contains battery percentage.Step 3 - Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.BatteryManager; 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 = ... Read More

How to Counting Chars in EditText Changed Listener in Android?

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

1K+ Views

Some situations, we have to restrict an edit text for some characters. To solve this situation, in this example demonstrate how to Counting Chars in Edit Text Changed Listener.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 one edit text. It going to check the length of the entered characters, if it exceeds 5 then it shows an error message.Step 3 - Add the following ... Read More

How to check if android application is running background?

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

3K+ Views

There are so many situations, that we should find android application is running background or not. This example demonstrates how to check if an android application is running background.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 layout, it contains text view, when the application is in foreground mode, it shows text view else you will get information in a log.Step 3 - Add the following code to src/MainActivity.javapackage ... Read More

How to change position of Toast in Android?

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

2K+ Views

Before getting into an example, we should know what is toast in android. Toast is subclass for  java.lang.Object and used to show a short message for a short period of time after that is going to disappear.This example demonstrates how to change the position of Toast 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. when the user clicks on text ... Read More

How do I make a dotted/dashed line in Android?

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

3K+ Views

This example demonstrates how do I make a dotted/dashed line 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 text view with image view. Image view contains a dotted background. So create dotted.xml in drawable as shown below -             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 ... Read More

Can an Android Toast be longer than Toast.LENGTH_LONG?

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

244 Views

Sometimes we need to display more time then LENGTH_LONG. This example demonstrates how to show toast longer than Toast.LENGTH_LONG.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 a user clicks on text view, it will show toast for 1000 ms.Step 3 - Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.Gravity; ... Read More

How to switch between hide and view password in Android

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

1K+ Views

There are so many cases, it required to show password while entering password or after entered password. This example demonstrate about How to switch between hide and view password.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 given two TextInputEditText ... Read More

How to Stop EditText from gaining focus at Activity startup in Android

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

2K+ Views

There are so many situations where we don't required keyboard visibility when activity starts. This example demonstrate about how to Stop EditText from gaining focus at Activity startupStep 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 given on Edit Text. By Default it contains request focus.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.EditText; public class MainActivity extends ... Read More

How to make Two activities with different colored status bar in Android.

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

669 Views

There are so many situations, where we need to change the different action bar colors according toproject requirement . This example demonstrate about how to make Two activities with different colored status 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.     In the above code we have created on button when you click on button it going to call second activity.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import ... Read More

Advertisements