Showing posts with label EN. Show all posts
Showing posts with label EN. Show all posts

October 09, 2016

Pulsing sequence generator

Imagine you need to generate "pulsing" sequence of numbers, which should continuously repeat while going up and down between needed values, like this: 5-6-7-8-9-10-9-8-7-6-5-6-7...
Purposes of such sequence may be different, but anyway, we want to have universal solution even for this simple problem. Algorithm is simple too...

March 18, 2016

Unity and permissions in Android 6

I faced with a problem of appearing "ask-permissions" dialog at the starting up of my app.

At first I need to say that I've exported android project and built it manually. I've added few java-libs which use some permissions with protection level "dangerous". I've added them to AndroidManifest as well. My targetSdk parameter is 23. This means I have to ask for permissions at run-time.

I was wondered that "ask-permissions" dialog appeared at the beginning. I spent lot of time trying to understand what happens. As it turned out, Unity brought this behavior as default starting from version 5.2.4.


Well, if you want to disable this feature, solution is very simple.

March 09, 2016

Android Dashboards - March 7th

Latest statistics about version of Android available on developer.android.com as usual. We can see KitKat keeps losing its users and from other side here is stable progress for Lollipop and Marshmallow. It's a very good reason to switch for minSdkVersion=19.

I've realized that page "Android Dashboards" needs another set of data in section "Screen Sizes and Densities".

March 08, 2016

Composite Iterator. Java

Imagine you have two collections of different types of data. Both of them are sorted by any rule. You need to iterate over both of collections, saving the order they are sorted. Like this:
I want to share simple, but effective technique of using interfaces Iterator and Iterable.

March 01, 2016

How to move object following sine curve in Unity?

Today I solved little task of moving objects following given direction. In my case it was sine curve.



February 25, 2016

Binary search tricks

Probably array is the most popular collection of data. Everyone have used, is using and will use it. If array is sorted, this means you can simplify your life while processing array. I want to share some simple, but effective trick with binary search algorithm.

Imagine you have sequence of N numbers which splits space for N + 1 segments. Two of them on the edges are infinite. For instance, this is fuzzy thermometer.


February 08, 2016

February 06, 2016

Android Dev Tips: How to replace Enum by int or String efficiently?

There's a good topic on developer.android.com about how to manage app's memory. I want to touch specific paragraph about enums:
Enums often require more than twice as much memory as static constants. You should strictly avoid using enums on Android.
Lot of developers don't want to follow this rule, saying this is inconvenient, hard to navigate through code, hard to debug, blah-blah-blah... 

Android guys want to help developers with this. They provided android.support.annotation package with lot of powerful annotations for Android Studio and Lint. I want to explain more about IntDef and StringDef. There two classes may help to replace enums efficiently for both: performance and convenience.

February 05, 2016

Android Dev Tips - How to get static Application Context from anywhere?

Everyone is facing with the problem of accessing Context instance from methods, which aren't logically linked with Activity or Service.

It may be needed for accessing independent resources, like strings or files from assets folder. Sometimes it may be inconvenient to initialize and keep additional variable with the static context.

There're lot of questions on StackOverflow about this. Today I want to share my experience of handling such kind of problems.


February 04, 2016

Android Dashboards - February 1st

Do you still care how to choose min SDK version? Last two years Google guys spent lot of efforts in order to make Android more fluent for vendors. The most popular devices now regularly receive firmware updates automatically. From the developer's point of view it's a fantastic! We don't need to care about dino-phones anymore.

You can see it by yourself from latest statistics from Google. Devices with API 19 and higher now cover more than 70% of market! This means we can use lot of modern features of Android KitKat, Lollipop and Marshmallow without tons of libraries and crutches.

You can find more details here.


November 04, 2014

Android Dashboards - November 3rd

This post relates to statistics of Android versions presented on market. New statistics was published as usually 3rd November on developer.android.com. Google should start shipping of new Nexus devices soon. So, we will wait for a Lollipop statistics after one month. And now you can discover the newest chart with the API levels of Android. Detailed history and forecast available here.


September 11, 2014

Android Dashboards - September, 9th

New statistics about devices is available on developer.android.com. Gingerbread and Ice Cream Sandwich are disappearing from market continuously.

Find history and forecast in this document.

June 12, 2014

How to add Facebook 'Like' button in Android app?

Official Facebook SDK does not provide implementation of theirs plugin 'Like' for Android. There is just html-plugin designed for web-sites and applications. Let's try to adapt this plugin for Android!

June 07, 2014

Android FontIcon library available from Maven Central

The latest version of FontIcon library for Android is available from Maven Central repository. It's easy to include it in project:

Gradle

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.shamanland:fonticon:0.1.6'
}

Links

Android Dashboards - June, 4th

This month Honeycomb devices are disappeared from official statistics about Android devices. There are three stable groups of API versions:
  • Gingerbread (API 10) - 15%
  • Ice Cream Sandwich and Jelly Bean (API 15-18) - 70%
  • KitKat (API 19) - 14%
Check details in this public spreadsheet.


May 19, 2014

Facebook SDK available from Maven repository

I don't know why Facebook still not published theirs SDK to Maven Central.
Well, nobody forbids us to deploy it to Sonatype repository!

May 05, 2014

Android Dashboards - May, 1st

Latest statistics about Android devices is available on developer.android.com. As usual we publish additional statistics in public Google document. You can check previous history and forecast for next month.

April 23, 2014

FontIcon Library now supports ColorStateList

New feature added to the FontIcon Library latest version 0.1.1.

Now it's possible to set color-selector for icons. FontIconDrawable will handle changing the state, propagated from parental Button, TextView, etc.

March 05, 2014

Android Dashboards - March, 3

Latest statistics about Android devices is available on developer.android.com. As usual we publish additional statistics in public Google document. You can check previous history and forecast for next month.

February 07, 2014

Android Dashboards. February 4th. Gingerbread still alive.

Google published new statistics about active Android versions. The most important information is about Gingerbread. Many developers dream to stop support it. But it's still alive!

Last month we made forecast and it was wrong. Check updated document and make your own conclusion: support it or not.