Android Framework and User Interfaces Preliminaries - Winlab

flosssnailsMobile - Wireless

Dec 10, 2013 (3 years and 10 months ago)

105 views

Android  Framework  
and  
User  Interfaces  
Preliminaries
 
 
Janne
 
Lindqvist
 
Mobile  User  Experience  Engineering  
September  21,  2012  
Starters  


Boot  up  the  OS  


Create  a  “My  First  App”  
Goals  of  this  Class  


Providing  you  
prac%cal  tools
 to  work  with  
Android  


Understanding  AcNvity  Life  Cycle  in  detail  


CreaNng  Simple  User  Interfaces  
Android  AcNvity  Lifecycle  
Class  Exercise:  AcNvity  Lifecycle  
visualizaNon  and  Log  messages  


Download  source  code  from  
sakai
:  
 
class6-­‐sept21-­‐source-­‐code.rU  


Copy  paste  the  code  to  your  app  


Add  
onResume
()  override  to  the  source  code,  
which  includes  input  for  
logcat
 
Android  Source  Code  
AndroidManifest.xml
 


IdenNfy  any  user  permissions  the  applicaNon  requires,  
such  as  Internet  access  or  read-­‐access  to  the  user's  
contacts.  


Declare  the  minimum  API  Level  required  by  the  
applicaNon,  based  on  which  APIs  the  applicaNon  uses.  


Declare  hardware  and  soZware  features  used  or  
required  by  the  applicaNon,  such  as  a  camera,  
bluetooth
 services,  or  a  
mulNtouch
 screen.  


API  libraries  the  applicaNon  needs  to  be  linked  against  
(other  than  the  Android  framework  APIs),  such  as  the  
Google  Maps  library.  
Manifest.permission
 


h[p://
developer.android.com
/reference/
android/
Manifest.permission.html
 
User  Interfaces  
Model  –  View  –  Controller  (MVC)  
Model  


“Guts”  of  your  app,  what  it  actually  does  


List  of  contacts  


Networking  code  


Single  model  could  be  used  by  several  apps  
View  


VisualizaNon  of  the  Model  


Not  necessarily  only  visualizaNon,  e.g.  sending  
audio  to  speakers  can  be  a  “View”  


In  Android  UI  framework  very  concrete  


Implemented  as  a  tree  of  subclasses  of  
View
 class  
Controller  


Responds  to  external  acNons  


Key  press  


Tapping  screen  


Incoming  call  


Implemented  as  
event  queue  


Android  UI  framework  is  single-­‐threaded  
Class  Exercise  


CreaNng  a  bu[on  (View)  


CreaNng  control  for  bu[on  (Controller)  
ImplemenNng  simple  control  
final  
TextView
 
tv
 =  new  
TextView
(this);


final

Button
button
=

(
Button
)

findViewById
(
R
.
id
.
button_id
);



button
.
setOnClickListener
(
new


View
.
OnClickListener
()

{



public

void

onClick
(
View
v
)

{



 
 
t v.s e t T e x t ( ” R u t g e r s  M o b i l e  C l a s s!");  
     
s e t C o n t e n t V i e w
( t v );



}


});
 
User  Experience  Engineering  Nugget  


Where  to  put  networking  code  in  an  
interacNve  applicaNon?