Found 1631 Articles for Android

How to create a dialog with Neutral options?

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

316 Views

This example demonstrate about How to create a dialog with Neutral options.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 button. When user click on button, it will show dialog.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.content.DialogInterface; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    @RequiresApi(api = ... Read More

How to use removeLast() in android LinkedBlockingDeque?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

48 Views

Before getting into an example, we should know what LinkedBlockingDeque is. It is implemented by Collection interface and the AbstractQueue class. It provides optional boundaries based on linked nodes. It going to pass memory size to the constructor and helps to provide memory wastage in android.This example demonstrates about How to use removeLast() in android LinkedBlockingDequeStep 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 ... Read More

How to use Fade In and Fade Out Android Animation in Java?

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

1K+ Views

Fade in and fade out animation works based on alpha animation class. This example demonstrate about How to use Fade In and Fade Out Android Animation in Java.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/login.xml.             In the above code, we have taken imageview and two button. FadeIn button will provide fade enter animation to image view and FadeOut button provide fade exit animation to imageview.Step 3 − ... Read More

How to use removeLast() in android ConcurrentLinkedDeque?

Nitya Raut
Updated on 30-Jul-2019 22:30:25

54 Views

Before getting into the example, we should know what ConcurrentLinkedDeque is, it is unbounded deque based on linked nodes. Multiple threads can access deque elements with safety.This example demonstrates about How to use removeLast() 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 a text view to show ConcurrentLinkedDeque elements.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Build; import android.os.Bundle; ... Read More

How to use removeFirstOccurrence() in android LinkedBlockingDeque?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

73 Views

Before getting into the example, we should know what LinkedBlockingDeque is. It is implemented by Collection interface and the AbstractQueue class. It provides optional boundaries based on linked nodes. It going to pass memory size to a constructor and helps to provide memory wastage in android.This example demonstrates about How to use removeFirstOccurrence() in android LinkedBlockingDequeStep 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 ... Read More

How to change line color in EditText

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

3K+ Views

In some situations, we should change edit text bottom line color according to background color. This example demonstrate about how to change line color in EditText.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, To change line color use the following code for edit text -android:backgroundTint="@android:color/holo_green_light"We can change color as per project requirement. we have taken green color for sample.Step 3 ... Read More

How do we use runOnUiThread in Android?

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

5K+ Views

Before getting into example, we should know what is runOnUiThread() in android. Sometimes Main thread performs some heavy operations. if user wants to add some extra operations on UI, it will get load and provides ANR. Using runOnUiThread going to do back ground operations on worker thread and update the result on main thread.This example demonstrate about How do we use runOnUiThread 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

How do I prevent Android taking a screenshot when my app goes to the background?

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

961 Views

In some situations, we should not allow to take screen shots of our application. This example demonstrate about how do I prevent Android taking a screenshot when my app goes to the 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 code, we have taken text view for some sample view.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 ... Read More

How to use removeFirstOccurrence() in android ConcurrentLinkedDeque?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

48 Views

Before getting into an example, we should know what ConcurrentLinkedDeque is, it is unbounded deque based on linked nodes. Multiple threads can access deque elements with safety.This example demonstrates about How to use removeFirstOccurrence () 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 a text view to show ConcurrentLinkedDeque elements.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Build; ... Read More

How android YouTube app Play Video from Intent

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

2K+ Views

In some situations, we should open you tube application from our application to show some specific video. This example demonstrate about How android YouTube app Play Video from Intent.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 text view. When you click on text view, it will open YouTube application.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; ... Read More

Advertisements