DEV Community

Ildarov
Ildarov

Posted on

I'm an Android Developer(Java/Kotlin), pre-middle level, Ask Me Anything!

Latest comments (20)

Collapse
 
kasali profile image
Salif KA

Hello Dear friend!
Thanks for your help!

Collapse
 
shreyasht profile image
Shreyash

Was it easy to switch from Java to Kotlin?
What were the challenges you faced?
I have an Android app in Java. What would be the advantages to convert it to Kotlin?

Collapse
 
devit951 profile image
Ildarov

Hello!
As I said before, if you don't have problems with Java core, you don't face any issues with Kotlin.
And if your Android application had a huge code base in Java, it doesn't make sense convert to Kotlin, even if you decide to convert your application to Kotlin, it had not so big advantages over Java. In my opinion, Kotlin has those advantages over Java: Extension functions, better lambda syntax, receiver functions, var/val. Kotlin just syntax sugar for Java in Android.

Collapse
 
vishnuharidas profile image
Vishnu Haridas

Kotlin is NOT a syntactic sugar for Java.

Kotlin is a complete, functional, object-oriented, type-inferred, modern programming language that can compile to both JVM and binary.

There are many benefits that I can see in writing a project in Kotlin, major benefits including Type Inference, Coroutines, Null safety, Extensions, etc.

Coroutines are inevitable in Android development. It is the modern implementation of Async-Await, which can replace RxJava, AsyncTasks, Callback Hell, or Threads.

In my experience, writing Kotlin code makes development much faster and easier than writing code in Java.

If you want to start in Kotlin, you can write new files/classes in your project in Kotlin. Kotlin can co-exist with Java without much problems.

Once you get the grip, you can convert your existing classes one-by-one to Kotlin.

Thread Thread
 
devit951 profile image
Ildarov

But without knowing Java core, you can't understand Android SDK source code, even more, you can't know how to use some method and how they work from Java standard API without knowing Java CORE. Kotlin stdlib is just a set of extension methods over Java methods.

Collapse
 
jamshid88 profile image
jamshid88

Can you make me FillingButton sample app, pls?

Collapse
 
ali6e7 profile image
ali6e7

Why is Google pushing Kotlin on our throats, and not provide examples in Java too, for most of their codelabs? If they wanted more flexibility in Java, they should implement JavaScript in Android, and make it like Firefox OS was.

Collapse
 
devit951 profile image
Ildarov

Hello!
What are you mean by 'Google pushing Kotlin on our throats, and not provide examples in Java '?
On their official site, developer.android.com, Google provides examples in two languages(Java and Kotlin).

Collapse
 
ali6e7 profile image
ali6e7

Mostly. If you're going through guides, you will find updated ones only in Kotlin, for now maybe. And I'm reffering about codelabs.

Collapse
 
kasali profile image
Salif KA

Hello Dear!
How to upload image from camera to the server using php with retrofit?
Thanks!

Collapse
 
devit951 profile image
Ildarov • Edited

Hello!
You can read this article and this.

Collapse
 
kasali profile image
Salif KA

Hello Dear friend!
Thankyou for your help!
I want implement the architures components, i have already do the part of the local Backend(ROOM).I across a problem with the remote backend(retrofit)!
Please help me!
Thanks!

Thread Thread
 
devit951 profile image
Ildarov

What's the problem?

Thread Thread
 
kasali profile image
Salif KA

this is the result from the Logcat:Attempt to invoke virtual method 'void android.arch.lifecycle.LiveData.observe(android.arch.lifecycle.LifecycleOwner, android.arch.lifecycle.Observer)' on a null object reference!

Thread Thread
 
devit951 profile image
Ildarov

To help you I need more information. Can you paste your code to gist.github.com/
and tell me in which line of code you got this exception.

Thread Thread
 
kasali profile image
Salif KA

I have pasted.This is the link:
gist.github.com/kasali/fd6f42a8523...

Thread Thread
 
devit951 profile image
Ildarov

Seems like your user variable returned by getUser() method is null. Did you initialize it?

Thread Thread
 
kasali profile image
Salif KA

Yes i have initialise !
code in the Viewmodel Class:
public LiveData getUser(String username, String mdp)

{
return userrepository.getUser(username,mdp);
}

Collapse
 
bhupesh profile image
Bhupesh Varshney ๐Ÿ‘พ • Edited

Let me ask the basic noob question
What do you think will be best for developing native android app, Kotlin or Java??
Cuz i would never learn java but would probably go in app development
(I am currently thinking to go for either React Native or Flutter )

Collapse
 
devit951 profile image
Ildarov

Hello! Depends on your skills and what you want. If you want to develop native apps I highly recommended firstly to learn Java, exactly core Java, not an Android framework. Then starting to create some basics android applications. About Kotlin, I think if you know Java, you probably 100% know Kotlin, I myself smoothly switched from Java to Kotlin in my production project without any troubles. But keep in mind true Android developer should know both languages on the nice level because of all Android SDK written in Java and 70-80% legacy Android apps written in Java. About React Native and Flutter, I can not say anything, because for React Native need JavaScript and for Flutter need Dart, I don't use either JS and Dart.