Presentation is loading. Please wait.

Presentation is loading. Please wait.

INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming.

Similar presentations


Presentation on theme: "INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming."— Presentation transcript:

1 INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming

2 Introductions into Android programming SDK (Sowtware developement kit) DVM(Dalvik Virtual Machine) JAVA API Eclipse Android App Fundamentals  The process of creating an android application  Android SDK configuration  Creating a new virtual device

3 ISAC – Android programming Setup Set up your developement environment Set up AVDs and devices for testing Install the Android SDK, Android Developement Tools and Android platforms Create Android Virtual Devices and connect hardware devices for testing Developement Create your application Create an Android project with your source code, resources and manifest file

4 ISAC – Android programming Debugging and testing Build and run your application Debugg your application Build and run your application in debug mode Debug your application using the Android debugging and logging tools Test your application Test your application using emulator or real devices

5 ISAC – Android programming Publishing Prepare your application for release Debugg your application Configure, build and test your application in release mode Publicize, sell and distribute your application to users

6 Android SDK  Configuring Android SDK manager  Creating virtual devices  Getting to know the environment  Creating a new Android project and a “Hello world” application ISAC – Android programming

7 What is an activity? Layouts Manifest XML R class

8 ISAC – Android programming Activity The basis of android applications A single Activity defines a single viewable screen  the actions, not the layout Can have multiple per application Each is a separate entity They have a structured life cycle  Different events in their life happen either via the user touching buttons or programmatically

9 ISAC – Android programming Life cycle of an activity

10 ISAC – Android programming Project components src – your source code gen – auto-generated code (usually just R.java) Included libraries Resources  Drawables (like.png images)  Layouts  Values (like strings) Manifest file

11 ISAC – Android programming XML – Extensible Markup Language Used to define some of the resources  Layouts (UI)  Strings Manifest file Shouldn’t usually have to edit it directly, Eclipse can do that for you Preferred way of creating UIs  Separates the description of the layout from any actual code that controls it  Can easily take a UI from one platform to another

12 ISAC – Android programming R class Auto-generated: you shouldn’t edit it Contains IDs of the project resources Enforces good software engineering Use findViewById and Resources object to get access to the resources  Ex. Button b = (Button)findViewById(R.id.button1)  Ex. getResources().getString(R.string.hello));

13 ISAC – Android programming Mafinest file Contains characteristics about your application When have more than one Activity in app, NEED to specify it in manifest file  Go to graphical view of the manifest file  Add an Activity in the bottom right  Browse for the name of the activity Need to specify Services and other components too Also important to define permissions and external libraries, like Google Maps API

14 ISAC – Android programming UI, layouts and components used in Android apps Layouts Eclipse has a great UI creator  Generates the XML for you Composed of View objects Can be specified for portrait and landscape mode  Use same file name, so can make completely different UIs for the orientations without modifying any code Types of layouts: Linear, Relative, Frame...

15 ISAC – Android programming UI, layouts and components used in Android apps Layouts Eclipse has a great UI creator  Generates the XML for you Composed of View objects Can be specified for portrait and landscape mode  Use same file name, so can make completely different UIs for the orientations without modifying any code Types of layouts: Linear, Relative, Frame...

16 ISAC – Android programming 1. Intents and intent filter 1.1. What are intents? 1.2. Starting activities

17 ISAC – Android programming The following code demonstrates how you can start another activity via an intent. # Start the activity connect to the # specified class Intent i = new Intent(this, ActivityTwo.class); startActivity(i);

18 2. Intents types 2.1. Different types of intents 2.2. Explicit Intents Explicit intents explicitly define the component which should be called by the Android system, by using the Java class as identifier. 2.3. Implicit Intents Implicit intents specify the action which should be performed and optionally data which provides content for the action.

19 3. Data transfer between activities 3.1. Data transfer to the target component Bundle extras = getIntent().getExtras(); if (extras == null) { return; } // get data via the key String value1 = extras.getString(Intent.EXTRA_TEXT); if (value1 != null) { // do something with the data }

20 3.2. Example: Using the share intent // this runs, for example, after a button click Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(android.content.Intent.EXTRA_TEXT, "News for you!"); startActivity(intent);

21 3.3. Retrieving result data from a sub-activity

22


Download ppt "INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming."

Similar presentations


Ads by Google