Android, Programming

How to implement custom xml attributes to a custom component, part 2 and final

If you haven't read part 1, I advise you to do so before you continue. Click here. Now, our BlinkerTextView is working nicely. This time we want to be able to set blinkRate and startBlinking from xml. We need to tell android about these custom attributes. We do so by placing a file named "attrs.xml"… Continue reading How to implement custom xml attributes to a custom component, part 2 and final

Advertisements
Android, Programming

How to implement custom xml attributes to a custom component, part 1

Well. Android API comes with predefined components (views and layouts) that we can use. With attributes that can be set from XML. These are android attributes. android:layout_width="200dip" But most of these predefined components are single. We may have a desire of having one composite component, the one that combines 2 or more components. For that… Continue reading How to implement custom xml attributes to a custom component, part 1

Android, api, Programming

How to implement AlarmManager using AlarmSetter API

How to setup the AlarmManager has been so complex. For Android developers, there is this need for creating a way your app can perform some background tasks even after the app has been closed. There are times when we tell the service to sleep for a specified period of time and then wake up to… Continue reading How to implement AlarmManager using AlarmSetter API

Android, Gradle, Programming

How to retrieve version name and version code programmatically

Need usually arises when you want to display the version name and code in you program at runtime, in About dialog or in any other places. Some programmers just hardcode them in About dialog. So each time they increase the version code and name, they need to remember to manually change everywhere in the codes… Continue reading How to retrieve version name and version code programmatically

Android, Gradle, Programming

Android adding local .aar file

Locally adding aar lib requires 2 steps: Let's suppose you got a library you'd like to add : com.thisuser.library:library Version 1.0 Just copy it into libs directory of your project. 1. In project build.gradle put the libs dir inside flatDir repositories { mavenCentral() flatDir { dirs 'libs' } } 2. In app/build.gradle //way1: dependencies {… Continue reading Android adding local .aar file

Android, Programming

Android Custom EditText with line numbers

Sometimes you could be wandering how to have an edittext with numbered lines, just like most code editors. Be assured that things ate easier than you think. In this tutorial, I will show you how you can implement. We'll name our custom EditText LineNumberedEditText. Extend EditText, implement one constructor and prepare the only overdrawn method,… Continue reading Android Custom EditText with line numbers