Sunday, 26 February 2017

Android What's next? IF MOVING AWAY FROM JAVA

As we have finally fixed most of our problems with IDEs and OS versions, we can shift our focus to other Android problems.  IMHO, the most important problem is the core problem of Android development - Java. Sorry, Java Harmony. Which is basically Java 7. Or Java 6. But is not Java. Don’t get me wrong - I strongly believe that Java is a good programming language, but I also think that it’s the right time to think outside of the box. We need to start looking for other programming languages that will replace Java as the primary language for Android development.

Just look at our most important competitor - Apple. They have introduced a completely new language called Swift which combines the best features of several other languages (like Python, Ruby or C#). We already need considerably more time than iOS developers to develop the same app, and now we'll be even slower.

That's why we need something new. We already a have few ideas about which language could replace Java. My eyes are set on Groovy. Its syntax is quite like Java (it’s built upon Java) and we already have some working prototypes. Also, don't forget that it is the primary language for Gradle - so why not use it in Android development? Or maybe Scala (which is quickly gaining new users) or Kotlin 
(Jake Wharton recently wrote a great overview of Kotlin for Android)?

GETTING BETTER AT DB MANAGEMENT:
I would also like to point out one more problem - database management API. If you commit blasphemy once again and look at our competitors - iOS (Core Data, to be more precise) - you'll see that they have nice methods and GUI for creating database objects, CRUD methods, database change listeners. But if you look at the default Android API - we still haven't gotten far from writing SQL commands which greatly affects our development process.

Debugging SQL errors is not so easy - it's time consuming, and we have no GUI for looking at our database data. Although there are some good ORM libraries
(like GreenDAOActiveAndroid or SugarORM), they all have their own problems. I have never been completely satisfied with them - they have been either complex to use or something has been missing (like database change listeners). My mind is set on Realm for Android and DBFlow, which I'm hoping will solve all of my problems and will also have shorter execution times.

CONCLUSION:
A lot has changed in the past few years for Android. It has evolved from a simple OS for smartphones and is now powering many other devices. Time will tell what will become of it. Who knows, maybe we'll even program nuclear fusion reactors with it.

Courtesy: Infinum Inc.  

How to set specific part of the text as clickable and make it as an action or link - Android



SpannableString policySpan= new SpannableString("Check this link Privacy Policy");
policySpan.setSpan(new ClickableSpan() {
    @Override
    public void onClick(View textView) {
        startActivity(new Intent(CurrentActivity.this, NextActivity.class));
    }
    @Override
    public void updateDrawState(TextPaint tpaint) {
            super.updateDrawState(tpaint);
            tpaint.setUnderlineText(true);
        }
}, 16, policySpan.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

TextView textView = (TextView) findViewById(R.id.policy);
textView.setText(policySpan);
textView.setMovementMethod(LinkMovementMethod.getInstance());
textView.setHighlightColor(Color.TRANSPARENT);