Tutorial by Examples: android

Android Studio is the Android development IDE that is officially supported and recommended by Google. Android Studio comes bundled with the Android SDK Manager, which is a tool to download the Android SDK components required to start developing apps. Installing Android Studio and Android SDK tools:...
project/jni/main.c #include <stdio.h> #include <unistd.h> int main(void) { printf("Hello world!\n"); return 0; } project/jni/Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := hello_world LOCAL_SRC_FILES := main.c include $(BU...
For Android, here is the code we recommend for generating, persisting and retrieving a UUID. There is not constructor that accepts the UUID as a parameter, so you must instantiate Pubnub object first then use the setter to provide the UUID. // creating the Pubnub connection object with minimal args...
In this tutorial we're going to learn how to set up the PayPal Android SDK to process a simple payment via either a PayPal payment or a credit card purchase. At the end of this example, you should have a simple button in an application that, when clicked, will forward the user to PayPal to confirm a...
<PROJECT_ROOT>\app\build.gradle is specific for app module. <PROJECT_ROOT>\build.gradle is a "Top-level build file" where you can add configuration options common to all sub-projects/modules. If you use another module in your project, as a local library you would have another...
execute the following command to insert the text into a view with a focus (if it supports text input) 6.0 Send text on SDK 23+ adb shell "input keyboard text 'Paste text on Android Device'" If already connected to your device via adb: input text 'Paste text on Android Device' 6...
This example shows how to check permissions at runtime in Android 6 and later. public static final int MULTIPLE_PERMISSIONS = 10; // code you want. String[] permissions = new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA, Manifest.permission.ACC...
This tutorial explains how to download Image using AsyncTask in Android. The example below download image while showing progress bar while during download. Understanding Android AsyncTask Async task enables you to implement MultiThreading without get Hands dirty into threads. AsyncTask enables pro...
If you are able to download an update of Android Studio, but after it restarts nothing happens, check out the following example: After the patch was downloaded and Android Studio closed, open the terminal Go to your android studio folder, e.g. cd ~/android-studio Go to bin subfolder: cd bin ...
<PROJECT_ROOT>\app\build.gradle is specific for app module. <PROJECT_ROOT>\build.gradle is a "Top-level build file" where you can add configuration options common to all sub-projects/modules. If you use another module in your project, as a local library you would have another...
From the official documentation: Gradle. dependencies { compile "com.squareup.picasso:picasso:2.5.2" } Maven: <dependency> <groupId>com.squareup.picasso</groupId> <artifactId>picasso</artifactId> <version>2.5.2</version> </dep...
The Android specific implementation is a bit more complex because it forces you to inherit from a native Java.Lang.Object and forces you to implement the IOnInitListener interface. Android requires you to provide a valid Android context for a lot of the SDK methods it exposes. Xamarin.Forms exposes ...
Complete the Installation and setup part. This will create the project in Firebase console and will also install the base SDK in your Android App. Add the dependency for Firebase Realtime Database to your app-level build.gradle file: compile 'com.google.firebase:firebase-database:9.4.0' N...
DBContract.java //Define the tables and columns of your local database public final class DBContract { /*Content Authority its a name for the content provider, is convenient to use the package app name to be unique on the device */ public static final String CONTENT_AUTHORITY =...
This is a minimalist Hello World example that uses only the most basic Android tools. Requirements and assumptions Oracle JDK 1.7 or later Android SDK Tools (just the command line tools) This example assumes Linux. You may have to adjust the syntax for your own platform. Setting up the And...
Android Studio can configure Kotlin automatically in an Android project. Install the plugin To install the Kotlin plugin, go to File > Settings > Editor > Plugins > Install JetBrains Plugin... > Kotlin > Install, then restart Android Studio when prompted. Configure a project Cr...
With more and more battery optimizations being put into the Android system over time, the methods of the AlarmManager have also significantly changed (to allow for more lenient timing). However, for some applications it is still required to be as exact as possible on all Android versions. The follow...
Build.VERSION_CODES is an enumeration of the currently known SDK version codes. In order to conditionally run code based on the device's Android version, use the TargetApi annotation to avoid Lint errors, and check the build version before running the code specific to the API level. Here is an exa...
Assume an application with a MainActivity which can call the Next Activity using a button click. public class MainActivity extends AppCompatActivity { private final String LOG_TAG = MainActivity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { ...
This will trigger the native email client for sharing text. Parameters : Email To address, Subject, Body. Code Sample : you can call the function wherever you need, (mostly inside click listeners) like below Calling function shareEmail("[email protected]", "Email sharing example&q...

Page 1 of 7