ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Android predavanje
Nikola Kapraljevi?, In?num

Java te?aj 22.06.2012, FER
Nikola Kapraljevi?
twitter@nixa
nikola@in?num.hr
Android
Ruby on Rails
iPhone
Android OS
Android OS
koristi se za tablet i smartphone ure?aje
trenutno postoji preko 300 razli?itih telefona
900 000 novih ure?aja se aktivira dnevno
330 000 000 ure?aja je trenutno aktivno
Samsung Galaxy SIII
Izgled su?elja
HTC Sense
Motorola MotoWiz
Samsung TouchWiz
Sony Ericsson UX
Honeycomb 3.x
tablet ra?unala
Android
4.0
Open source...
Android Arhitecture
Android OS
Linux based OS
no NIJE Linux
nema glibc
nema X11
nema kon?guracijske datoteke koje o?ekujemo
nema ni sve alate koji dolaze s Linuxom
Application Framework
Activity Manager    Resource Manager
Window Manager      Location Manager
Content Providers   Noti?cation Manager
View System
Package Manager
Telephony Manager
Dalvik VM
virtual machine koji izvr?ava Dalvik byte-code
sli?no JVM, no nije JVM
Java se kompajlira u .dex datoteke
svaka aplikacija se izvr?ava u vlastitom
sandboxu i na vlastitoj instanci VM-a
Java SE 5
Applications
uz OS dolazi i odre?eni set aplikacija
  SMS
  Calendar
  Browser (Webkit)
  Contacts
  ....
Raspodjela Android
http://developer.android.com/resources/
dashboard/platform-versions.html
Razli?ite rezolucije/orijentacije
res/layout/main_activity.xml      # For handsets
res/layout-land/main_activity.xml       # For landscape handsets
res/layout-sw600dp/main_activity.xml # For tablets
Dashboard
most of the apps
Side
navigation
Android Development
UI
layout.xml
de?niranje su?elja koriste?i XML
android:id="@+id/my_button¡±
mogu?e u?itavanje on runtime pomocu
LayoutIn?ater servicea
 super.onCreate(savedInstanceState);
 setContentView(R.layout.main_layout);
Button
<Button android:id="@+id/my_button"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="@string/my_button_text"/>
View system
Android Layouts
FrameLayout
LinearLayout
RelativeLayout
TableLayout
Gallery
Android Widget Toolbox
TextView    RadioButton
EditText    http://
            developer.android.co
ListView
            m/guide/tutorials/
Spinner     views/index.html

Button
CheckBox
http://developer.android.com/design/
index.html
Actionbar Sherlock
http://actionbarsherlock.com/
Custom Components
Extend an existing View class or subclass with your own class.
Override some of the methods from the superclass. The superclass
methods to override start with 'on', for example, onDraw(),
onMeasure(), and onKeyDown(). This is similar to the on... events in
Activity or ListActivity that you override for lifecycle and other
functionality hooks.
Use your new extension class. Once completed, your new extension
class can be used in place of the view upon which it was based.
example: extend ImageView and add some rounded border
http://developer.android.com/guide/topics/ui/custom-
components.html
New project example
Project
src/
assets/
res/
AndroidManifest.xml
AndroidManifest.xml
permissions, activity, name, icon
strings.xml
Overriding resources
res/values-en/strings.xml
res/layout-land/main.xml
res/drawable-ldpi/slika.png
res/drawable-hdpi/slika.png


http://developer.android.com/guide/topics/
resources/providing-resources.html
R.java
pointers from java to resources
R.java
R.layout
R.string
R.drawable
R.anim
R.color
HomeActivity.java
Android Emulator
napraviti ?emo novi AVD, koristite x86 ako
mozete
telnet localhost port
~/.android/avd
DDMS perspective
pozivi, sms, network speed
Pokretanje aplikacije
compiling, signing, deploying, running
ANT
building from command line
android update project -p .
ant help :)
Android Debug Bridge
SDK/tools/adb
Command line install
adb install bin/Workshop.apk
adb uninstall com.in?num.workshop
Application components
Activities
Services
ContentProviders
Broadcast receivers
Activity lifecycle
http://developer.android.com/reference/
android/app/Activity.html
Android Intents
Intents are used as a message-passing
mechanism that works both within your
application, and between applications.
 Declare your intention that an Activity or
 Service be started to perform an action,
 usually with (or on) a particular piece of data
 Broadcast that an event (or action) has
 occurred
