본문 바로가기

카테고리 없음

Java For Android Language Project

Java for Android from Vanderbilt University. This MOOC teaches you how to program core features and classes from the Java programming language that are used in Android, which is the dominant platform for developing and deploying mobile device. Which JDK version (Language Level) is required for Android Studio? Ask Question 72. I'm using Java 7 with Android Studio without any problems (OS X - 10.8.4). You need to make sure you drop the project language level down to 6.0 though. See the screenshot below. To be successful, Android developers need a good grasp of the Java language, Android APIs, and Android app architecture. It's also essential to use an appropriate and effective development environment. For many years, Eclipse IDE with the ADT plugin was the preferred platform for Android development. Today it's Android Studio. There’s a great need for Java developers among enterprise organizations. Mobile application developers are also some of the hottest professionals in the IT job market right now. Because Java is the standard language for Android development, Java programmers are positioned to take advantage of Android’s continued market share growth.

Active1 year, 3 months ago

I am using Java 7 SDK and IntelliJ IDEA IDE.

Grow your team on GitHub. GitHub is home to over 28 million developers working together. Join them to grow your own development teams, manage permissions, and collaborate on projects. In Android Studio, you can choose to create the activity in Kotlin right away, so you can skip the 'Converting Java code to Kotlin' step. Earlier versions will create an activity in Java, and you can use the automated converter tool to convert it.

I am still not able to use Java 7 features. After a bit of googling I could use all the features after setting project language level to 7(Diamond, ARM, multicatch etc). What exactly is this? If this has some relationship to syntax based on JDK in use what is level 8(Lambda, annotations etc)? Java 8 isn't released yet. Java 8 is expected in March 2014 according to Wiki. Someone please explain this language level concept.

Aniket ThakurAniket Thakur
45.5k28 gold badges207 silver badges227 bronze badges

3 Answers

The Language level setting sets which features the code assistance in the editor should support. For example, if you're using JDK 1.7 but want your code to be compatible with JDK 1.6, you can set the language level lower than your actual JDK supports (6.0 in the case of JDK 1.6) and only get refactorings/syntax suggested that are supported on 1.6 and lower. Depending on your compiler, it may also give the compiler options to remove support for newer syntax elements.

