Found 1631 Articles for Android

How to add first element in android ConcurrentLinkedDeque?

karthikeya Boyini
Updated on 30-Jun-2020 12:58:00

63 Views

Before getting into example, we should know what ConcurrentLinkedDequeis, it is unbounded deque based on linked nodes. Multiple threads can access deque elements with safety.This example demonstrate about How to add first element in android ConcurrentLinkedDequeStep 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 text view to showConcurrentLinkedDequeelements.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import ... Read More

How to add element based on index in android CopyOnWriteArrayList?

Samual Sam
Updated on 30-Jun-2020 12:56:41

71 Views

Before getting into example, we should know what CopyOnWriteArrayListis. It is a thread-safe variant of ArrayListand operations add, set, and so on by making a fresh copy of the underlying array.This example demonstrate about How to add element based on index in android CopyOnWriteArrayListStep 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 text view to showCopyOnWriteArrayListelements.Step 3 − Add the following code to src/MainActivity.javapackage ... Read More

How to check edit text's text is email address or not?

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

136 Views

Before getting into example, we should know test scenario. In login page, usually we takes email id and pass word from edit text. While taking email id from editext. we should know, it is valid format or not.This example demonstrate about how to check edit text's text is email address 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 layout we have added edit text and ... Read More

In Android how to register a custom Intent filter to a broadcast receiver?

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

2K+ Views

Before getting into the example, we should know what is intent filter in android. An intent filter is an instance of the IntentFilter class. Intent filters are helpful while using implicit intents, It is not going to handle in java code, we have to set it up in AndroidManifest.xml. Android must know what kind of intent it is launching so intent filters give the information to android about intent and actions.Before launching intent, android going to test action test, category test and data test. This example demonstrate about how to use custom intent filters to a broadcast receiver in android.Step ... Read More

What is Radio Group in android?

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

225 Views

Before getting into example, we should know, What is radio group in android. Radio Group contains group of radio buttons. Using radio buttons we can select and un select according to user requirements.This example demonstrate about how to use radio group 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.                                     ... Read More

What is Linkify Textview in android?

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

967 Views

Before getting into the example we should know, what is linkify. Linkify is just like a Hyper link in HTML. Using that we can browse the content. Here is the simple solution to use linkify with textview 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 XML, we have given a textview, textview contains text and web url link.Step 3 − Add the following code to src/MainActivity.javaimport android.os.Bundle; ... Read More

Example on ToggleButton?

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

138 Views

Before getting into example, we should know what is togglebutton in android, Toggle button is extended view of Button view. It going to represent of state of button as checked and unchecked. Here is the simple solution about toggle 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/activity_main.xml.     In the above code we have added toggle button, when user click on toggle button it going to change the state.Step 3 ... Read More

How to create ripple animation in my Android App?

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

455 Views

Before getting into the code, we should know what is ripple animation in android. Ripple animation is just like wave momentum. In android it is appears on view like Textview, Button, etc using background attribute.This example demonstrate about how to integrate ripple animation to view.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 added a button with back ground as ripple.Step 3 − Create a file ... Read More

How to convert HASHMAP to JSON using GSON in Android?

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

988 Views

GSON is java library, It is used to convert OBJECT to JSON and JSON to Object. Internally it going to work based on serialization and deserialization.This example demonstrates how to convert HASHAMP to JSON using GSON library.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 in build.gradle.apply plugin: 'com.android.application' android {    compileSdkVersion 28    defaultConfig {       applicationId "com.example.andy.myapplication"       minSdkVersion 15       targetSdkVersion 28       versionCode ... Read More

How to use the apply() in Android Shared preferences with example?

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

385 Views

Before getting into shared preference apply(), we should know what is shared preferences in android. Using share preference, we can store or retrieve values as key and value pair. There are five different methods are available in share preference as shown below -Edit()- It going to edit shared preference valuescommit()- it going to commit shared preference values in xml fileapply()- It going to commit back changes from editor to shared preference.remove(String key)- It going to remove key and vales from shared preference use key.Put()- It going to put key and values to shared preference xml.A sample example syntax of shared ... Read More

Advertisements