Category: Android

shape
shape
shape
shape
shape
shape
shape
shape
Standard

Android getColor() Requires API Level 23

When using a newer API (API level 23) with support for older API’s (API Level 15), we have a small problem when trying to change the background programmatically. “Call requires API level 23 (current min is 15)…” To solve this problem, Android offers ContextCompat: ContextCompat.getColor(context, R.color.suspendedAccount)  

Standard

Android Loading ProgressDialog

public class LoadingHelper { private static ProgressDialog progress; public void run(Context context, final CallbackInterface callback){ progress = ProgressDialog.show(context, “Carregando”, “Por favor, aguarde :D”, true); new Thread(new Runnable() { @Override public void run() { if(callback != null) callback.run(); } }).start(); } public static void dismiss(){ progress.dismiss(); } public interface CallbackInterface { public void run (); }

Standard

Activity Context VS getApplicationContext(): When to use ?

Any Android developer has encountered the problem of having to use the Activity’s own reference instead of using getApplicationContext(). Both Activity and getApplicationContext() are instances of Context, but the difference is that Activity has the context of the Activity itself, and getApplicationContext() is the Context of the Application. An Android application has several types of

Standard

Android: Using onActivityResult(), startActivityForResult() and setResult()

It is very common, when starting a new activity, to want to receive the data from that other activity at the end of the activity and then execute an action. Let’s look at an example: Let’s suppose I have a ListProducts activity and AddEditProduct. Within the ListProducts activity I click on the button to add

Latest news

Latest news directly from our blog.