• Technology
  • Electrical equipment
  • Material Industry
  • Digital life
  • Privacy Policy
  • O name
Location: Home / Technology / Visual Studio V Android Studio

Visual Studio V Android Studio

techserving |
2066

Written by MIke James

Thursday, 12 November 2015

If you think that Microsoft's involvement with open source and even Linux is a remarkable reversal, what about Visual Studio supporting Java - and Android native development? Visual Studio is now an alternative to Android Studio!

Microsoft's relationship with Java isn't a happy story. After a falling out with Sun over its implementation of J#, a .NET version of Java, it has ignored the language almost completely. Now and quite suddenly Java, proper Java, is back and it is in Visual Studio Update 1 RC. However, it is stuck in a strange place and you might not even notice it.

If you have a copy of Visual Studio 2015, the Community edition will do, then you can install Update 1. Support for building Java files was already in Visual Studio 2015. The ANT build system picks up any .java file in a src folder. Now we have enough Java support to create, debug and run an Android program written in Java.

However, if you go looking for a Java project type or even an Android project type you might conclude that there isn't such a thing. The trick is that you have to look under C++ and open the Cross-platform submenu for one of the Android project types - which show as C++ projects!

If you select say, Basic Android App, what you get is the familiar Android project folder structure, minus some folders and a Java file in the src folder which reads:

package com.Android1;

import android.app.Activity;import android.widget.TextView;import android.os.Bundle;

public class Android1 extends Activity{ /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);

/* Create a TextView and set its text to "Hello world" */TextView tv = new TextView(this);tv.setText("Hello World!");setContentView(tv); } }

If you program Android you will recognize this as a perfectly good, simple, app. It is slightly odd in that it doesn't load a resource file - but it could.

You can now start working on the project. If you download the Java language support extension you will be able to edit the Java with the help of code colorization, error squiggles, code outlining and semantic highlighting. You also get some Intellisense help including member list, parameter help and so on.

If you are happy with your code you can run it either on an external USB connected device or via the VS Android Emulator. It just works - click the run button and the code is compiled, the emulator started and after a wait you will see the code running on the emulator.

New is the ability to also debug the code. You can set breakpoints, look at the call stack, locals etc. In fact this gives you most of the facilities you get under Android Studio.

At this point you probably want to know the pros and cons.

The first thing to say is that there is a facility for importing Android Eclipse project, which I haven't tried, but not one for importing Android Studio projects. You can also add source files and make use of the code gallery samples.

If you are familiar with Visual Studio then this might be enough to get you started with Android programming, but compared to Android Studio there are few "comfort" fe

atures. The biggest omission is that there is no drag-and-drop UI editor. If you want to build a UI then you have to create a resource file by hand or create the UI programatically, as in the generated code above. You could use Android Studio to create the resource file and then import it into the VS project but this is a little indirect. It also lacks lots of other small editing conveniences that are in Android Studio - the regionalization, editor for example, and various code completion/generation options. However a lot of Android Studio programmers don't realize that these exist anyway!

So what is it all for?

The key to this is the fact that this is a C++ project. Android Studio is not good at supporting the NDK. It is getting better but it is still a long way from being fully capable. If you want to create a mixed Java and C/C++ project using the NDK then this is exactly what Visual Studio is aimed at and it can do things that Android Studio can't. You can find Android NDK samples in the gallery.

The only question that doesn't have an obvious answer is why?

Why is Microsoft creating NDK and Java projects for Android in Visual Studio?

There are a number of obvious explanations - bringing new programmers into VS, making it easier to migrate to Microsoft technologies. However, none of them seem to be a compelling reason.

Will this push continue and will VS become a real challenger to Android Studio, or Eclipse/Netbeans even?

More Information

Java debugging and language support in Visual Studio for Android

Related Articles

Android Studio 1.4 Goes Vector

Android Studio 1.3 Released

New Tools In NetBeans IDE 8.1

Visual Studio 2015 Launched - Any App Any Developer

To be informed about new articles on I Programmer, sign up for our

weekly newsletter

,

subscribe to the

RSS feed

and follow us on,

Twitter,

Facebook

,

Google+

or

Linkedin

.

Program Deep Learning on the GPU with Triton

02/08/2021

Triton is a new, Python-like, language from OpenAI intended to ease programming for the GPU by providing an alternative to CUDA.

+ Full Story

Favorite Languages Revealed

28/07/2021

According to the JetBrains survey of over thirty thousand developers, JavaScript is still the most popular programming language and, thanks to the survey's extended geographical scope, we can see some [ ... ]

+ Full Story

More News

Cassandra 4 Improves Performance

A Robot That Sticks To the Ceiling By Vibrating!

SQLBolt - Learn SQL The Interactive Way

Discount Offer For Coursera Professional Certificates

Microsoft's New Support For Eclipse Foundation

A Low Cost Hackable Watch

AdoptOpen JDK Surges Ahead

Jetpack Compose Multiplatform Alpha Released

Beach Cleaning Robot

Julia Computing Raises $24 Million

MongoDB 5 Adds Live Resharding

Android Alter 3 Sings Its Way Into Our Consciousness

IBM Introduces Hybrid Cloud AI/ML Framework

Comments

Make a Comment or View Existing Comments Using Disqus

or email your comment to:

comments@i-programmer.info

Last Updated ( Thursday, 12 November 2015 )