This shows you the differences between two versions of the page.
ndk:courses:01 [2014/06/08 17:17] petre.eftime [Practical] |
ndk:courses:01 [2014/11/05 11:54] (current) laura.gheorghe |
||
---|---|---|---|
Line 3: | Line 3: | ||
* Description: General overview of the Android OS, layers and tools | * Description: General overview of the Android OS, layers and tools | ||
* Practical part: Android tools, emulators, ADB, Beacon Mountain | * Practical part: Android tools, emulators, ADB, Beacon Mountain | ||
+ | |||
==== Lecture ==== | ==== Lecture ==== | ||
Line 28: | Line 29: | ||
=== Task 0 - Setting up the environment === | === Task 0 - Setting up the environment === | ||
- | This section is meant you help you set up your enviroment at home. All links are found in the resources. | + | This section is meant you help you set up your environment at home. All links are found in the resources. |
- | There are two ways of setting up your environment. The first way is using Intel's Beacon Mountain for Android solution. This sets up your whole enviroment including SDK and NDK and contains some additional profiling tools and HAXM, needed for virtualizing Intel Atom based virtual devices. Run the installer and follow the steps. | + | There are two ways of setting up your environment. The first way is using Intel's Beacon Mountain for Android solution. This sets up your whole environment including SDK and NDK and contains some additional profiling tools and HAXM, needed for virtualizing Intel Atom based virtual devices. Run the installer and follow the steps. |
The second way will set up the bare minimum needed for creating an NDK project. | The second way will set up the bare minimum needed for creating an NDK project. | ||
Line 135: | Line 136: | ||
Add the following code to the onCreate method. Make sure the ids match the ones in your layout. | Add the following code to the onCreate method. Make sure the ids match the ones in your layout. | ||
- | <code> | + | <code Java> |
final Button b1 = (Button) findViewById(R.id.button1); | final Button b1 = (Button) findViewById(R.id.button1); | ||
final TextView tv1 = (TextView) findViewById(R.id.textView1); | final TextView tv1 = (TextView) findViewById(R.id.textView1); | ||
Line 168: | Line 169: | ||
In Android you can have multiple resources with the same ID. This allows building a single application for all the languages, screen resolutions or formats, and have the system select the correct resource when running the application. | In Android you can have multiple resources with the same ID. This allows building a single application for all the languages, screen resolutions or formats, and have the system select the correct resource when running the application. | ||
+ | In the LogLevel project, notice that there is a single **layout** folder. Modify this layout to fit two screen densities: mdpi and hdpi. To do this, rename the folder **layout** to **layout-hdpi** and make a copy of it named **layout-mdpi**. This will allow the system to select the mdpi layout for systems with medium dpi or lower, and the hdpi layout for the rest. Modify the mdpi layout to display the buttons on two columns instead of a single button on each row. Use multiple horizontal LinearLayouts. |