background preloader

Android Dev Inside

Facebook Twitter

Media (audio / vidéo)

Orientation Management. Timer. AlertDialog (customized) ProgressDialog. Accelerometor - Movement/Motion detaction - shake (Android) SharedPreferences = Android similar NSUserDefaults from iPhone. Tuto. EditText. i18n. Intent. Launch custom App. Change application's starting activity - android. Secutity Dev Android. Secure Storage. Log. Class Overview API for sending log output.

Log

Generally, use the Log.v() Log.d() Log.i() Log.w() and Log.e() methods. The order in terms of verbosity, from least to most is ERROR, WARN, INFO, DEBUG, VERBOSE. Verbose should never be compiled into an application except during development. Debug logs are compiled in but stripped at runtime. Tip: A good convention is to declare a TAG constant in your class: private static final String TAG = "MyActivity"; and use that in subsequent calls to the log methods. Tip: Don't forget that when you make a call like Log.v(TAG, "index=" + i); that when you're building the string to pass into Log.d, the compiler uses a StringBuilder and at least three allocations occur: the StringBuilder itself, the buffer, and the String object.

Summary Constants public static final int ASSERT Priority constant for the println method. Constant Value: 7 (0x00000007) public static final int DEBUG Priority constant for the println method; use Log.d. Constant Value: 3 (0x00000003) Parameters. NFC II - Lecture d'un Tag sur Android. Dans cet article, nous allons voir comment lire un Tag NFC sur Android.

NFC II - Lecture d'un Tag sur Android

L'article sera illustré d'exemples issus de l'application Zen Wifi NFC. L'application Zen Wifi NFC permet de connecter automatiquement un appareil Android compatible NFC à un réseau Wifi, lors de la lecture d'un Tag spécifique. Tag Dispatch La puce NFC des appareils Android n'est active que si l'utilisateur en décide ainsi dans ses paramètres et si l'écran de l'appareil est déverrouillé.

Lorsqu'un Tag est détecté, Android va tenter de découvrir le type MIME de la donnée et aussi son URI. En fonction du type de message contenu dans le Tag, l'action de l'Intent envoyé sera différente.

Accessibility (a11y) Android

Understand the Activity Lifecycle   As a user navigates through, out of, and back to your app, the Activity instances in your app transition through different states in their lifecycle.

Understand the Activity Lifecycle  

The Activity class provides a number of callbacks that allow the activity to know that a state has changed: that the system is creating, stopping, or resuming an activity, or destroying the process in which the activity resides. Within the lifecycle callback methods, you can declare how your activity behaves when the user leaves and re-enters the activity. For example, if you're building a streaming video player, you might pause the video and terminate the network connection when the user switches to another app.

When the user returns, you can reconnect to the network and allow the user to resume the video from the same spot. In other words, each callback allows you to perform specific work that's appropriate to a given change of state. Crashing if the user receives a phone call or switches to another app while using your app. Figure 1. Android - What exactly does the post method do? Android - Differences between TextWatcher 's onTextChanged, beforeTextChanged and afterTextChanged. Android - How can I know when an EditText loses focus?