Explicit intents
startActivity
  Intent intent = new Intent(this, MyActivity.class);
  startActivity(intent);
startActivityForResults
  Intent intent = new Intent(this, MyActivity.class);
  startActivity(intent);
Implicit intents
trazimo od OS-a da izabere pomocu cega ce
izvrsiti Intent
  Intent intent = new
  Intent(Intent.ACTION_CALL, Uri.parse(¡®tel:
  0959115614¡¯);
  startActivity(intent);
DetailsActivity example
prenosenje i vracanje parametara s
activitya na activity
Broadcasts
Broadcasting intents
  napravite intent i pozoveze nad njim
     sendBroadcast(intent);
Receiving intents
  extend BroadcastReceiver
  register in android manifest
     <receiver android:name=".MyBroadcastReciver">
     <intent-?lter>
     <action android:name="hr.in?num.fer.LECTURE_DONE"/>
     </intent-?lter>
     </receiver>
Phone call
example
String url = "tel:0959115614";
Intent intent = new Intent(Intent.ACTION_CALL,
Uri.parse(url));
Permissions
<uses-permission
android:name="android.permission.CALL_PHONE"
></uses-permission>
Mo?emo li znati kad je
poziv gotov?
public void onCreate(Bundle savedInstanceState) {
	   	    super.onCreate(savedInstanceState);
	   	    setContentView(R.layout.main);

	   	   Button btnCall = (Button) ?ndViewById(R.id.btnCall);
	   	   btnCall.setOnClickListener(new OnClickListener() {

	   	   	     @Override
	   	   	     public void onClick(View v) {
	   	   	     	    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:0917700"));
	   	   	     	    startActivity(intent);
	   	   	     }
	   	   });

	   	   TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
	   	   tm.listen(new EndCallListener(), PhoneStateListener.LISTEN_CALL_STATE);
	   }

	   private class EndCallListener extends PhoneStateListener {

	   	   @Override
	   	   public void onCallStateChanged(int state, String incomingNumber) {
	   	   	    Log.d("NIXA", "Phone state is " + state + " " + incomingNumber);
	   	   }
	   }
Permissions
<uses-permission
android:name="android.permission.READ_PHONE
_STATE"></uses-permission>
ListView
List adapters
ArrayAdapter
CursorAdapter
SimpleCursorAdapter
ListView example
Storage
Shared Preferences
Internal Storage
External Storage
SQLite Databases
Network Connection
Media and Camera
take photo
record video
pick photo/video from gallery
MediaStore.ACTION_IMAGE_CAPTURE
MediaStore.ACTION_VIDEO_CAPTURE
Camera example
Paziti na
Low processing power
Limited RAM
Limited permanent storage capacity
Small screens with low resolution
High costs associated with data transfer
Slow data transfer rates with high latency
Unreliable data connections
Limited battery life
ANR
application not
responding
services 10s
activities 5s
Support Library
Fragment
FragmentManager
FragmentTransaction
ListFragment
DialogFragment
LoaderManager
Loader
AsyncTaskLoader
CursorLoader
coloredlogcat
https://bitbucket.org/GBouerat/colored-
logcat-pid
Flurry
ako vas zanima tko i kako koristi aplikaciju
AdMob
ako hocete nesto zaraditi, ali vjerovatno
necete
Android Market
Android Market
Developer Console
pratite komentare
exceptioni
Active Install Rate
Android Market
25$ account
kad krenete razvijati applikaciju nije lo?e
uploadat ju odmah na po?etku developmenta
kako bi si rezervirali namespace
(hr.in?num.nixa...)
¡°od sljede?eg tjedna izgleda da ?emo mo?i
kupovati/prodavati aplikacije i iz Hrvatske¡±
DORS/CLUC 2011 - ovo jos uvijek ne radi :-)
Lamborgini Aventador
700hp V12, 2.9s do 100km/h
Pitanja ...
Hvala!

twitter@nixa
skype@nkapralj
nikola.kapraljevic@gmail.com
Ad

