Intel INDE for Google Android Studio

Intel INDE for Google Android Studio

Introduction

This article walks you through a simple example showing how to use Google Android* Studio within Intel® Integrated Native Developer Environment (Intel® INDE).

About Intel® INDE

Intel INDE is a cross-platform productivity suite that provides developers the tools, support, integration, and updates they need to create high-performance applications for Android and Windows*. Bundled in Intel INDE is everything a complete application development workflow requires: environment setup (IDE integration for Android), common function libraries optimized for each platform (such as media, threading libraries, and utility libraries), compilers, debugging tools, and analysis and optimization tools. Key benefits include faster development time and the opportunity to develop applications cross-architecture and cross-OS, with your choice of IDE.

Intel INDE is important first of all because Android is now running on a tremendous number of devices. If you want to develop for the mobile marketplace, you’ll find that getting started on the Android platform is much easy with Intel INDE. It will help you develop Android apps that run at native performance levels on a wide range of platforms. And you don’t have to spend a lot of time learning how to optimize the performance and power characteristics of each target device.

About Android Studio within Intel® INDE

Android Studio IDE Integration in Intel INDE sets up the environment you need for developing native apps in Android Studio. This includes installing Android Studio, Android SDK, NDK, and other development tools like ANT and ADT plug-ins.

Intel® INDE Setup

Download Intel INDE and start the installation. IDE integration is available on all the editions of the product. Once you choose the IDE you want to install, a screen will display. Select Android Studio Development Environment, and a wizard walks you through the rest of the installation.
 
Creating New Projects

with Android Studio To start, you need to launch Android Studio and click New Project… as shown in Figure 1.

Figure 1 Next you’ll see the window for configuring your new project (Figure 2). Here you can change your app name, then click Next.

After that a window for selecting form factors you want to run your app on displays (Figure 3). Choose the target form factors and click Next.

In the next window choose the Intel INDE Activity template, “Blank Activity With NDK Support” (Figure 4). Click Next.

Change the Activity Name and enter the NDK path where the NDK is installed under IDE integration in the INDE installation directory (Figure 5), then click Finish.

Next the Project Explorer pane opens on the left side of the screen (Figure 6) showing all the files in your project, including the main activity, UI layout, native code, etc. Let's take a look at a few of them.

TestApp/app/src/main/res/layout/activity_test_app.xml (Figure 7) defines the UI layout of the app. You can change the design of your Activity by altering this file or replacing it with another design file you have.

TestApp/app/src/main/java/TestApp.java has the event handlers for the UI elements (Figure 8). This also calls the native code from TestApp/app/src/main/jni/. It’s shown below with a red line

TestApp/app/src/main/jni/NativeCode.cpp implements the function getStringFromNative (Figure 9). Here you can add your native code. For example the native code is circled in red as shown below.

In TestApp/app/src/build.gradle you can change the processor architecture your app is targeting. The variable abiFiler determines the target which is set to x86 by default (circled in Figure 10).

Let's add the button "Show" to the UI layout. Drag Button from the Widgets menu to the layout and label it "Show". Then drag a text element to the layout, open the text editor, change the UI layout, and make the text invisible (circled line in Figure 11) so that the text only shows after the button is clicked.

Next you need to implement the processing of the button in the main activity. Add a Button object to the onCreate() method and implement the processing of the button as shown in Figure 12.

Now after you click the button you’ll see the text on the UI layout.

To build your app click Build -> Rebuild Project. Once the build is successful, run the app. Click Run -> Run App. Choose a device from the device list (you need to have a running Android device) or launch an emulator and click OK (Figure 13).

You should see this result on your screen:

Summary

This article walked you through a simple example that showed getting started with Google Android Studio in Intel INDE.

For more such Android resources and tools from Intel, please visit the Intel® Developer Zone

Source: https://software.intel.com/en-us/android/articles/intel-inde-for-google-android-studio

Promotion
Digit.in
Logo
Digit.in
Logo