Kotlin vs Java : What to choose when starting a new Flutter project? - android

When starting a new Flutter project in Android Studio, it gives you the choice of android language between Java or Kotlin. so the question is:
Is my choice affecting any type of performance or compatibility? Application size or Error-handling ? Is there any difference at all ?
Same goes for Objective-C vs Swift ?

Pick Kotlin and Swift as they are the newer and more preferred languages of those platforms
Although it really doesn't matter. You won't use either of those languages much. You will mostly interact with Dart

Use
Android -> Kotlin
IOS -> Swift
because these are the languages ​​that apple and google recommend.

Use Kotlin for Android and Swift for IOS. In Editor you would be using Dart.

My Recommended is to Go for kotlin in Android. and For IOS go for Swift
One of the best reason is Google and Apple recommended and preferred this languages.
Second things kotlin is very optimized language so it's reduce the codes and make your dart file more clear to understand.
Third things kotlin supports multiple platforms. where java have some limitations in it.
But at the end both of the language is very useful to developed a single app.
Note : If you start for Application development in native Android, First Go for Java language then you have to learn about kotlin. because Java is a Base of Native Android

Related

Pure functional programming on android

Are there any advancements in this area? I want to be able to write purely functional code on Android in Haskell or similar languages. I've tried some examples with Scala but it seems to be a pain to get started. Are there any other functional JVM languages which I can use to write Android applications?
Edit: functional languages that write native android applications. My mistake about the JVM.
I doubt that you can find anything mature for writing Haskell-like code for Android. You do need to implement Java abstractions which are required by Android API (implement activity, etc.).
But if you really want to write for Android in a purely functional style you can try to implement your business logic in a pure functional language that compiles to JVM and call it from your Java classes. That approach would be much simpler than trying to implement it entirely in pure functional style.
As your language choice, you can try
Frege, it even has a library for android - froid
Eta lang, it is very new and probably nobody has tried to use it for Android yet
I you want a painless solution in terms of Gradle builds etc., you have only two options: Java and Kotlin, of which of course you should choose Kotlin ;)
Kotlin has most of the things you need to write in functional style:
functions as first class citizen
higher-order functions
immutable collections
var and val like in Scala
if-else as a statement
elements of pattern matching (where statement)
tail recursion
and more...
If you also include funKTionale and kotlinx.collections.immutable, you'll have all the functional goodies like: Option, Try, currying, memoization, persistent data structures and so on...
To start with Kotlin just install the latest Android Studio 3 Preview, which already has built-in Kotlin support.
BTW, don't be so polarized into "pure" functional ;) After all, being 100% "pure" means no side-effects, which means your app can't interact with the user ;)
Hope this helps :)
I've never tried it personally, but you can do F# programming using Xamarin.Android (and, I believe, with Xamarin Forms too). You can see the guide here. (It also includes sample code).
As some background, F# is the .NET Framework's functional language. It is derived from ML; in fact, many ML scripts can be compiled almost "directly" as F# (with the caveat that you may have to do some renaming because F# has some additional keywords that ML doesn't have in order to support several .NET-specific extensions).
Xamarin allows for native development for Android, iOS, and Windows phone. Xamarin Forms allows for a single code-base for all three platforms (it's a competitor to Ionic).
One more quick point: Android does not use the JVM, even if you're writing apps in Java. (In fact, Android does not even support all Java 8 features yet). Through Android 4.4 it used Dalvik; after that, it started using Android Runtime.
You could also try using a JVM language like Scala to create a JAR file and create a bindings library for it.
Please also note that you'll end up using at least somewhat of a mixed paradigm - for example, things like Activities are objects, and the XML files used to define an Android screen is, for all practical purposes, declarative. Edit: This last point is slightly debatable - see the comments.
One final possibility: I haven't checked this out too closely, but try also this link for a site claiming you can do Scala in Android.
Between Pure functional and Java, there is a way which is IMO Pragmatic functional. For instance Redux achieves that in the React arena.
My goal is to write an app (Activity) having an immutable state that advanced as a result of interactions is functional.
In the browser you can see that done with elm (Haskel like language which is also web platform)
Since we want an Android app, I opened the Android Studio used the wizard to create and app with Navigaton Drawer Action bar (with Drawer, FloatingActionBar),
Then converted it to use Elm concepts of immutable model functional approach into a working POC based on a small ElmBase class and idioms.
The code is written in Kotlin (JetBrains tool of choice for the JVM).
You can find the app at my GitHub https://github.com/saffih/ElmDroid The sweet spot of that approach is that it leverages Kotlin being strongly typed and the editor does code completions very well,
making lot's of the code completed for me in a way I have never seen before - amazing experience (But it require using idioms like the sealed class and when properly).

Xcode or Xamarin?

I am a ios developer , We have a requirement where we have to develop an app (with Maps,GPS tracking,Charts) in both ios and android, We are planning to use Xamarin cross platform to develop so that we can write common business logic for both the projects,
As per my research its not recommended to use xamarin.forms for the apps which needs more platforms specific functionalities like Maps,GPS tracking,Charts
by my research I found Xamrin.ios and xamarin.android are best approach to implement more platform specific functionalities
My question is , Xamarin.ios and xamarin.android are they 2 seperate projects? could I able to share business logic between those? As per my understanding in xamarin.ios and xamrin.android we will be calling our native ios/android APIs and frameworks hence we cant share the code , am I right?
Can we share code in xamarin (Xamarin.ios/xamarin.android) if we dont use Xamarin.forms?
Wat are the benefits we will get if we use xamarin.ios/xamrin.android instead of Native development with obj c / Java ?
You can have a Xamarin.android and Xamarin.iOS project in a single solution and have code sharing with a common business logic using MVVM design pattern , PCL (Portable Class Libraries) and linked source files. For the case of platform specific code in a shared code , inversion of control can be used
You try to squeeze as much as common code behind as possible , so you will only have to implement the GUI twice (Android and iOS)

What programming languages can one use to develop Android applications? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Which programming languages can I use on Android Dalvik?
Mostly, Android applications are written in Java. But i heard that its also possible to use Scala or some other languages. And I also read that it's possible to include native C/C++ code.
Is there a refernce/list available that shows which languages can be used?
At launch, Java was the only officially supported programming language for building distributable third-party Android software.
Android Native Development Kit (Android NDK) which will allow developers to build Android software components with C and C++.
In addition to delivering support for native code, Google is also extending Android to support popular dynamic scripting languages. Earlier this month, Google launched the Android Scripting Environment (ASE) which allows third-party developers to build simple Android applications with perl, JRuby, Python, LUA and BeanShell. For having idea and usage of ASE, refer this Example link.
Scala is also supported. For having examples of Scala, refer these Example link-1 , Example link-2 , Example link-3 .
Just now i have referred one Article Here in which i found some useful information as follows:
programming language is Java but bridges from other languages exist (C# .net - Mono, etc).
can run script languages like LUA, Perl, Python, BeanShell, etc.
I have read 2nd article at Google Releases 'Simple' Android Programming Language . For example of this, refer this .
Just now (2 Aug 2010) i have read an article which describes regarding "Frink Programming language and Calculating Tool for Android", refer this links Link-1 , Link-2
On 4-Aug-2010, i have found Regarding RenderScript. Basically, It is said to be a C-like language for high performance graphics programming, which helps you easily write efficient Visual effects and animations in your Android Applications. Its not released yet as it isn't finished.
Here's a list of languages that can be used to develop on android:
Java - primary android development language
Kotlin, language from JetBrains which received first-party support from Google, announced in Google I/O 2017
C++ - NDK for libraries, not apps
Python, bash, et. al. - Via the Scripting Environment
Corona- One is to use the Corona SDK . Corona is a high level SDK built on the Lua programming language. Lua is much simpler to learn than Java and the SDK takes away a lot of the pain in developing Android app.
Cordova - which uses HTML5, JavaScript, CSS, and can be extended with Java
Xamarin technology - that uses c# and in which mono is used for that. Here MonoTouch and Mono for Android are cross-platform implementations of the Common Language Infrastructure (CLI) and Common Language Specifications.
As for your second question: android is highly dependent on it's java architecture, I find it unlikely that there will be other primary development languages available any time soon. However, there's no particular reason why someone couldn't implement another language in Java (something like Jython) and use that. However, that surely won't be easier or as performant as just writing the code in Java.
Scala is supported. See example.
Support for other languages is problematic:
7) Something like the dx tool can be forced into the phone, so that Java code could in principle continue to generate bytecodes, yet have them be translated into a VM-runnable form. But, at present, Java code cannot be generated on the fly. This means Dalvik cannot run dynamic languages (JRuby, Jython, Groovy). Yet. (Perhaps the dex format needs a detuned variant which can be easily generated from bytecodes.)
As stated above, many languages are available for developing in Android. Java, C, Scala, C++, several scripting languages etc. Thanks to Mono you are also able to develop using C# and the .Net framework. Here you have some speedcomparisions: http://www.youtube.com/watch?v=It8xPqkKxis
Clojure can be used, but it's slow.
See also: Clojure fork for Android, and a tutorial.
I made good experiences with Scala.
I use the simple build tool (sbt: http://code.google.com/p/simple-build-tool/) with the Android-Plugin (http://github.com/jberkel/android-plugin)
Java and C:
C used for low level functionalities and device connectivities
Java used for Framework and Application Level
You may find more information in Android developers site.

Has anyone done or does anyone knows of a way to use Delphi/Prism to develop for the Android os?

Is it somehow possible to use the Delphi language (or Prism if absolutely necessary) to develop programs for the Android platform ?
Any starting point ?
There is Delphi for Android, a project by Lennie de Villiers.
Blog:
http://lenniedevilliers.blogspot.com/2010/09/delphi-for-android-sneak-preview-2.html
Screencast:
http://www.lenniedevilliers.net/preview/DAndroid_01.avi
Android applications are Java applications. There is a native SDK which should be use for particular needs and doesn't allow to build full applications, the application API is a Java API. Unless you have specific needs (i.e. portability), the best way to develop Android applications is using Java. IMHO using other tools that usually lag behind the main ones just to code with a different language is a waste of time.
No for the moment, but soon, check this link for more info about how develop android applications using the Object-Pascal language the Delphi-Prism programming language (wich is based on the Delphi language), with MonoDroid.
...and will soon be available from our
friends at Embarcadero, but it will
work with said release. So if you’re a
Delphi Prism customer, or just have a
fondness for Pascal syntax, keep an
eye out here – more info will be
available soon, including templates &
other support files.
You mean Object Pascal. I don't think it is currently possible. I don't think that crosscompiler exists...
There are couple of working examples in Lazarus How to create an LCL Android Application

Creating Android apps without Java

I'd like to start creating Android apps but I don't like Java. I read that scala can be used to do it. Are there another option?(Clojure?)
I'm a Python/Django developer so it would be great to learn a pretty different language.
At this point Scala is the one that is most mature..I wanted to try groovy myself but its not even out of alpha..
Plus Scala on android has docs..:)
It's not hard to do with Mirah (formerly Duby), a very young language based on Ruby that compiles to bytecode that's basically indistinguishable from Java's, but adds some great new features like closures, type inference, and obviously a Ruby-like syntax. It's particularly well-suited for Android because it has no runtime or standard library (it uses compiler plugins instead) outside the JDK, whereas basically all other JVM languages bring along a lot of baggage, especially languages that weren't designed to target the JVM (like Ruby and Python).
http://github.com/technomancy/Garrett
Much nicer than writing Java!
for clojure development a useful tutorial: http://riddell.us/ClojureAndAndroidWithEmacsOnUbuntu.html
Clojure gets a LOT of benefit from android-2.2's JIT compiler and has not really been widely adopted on previous versions.
Appcelerator Titanium is an awesome environment for using web-ish skills (like HTML, CSS, and JavaScript) to build native apps for Android (and iPhone, and desktops, etc.). For example, the gang at Intridea have made several popular Android & iPhone apps with Titanium Mobile, including the OilReporter app that has been used for gathering data on the extent of the Gulf oil spill.
If you use Python, maybe SL4A (Scripting Layer for Android) is a good choice.
You could write python script that runs on Android and use Android API, but it also has a drawback that you need install Python/SL4A runtime library on your Android device.
In addition to the other solutions listed here previously, you have:
PhoneGap
Rhodes
AIR (pre-release)
AppInventor
Clojure
Another immature implementation is JRuby/Ruboto: http://blog.danieljackoway.com/first-ruboto-release.html

Categories

Resources