Skip to main content

Posts

Showing posts from 2015

Multiple Styles in a TextView on Android

This is a short snippet on how to have multiple syles in a TextView in Android: tvIntroTwo.setText(R.string. text_introtwo , TextView.BufferType. SPANNABLE ); Spannable spannable = (Spannable) tvIntroTwo.getText(); spannable.setSpan( new TextAppearanceSpan(getApplicationContext(), R.style. TextAppearance_IntroTwo ), 0 , 4 , Spanned. SPAN_EXCLUSIVE_EXCLUSIVE ); In styles.xml: < style name= "TextAppearance_IntroTwo" parent= "TextAppearance.AppCompat.Large" > < item name= "android:textColor" >#f3e740</ item > </ style > As for the text, you can try out a long text, then you'll see the style differences.

Build Automation on Android using Jenkins

So basically I’ve been spending time setting up Jenkins for a few reasons. to eliminate the hassle of internal employees bugging me for Android APK files when I’m focusing on doing my work. to ensure that the Android app can be compiled and built in the remote repository. So here are the steps to do automation on an Android project using Jenkins. This is based on the article from Digital Ocean on how to set up Jenkins on their Ubuntu instance.   Read more here ( https://medium.com/@S1lv3rd3m0n/build-automation-on-android-using-jenkins-85649e9f9364 )

Generate Javadoc for Volley Android Networking Library using Android Studio

A simple way to generate Javadoc for the Volley Android networking library using Android Studio is as follows: 1. Tools > Generate JavaDoc 2. You'll see this screen which points to the volley project directory that you've done a git submodule to clone to your Android project. Press OK and you'll find a docs folder in your volley project folder.

Android Animations in Android 5.0 / AppCompat

View Animation View animation has never been more fun in Android 4 and above. With Android 5.0 Lollipop, more fun animations can be done by using the ActivityOptions or ActivityOptionsCompat (in AppCompat). ViewCompat allows you to animate all sorts of animation types with start delays and other neat stuff. One example that returns a ViewPropertyAnimatorCompat object.  ViewCompat.animate(view).setDuration(1000).scaleYBy(1).scaleXBy(1).start(); View Elevation We all know that setting elevation is not possible in Android 4.+. You can either apply your own drawable shadow to simulate that effect, or you can use the support library to do the following: ViewCompat.setElevation(getResources().getDimensionPixelSize(R.dimen.drawable_elevation)); Activity Transitions If you wanna animate an item only for the activity transition, a. In Activity A, ActivityOptionsCompat options =                 ActivityOptionsCompat.makeSceneTransitionAnimation(context,