Recommended

What's new in Android O
What's new in Android O
Kirill Rozov
?
´¡²Ô»å°ù´Ç¾±»åÓ¦Óÿª·¢½éÉÜ
´¡²Ô»å°ù´Ç¾±»åÓ¦Óÿª·¢½éÉÜ
easychen
?
TY.BSc.IT Java QB U2
TY.BSc.IT Java QB U2
Lokesh Singrol
?
Behavioral pattern 4
Behavioral pattern 4
Naga Muruga
?
Android tips and tricks
Android tips and tricks
Nikola Kapraljevic Nixa
?
Google maps and GPS, camera, SD card, tips &amp; tricks
Google maps and GPS, camera, SD card, tips &amp; tricks
Nikola Kapraljevic Nixa
?
24sata Android application case study
24sata Android application case study
Nikola Kapraljevic Nixa
?
Razvoj Android aplikacija
Razvoj Android aplikacija
Nikola Kapraljevic Nixa
?
Donna Dickson on Employee Engagement
Donna Dickson on Employee Engagement
Aco Momcilovic
?
Hands on Android
Hands on Android
Nikola Kapraljevic Nixa
?
Project Management 8 Human Resources
Project Management 8 Human Resources
Aco Momcilovic
?
Corporate Culture General 1.3.Blank
Corporate Culture General 1.3.Blank
Aco Momcilovic
?
Gi¨¢o ¨¢n l?ch s? 11 b¨¤i 17-19-20-21-22
Gi¨¢o ¨¢n l?ch s? 11 b¨¤i 17-19-20-21-22
V? T?m Long
?
The Outcome Economy
The Outcome Economy
Helge Tenn?
?
Android Jumpstart Jfokus
Android Jumpstart Jfokus
Lars Vogel
?
Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014
Lou Sacco
?
What's new in android jakarta gdg (2015-08-26)
What's new in android jakarta gdg (2015-08-26)
Google
?
Beginning Native Android Apps
Beginning Native Android Apps
Gil Irizarry
?
android training_material ravy ramio
android training_material ravy ramio
slesulvy
?
Getting your app ready for android n
Getting your app ready for android n
Sercan Yusuf
?
Gradle for Android Developers
Gradle for Android Developers
Josiah Renaudin
?
Java RMI
Java RMI
Sunil OS
?
Pandora FMS: Windows Phone 7 Agent
Pandora FMS: Windows Phone 7 Agent
Pandora FMS
?
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Toru Wonyoung Choi
?
Android101
Android101
David Marques
?
Synapseindia android application development tutorial
Synapseindia android application development tutorial
Synapseindiappsdevelopment
?
Synapseindia android apps development tutorial
Synapseindia android apps development tutorial
Synapseindiappsdevelopment
?
Android App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structure
Vijay Rastogi
?
Windows phone 7 series
Windows phone 7 series
openbala
?
Mobile Software Engineering Crash Course - C04 Android Cont.
Mobile Software Engineering Crash Course - C04 Android Cont.
Mohammad Shaker
?

More Related Content

Viewers also liked (6)

Donna Dickson on Employee Engagement
Donna Dickson on Employee Engagement
Aco Momcilovic
?
Hands on Android
Hands on Android
Nikola Kapraljevic Nixa
?
Project Management 8 Human Resources
Project Management 8 Human Resources
Aco Momcilovic
?
Corporate Culture General 1.3.Blank
Corporate Culture General 1.3.Blank
Aco Momcilovic
?
Gi¨¢o ¨¢n l?ch s? 11 b¨¤i 17-19-20-21-22
Gi¨¢o ¨¢n l?ch s? 11 b¨¤i 17-19-20-21-22
V? T?m Long
?
The Outcome Economy
The Outcome Economy
Helge Tenn?
?
Donna Dickson on Employee Engagement
Donna Dickson on Employee Engagement
Aco Momcilovic
?
Project Management 8 Human Resources
Project Management 8 Human Resources
Aco Momcilovic
?
Corporate Culture General 1.3.Blank
Corporate Culture General 1.3.Blank
Aco Momcilovic
?
Gi¨¢o ¨¢n l?ch s? 11 b¨¤i 17-19-20-21-22
Gi¨¢o ¨¢n l?ch s? 11 b¨¤i 17-19-20-21-22
V? T?m Long
?
The Outcome Economy
The Outcome Economy
Helge Tenn?
?

