Category: Program

shape
shape
shape
shape
shape
shape
shape
shape
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

Standard

Android Toolbar Back Button

It’s always convenient to have that little button to “go back” to the previous Activity, and to add it is very simple, just add a directive in your“AndroidManifest.xml“.     <activity android:name=”.BackButtonActivity” android:parentActivityName=”.MainActivity”> <!– Este meta dado é necessário para versões abaixo da 4.1 –> <meta-data android:name=”android.support.PARENT_ACTIVITY” android:value=”.MainActivity” /> </activity> MainActivity corresponds to the Activity

Latest news

Latest news directly from our blog.