Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Intel® INDE for Google Android Studio

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

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Intel® Developer Zone offers tools and how-to information for cross-platform app development, platform and technology information, code samples, and peer expertise to help developers innovate and succeed. Join our communities for Android, Internet of Things, Intel® RealSense™ Technology, and Windows to download tools, access dev kits, share ideas with like-minded developers, and participate in hackathon’s, contests, roadshows, and local events.

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

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.

Figure 2

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.

Figure 3

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

Figure 4

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.

Figure 5

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.

Figure 6

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.

Figure 7

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

Figure 8

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.

Figure 9

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).

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.

Figure 11

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.

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).

Figure 13

You should see this result on your screen:

Figure 14

Summary

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

About The Author

Denis Smirnov has been working at Intel as a Technical Intern for the last six months. Denis is getting his master’s degree in Computer Science in the Nizhny Novgorod State Technical University, specializing in Applied Mathematics.

Related Articles and Resources

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here