Found 1966 Articles for Apps/Applications

Android Recyclerview GridLayoutManager column spacing

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

2K+ Views

This example demonstrates about Android Recyclerview GridLayoutManager column spacingStep 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 recyclerview.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.annotation.TargetApi; import android.os.Build; import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; public class ... Read More

Android create shortcuts on the home screen

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

766 Views

This example demonstrates about Uninstall APKs programmaticallyStep 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.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.support.v4.content.pm.ShortcutInfoCompat; import android.support.v4.content.pm.ShortcutManagerCompat; import android.support.v4.graphics.drawable.IconCompat; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity {    private static final String PREF_KEY_SHORTCUT_ADDED = "Sairam";    TextView ... Read More

How to use take() in android ArrayBlockingQueue?

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

62 Views

Before getting into the example, we should know what arrayblockingqueue is, it travels FIFO manner and the first element going to live the longest period of time and last element of the queue going to live a short period of the time.This example demonstrates about How to use take() in android ArrayBlockingQueueStep 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 ... Read More

How to use take() in android PriorityBlockingQueue?

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

104 Views

Before getting into the example, we should know what PriorityBlockingQueue is. It is an unbounded queue and follows the same order as a priority queue. The main usage of priority blocking queue is, it going to handle out of memory error.This example demonstrates about How to use take() in android PriorityBlockingQueueStep 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 PriorityBlockingQueue ... Read More

How to use subList() in android CopyOnWriteArrayList?

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

88 Views

Before getting into the example, we should know what CopyOnWriteArrayList is. It is a thread-safe variant of ArrayList and operations add, set, and so on by making a fresh copy of the underlying array.This example demonstrates about How to use subList() 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 a text view to show CopyOnWriteArrayList elements.Step 3 − Add the following code ... Read More

How to use size() in android ConcurrentLinkedQueue?

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

67 Views

Before getting into the example, we should know what ConcurrentLinkedQueue is, it is an unbounded queue based on linked nodes. Multiple threads can access queue elements with safety. Elements travel based on queue strategy as FIFO and elements going to insert from a tail. It does not allow null values.This example demonstrates about How to use size() in android ConcurrentLinkedQueueStep 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, ... Read More

How to use size() in android PriorityBlockingQueue?

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

57 Views

Before getting into the example, we should know what PriorityBlockingQueue is. It is an unbounded queue and follows the same order as a priority queue. The main usage of priority blocking queue is, it going to handle out of memory error.This example demonstrates about How to use size() in android PriorityBlockingQueueStep 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 PriorityBlockingQueue ... Read More

How to use size() in android LinkedBlockingDeque?

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

46 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 size() 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 size() in android CopyOnWriteArraySet?

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

53 Views

   Before getting into an example, we should know what CopyOnWriteArraySet is. It is a thread-safe variant of ArrayList and operations add, set, and so on by making a fresh copy of the underlying array.This example demonstrates about How to use size() in android CopyOnWriteArraySetStep 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 CopyOnWriteArraySet elements.Step 3 − Add the following ... Read More

How to make full screen custom dialog in Android?

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

3K+ Views

This example demonstrate about How to make full screen custom dialog.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 custom dialog.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.app.Activity; import android.graphics.Rect; 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.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.Button; ... Read More

Advertisements