Similar to Android workshop (20)

Android Jumpstart Jfokus
Android Jumpstart Jfokus
Lars Vogel
?
Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014
Lou Sacco
?
What's new in android jakarta gdg (2015-08-26)
What's new in android jakarta gdg (2015-08-26)
Google
?
Beginning Native Android Apps
Beginning Native Android Apps
Gil Irizarry
?
android training_material ravy ramio
android training_material ravy ramio
slesulvy
?
Getting your app ready for android n
Getting your app ready for android n
Sercan Yusuf
?
Gradle for Android Developers
Gradle for Android Developers
Josiah Renaudin
?
Java RMI
Java RMI
Sunil OS
?
Pandora FMS: Windows Phone 7 Agent
Pandora FMS: Windows Phone 7 Agent
Pandora FMS
?
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Toru Wonyoung Choi
?
Android101
Android101
David Marques
?
Synapseindia android application development tutorial
Synapseindia android application development tutorial
Synapseindiappsdevelopment
?
Synapseindia android apps development tutorial
Synapseindia android apps development tutorial
Synapseindiappsdevelopment
?
Android App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structure
Vijay Rastogi
?
Windows phone 7 series
Windows phone 7 series
openbala
?
Mobile Software Engineering Crash Course - C04 Android Cont.
Mobile Software Engineering Crash Course - C04 Android Cont.
Mohammad Shaker
?
Android Tutorial
Android Tutorial
Fun2Do Labs
?
Divide and Conquer ¨C Microservices with Node.js
Divide and Conquer ¨C Microservices with Node.js
Sebastian Springer
?
Tdd,Ioc
Tdd,Ioc
Antonio Radesca
?
Android is not just mobile
Android is not just mobile
Kevin McDonagh
?
Android Jumpstart Jfokus
Android Jumpstart Jfokus
Lars Vogel
?
Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014
Lou Sacco
?
What's new in android jakarta gdg (2015-08-26)
What's new in android jakarta gdg (2015-08-26)
Google
?
Beginning Native Android Apps
Beginning Native Android Apps
Gil Irizarry
?
android training_material ravy ramio
android training_material ravy ramio
slesulvy
?
Getting your app ready for android n
Getting your app ready for android n
Sercan Yusuf
?
Gradle for Android Developers
Gradle for Android Developers
Josiah Renaudin
?
Pandora FMS: Windows Phone 7 Agent
Pandora FMS: Windows Phone 7 Agent
Pandora FMS
?
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Toru Wonyoung Choi
?
Synapseindia android application development tutorial
Synapseindia android application development tutorial
Synapseindiappsdevelopment
?
Android App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structure
Vijay Rastogi
?
Windows phone 7 series
Windows phone 7 series
openbala
?
Mobile Software Engineering Crash Course - C04 Android Cont.
Mobile Software Engineering Crash Course - C04 Android Cont.
Mohammad Shaker
?
Divide and Conquer ¨C Microservices with Node.js
Divide and Conquer ¨C Microservices with Node.js
Sebastian Springer
?
Android is not just mobile
Android is not just mobile
Kevin McDonagh
?
Ad

Recently uploaded (20)

AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
?
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
?
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
?
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
?
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
?
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
?
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
?
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
?
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
?
¡°Key Requirements to Successfully Implement Generative AI in Edge Devices¡ªOpt...
¡°Key Requirements to Successfully Implement Generative AI in Edge Devices¡ªOpt...
Edge AI and Vision Alliance
?
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
?
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
?
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
?
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
?
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
?
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
?
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
?
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
?
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
?
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
?
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
?
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
?
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
?
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
?
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
?
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
?
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
?
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
?
¡°Key Requirements to Successfully Implement Generative AI in Edge Devices¡ªOpt...
¡°Key Requirements to Successfully Implement Generative AI in Edge Devices¡ªOpt...
Edge AI and Vision Alliance
?
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
?
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
?
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
?
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
?
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
?
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
?
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
?
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
?
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
?
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
?
Ad

Android workshop

Editor's Notes