Posts

Showing posts from July, 2017

ExoPlayer: Flexible Media Playback for Android (Google I/O '17)

Image
ExoPlayer is an open source media playback library for Android. Used by thousands of applications, it enables great media experiences and can be customized to suit individual needs. Recent additions to the library have ranged from a new high level API to advanced features such as multi-period DASH support and spatial audio. In this talk you’ll learn what’s new in ExoPlayer, as well as some of ExoPlayer’s key concepts, points of customization and inner workings. Related Link: > Android Developers > API Guides > Media and Camera > ExoPlayer

EditText with drawable icon

Image
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="20dp" android:orientation="vertical" tools:context="com.blogspot.android_er.androidedittextchanged.MainActivity"> android:layout_width="match_parent" android:layout_height="match_parent"> android:layout_width="match_parent" android:layout_height="match_parent" android:src="@android:mipmap/sym_def_app_icon"/> android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> android:id="@+id/title" android:layout_width="wrap_content" android:layout_hei

Set background and alpha of EditText

Image
Examples of Setting background and alpha of EditText: xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="20dp" android:orientation="vertical" tools:context="com.blogspot.android_er.androidedittextchanged.MainActivity"> android:layout_width="match_parent" android:layout_height="match_parent"> android:layout_width="match_parent" android:layout_height="match_parent" android:src="@android:mipmap/sym_def_app_icon"/> android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> android:id="@+id/title" android:layout_width="

EditText with custom shape (drawable)

Image
To create EditText with our own shape, create a drawable XML to define our custom shape: res/drawable/myshape.xml xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp" android:topLeftRadius="10dp" android:topRightRadius="10dp"/> Reference my shape in layout xml: xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="20dp" android:orientation="vertical" tools:context="com.blogspot.android_er.androidedittextchanged.MainActivity"> android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_cont

Download your FREE copy of 'Android Security Cookbook'

Image
Ensure your apps are as tight as can be from outside threats with this cookbook. With recipes you can take to newer versions when needed this 350 page download shows you how to catch the trickiest vulnerabilities before they become a problem and gives you, and your customers, the peace of mind you deserve. Download your FREE copy of ' Android Security Cookbook '

AutoCompleteTextView, subclass of EditText with Auto-complete function

Image
AutoCompleteTextView is a subclass of EditText that shows completion suggestions automatically while the user is typing. To implement AutoCompleteTextView in your app: Add the AutoCompleteTextView to your layout: xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="20dp" android:orientation="vertical" tools:context="com.blogspot.android_er.androidedittextchanged.MainActivity"> android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:autoLink="web" android:text="http://android-er.blogspot.com/" android:textStyle="bold"/> android:id="@+id/autocompletetextview" and

Another example of TextWatcher to monitor text changed in EditText

Image
Last show Monitor user action on EditText, and do something in onTextChanged() method of TextWatcher . It's another example to do something in afterTextChanged() method, don't care what and where is the change, just do something on the changed text. package com.blogspot.android_er.androidedittextchanged; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.text.Editable; import android.text.TextWatcher; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity { EditText editText; TextView tvMsg; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editText = (EditText)findViewById(R.id.edittext); tvMsg = (TextView)findViewById(R.id.msg); editText.addTextChangedListener(myTextWatcher); } TextWatcher myTextWatcher = new TextWatcher() {

Monitor user action on EditText

Image
This example implement TextWatcher for EditText, such that we can detect user action on EditText, no extra "Enter" button is need. package com.blogspot.android_er.androidedittextchanged; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.text.Editable; import android.text.TextWatcher; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity { EditText editText; TextView tvMsg, tvInfo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editText = (EditText)findViewById(R.id.edittext); tvMsg = (TextView)findViewById(R.id.msg); tvInfo = (TextView)findViewById(R.id.info); editText.addTextChangedListener(myTextWatcher); } TextWatcher myTextWatcher = new TextWatcher() { @Override public void beforeTextChanged(Cha

Android Vitals

Image
MUST SEE: Introducing Android vitals, a guide to better app and games performance that helps drive engagement and installs.

Android Things Projects

Image
Android Things Projects Key Features Learn to build promising IoT projects with Android Things Make the most out of hardware peripherals using standard Android APIs Build enticing projects on IoT, home automation, and robotics by leveraging Raspberry Pi 3 and Intel Edison Book Description Android Things makes developing connected embedded devices easy by providing the same Android development tools, best-in-class Android framework, and Google APIs that make developers successful on mobile. With this book, you will be able to take advantage of the new Android framework APIs to securely build projects using low-level components such as sensors, resistors, capacitors, and display controllers. This book will teach you all you need to know about working with Android Things through practical projects based on home automation, robotics, IoT, and so on. We'll teach you to make the most of the Android Things and build enticing projects such as a smart greenhouse that controls the climate an

Reactive Android Programming

Image
Make the most of asynchronous android programming Reactive Android Programming About This Book Install and set up RxJava for Android development Implement the Reactive paradigm for Android programming using RxJava Create cutting edge real world Android apps with Reactive programming. Who This Book Is For Are you an android developer trying to figure out how to use reactive paradigm for your programming needs? If yes then this is the book for you. No previous knowledge of RxJava is required. What You Will Learn Set up an environment for asynchronous that is reactive Android programming Write custom observables and higher level abstractions Orchestrating multiple calls using Reactive programming principles Fetch remote financial data using RxJava Integrate and process Twitter streams gracefully Utilize Reactive programming to develop interactive and responsive Android apps Create your own application to follow financial stock updates in real-time based on selected companies' symbols