The 8.0 (which, as you're guessing corresponds to Java 8) is available for people that want to experiment with one of the Java 8 snapshots that are available. Since Java 8 isn't released, language level 8.0 may very well change before release.

Joachim IsakssonJoachim Isaksson
148k18 gold badges219 silver badges251 bronze badges

As per the documentation within section Exploring the General Project Settings at the IntelliJ Wiki, the project language level impacts the intellisense provided by the IDE.

It also dictates the behavior of the compiler being used by IntelliJ when it compiles your Java code as you develop.

This setting tells all the facilities of the compiler that would be available for the project. For e.g. setting the language level to JDK 5 will allow the IntelliJ to recognize keywords such as enum that are present within the source code.

Prahalad DeshpandePrahalad Deshpande

If you look at the options for the javac Java compiler command, you'll see that the -source and -target options allow you to compile against alternate versions of Java. I'm not sure to which option IntelliJ's language level setting corresponds (it is likely -source), but it essentially tells IntelliJ to use the provided Java SDK (in the Project SDK field) in the specified Java language version instead of the latest provided by said SDK.

So while you have Java 7 installed, you could set the language level to 6.0, and IntelliJ will compile your code against the Java 6 specification instead of the Java 7 spec. This includes all of the real-time suggestions and code checking done as you type.

The Java 8 option is there likely due to the fact that beta builds of Java 8 are available for testing.

I've never experimented with what would happen if you set a language level to something higher than the JDK version.

ajp15243ajp15243
5,9581 gold badge27 silver badges37 bronze badges

Not the answer you're looking for? Browse other questions tagged javaintellij-idea or ask your own question.

Download java for android -->

Note

The new Speech Service and SDK is replacing Bing Speech, which will no longer work starting October 15, 2019. For information on switching to the Speech Service, see Migrating from Bing Speech to the Speech Service.

With the Bing Speech Recognition API, you can develop Android applications that use the cloud-based Bing Speech Service to convert spoken audio to text. The API supports real-time streaming, so your application can simultaneously and asynchronously receive partial recognition results at the same time it's sending audio to the service.

This article uses a sample application to demonstrate how to use the Speech client library for Android to develop speech-to-text applications in Java for Android devices.

Prerequisites

Platform requirements

The sample is developed by Android Studio for Windows in Java.

Java

Get the client library and sample application

The Speech client library and samples for Android are available in the Speech client SDK for Android. You can find the buildable sample under the samples/SpeechRecoExample directory. You can find the two libraries you need to use in your own apps in SpeechSDK/libs under the armeabi and the x86 folder. The size of the libandroid_platform.so file is 22 MB, but it's reduced to 4 MB at deployment time.

Subscribe to the Speech API, and get a free trial subscription key

The Speech API is part of Cognitive Services (previously Project Oxford). You can get free trial subscription keys from the Cognitive Services subscription page. After you select the Speech API, select Get API Key to get the key. It returns a primary and secondary key. Both keys are tied to the same quota, so you can use either key.

If you want to use recognition with intent, you also need to sign up for the Language Understanding Intelligent Service (LUIS).

Important

  • Get a subscription key. Before you can use Speech client libraries, you must have a subscription key.

  • Use your subscription key. With the provided Android sample application, update the file samples/SpeechRecoExample/res/values/strings.xml with your subscription keys. For more information, see Build and run samples.

Use the Speech client library

To use the client library in your application, follow the instructions.

You can find the client library reference for Android in the docs folder of the Speech client SDK for Android.

Build and run samples

To learn how to build and run samples, see this README page.

Samples explained

Create recognition clients

The code in the following sample shows how to create recognition client classes based on user scenarios:

The client library provides pre-implemented recognition client classes for typical scenarios in speech recognition:

  • DataRecognitionClient: Speech recognition with PCM data (for example, from a file or audio source). The data is broken up into buffers, and each buffer is sent to Speech Service. No modification is done to the buffers, so the user can apply their own silence detection if desired. If the data is provided from WAV files, you can send data from the file right to Speech Service. If you have raw data, for example, audio coming over Bluetooth, you first send a format header to Speech Service followed by the data.
  • MicrophoneRecognitionClient: Speech recognition with audio coming from the microphone. Make sure the microphone is turned on and the data from the microphone is sent to the speech recognition service. A built-in 'Silence Detector' is applied to the microphone data before it's sent to the recognition service.
  • DataRecognitionClientWithIntent and MicrophoneRecognitionClientWithIntent: These clients return, in addition to recognition text, structured information about the intent of the speaker, which can be used to drive further actions by your applications. To use 'Intent,' you need to first train a model by using LUIS.

Java For Android Language Project Download

Recognition language

When you use SpeechRecognitionServiceFactory to create the client, you must select a language. For the complete list of languages supported by Speech Service, see Supported languages.

SpeechRecognitionMode

You also need to specify SpeechRecognitionMode when you create the client with SpeechRecognitionServiceFactory:

  • ShortPhrase: An utterance up to 15 seconds long. As data is sent to the service, the client receives multiple partial results and one final result with multiple n-best choices.
  • LongDictation: An utterance up to two minutes long. As data is sent to the service, the client receives multiple partial results and multiple final results, based on where the service identifies sentence pauses.

Attach event handlers

Install Java For Android

You can attach various event handlers to the client you created:

Java For Android Browser

  • Partial Results events: This event gets called every time Speech Service predicts what you might be saying, even before you finish speaking (if you use MicrophoneRecognitionClient) or finish sending data (if you use DataRecognitionClient).
  • Error events: Called when the service detects an error.
  • Intent events: Called on 'WithIntent' clients (only in ShortPhrase mode) after the final recognition result is parsed into a structured JSON intent.
  • Result events:
    • In ShortPhrase mode, this event is called and returns n-best results after you finish speaking.
    • In LongDictation mode, the event handler is called multiple times, based on where the service identifies sentence pauses.
    • For each of the n-best choices, a confidence value and a few different forms of the recognized text are returned. For more information, see Output format.

Download Java For Android

Related topics