SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
MIDP	
  Development	
  

            Jussi	
  Pohjolainen	
  
Tampere	
  University	
  of	
  Applied	
  Sciences	
  
Class	
  Diagram	
  of	
  MIDP	
  app	
  
    abstract	
  class	
  MIDlet	
  

    +	
  int	
  checkPermission(String)	
  
    #	
  abstract	
  void	
  destroyApp(boolean)	
  
    +	
  String	
  getAppProperty(String)	
  
    +	
  void	
  noFfyDestroyed()	
  
    #	
  abstract	
  pauseApp()	
  
    +	
  boolean	
  plaGormRequest(String)	
  
    +	
  void	
  resumeRequest()	
  
    #	
  abstract	
  void	
  startApp();	
  



    class	
  MyMIDlet	
  
Code	
  
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;

public class MyMIDlet extends MIDlet {
   public MyMIDlet() {}

    public void startApp() {}

    public void destroyApp(boolean unconditional) {}

    public void pauseApp() {}
}
MIDlet’s	
  Life	
  Cycle	
  
                 Constructor	
  
                                        destroyApp()	
  


                           Paused	
                        Destroyed	
  


startApp()	
                            pauseApp()	
  


                            AcFve	
  
ApplicaFon	
  Manager	
  
•  Applica'on	
  Manager	
  controls	
  all	
  the	
  methods	
  
   in	
  the	
  previous	
  slide	
  
•  You	
  can	
  try	
  to	
  change	
  the	
  state	
  by	
  using	
  
   methods	
  like:	
  
    –  void notifyDestroyed()
    –  notifyPaused()
    –  resumeRequest()
Intro	
  to	
  MIDP	
  GUI	
  
Intro	
  to	
  GUI	
  
•  Problem:	
  Mobile	
  Devices	
  are	
  totally	
  different	
  
   from	
  each	
  other	
  
    –  Screen	
  size,	
  ResoluFon?	
  
    –  Color	
  Depth?	
  
    –  Input	
  Devices?	
  
•  Two	
  soluFons	
  
    –  Abstrac'on:	
  Let	
  MIDP	
  take	
  care	
  of	
  the	
  pracFcal	
  
       implementaFon	
  
    –  Discover:	
  Sniff	
  the	
  features	
  of	
  the	
  current	
  phone	
  and	
  
       act	
  according	
  to	
  them	
  
AbstracFon	
  vs.	
  Discover	
  
•  AbstracFon:	
  Use	
  high-­‐level	
  API	
  
    –  Portability	
  key	
  issue	
  
    –  Very	
  easy	
  to	
  use	
  
    –  LiXle	
  control	
  over	
  look	
  and	
  feel	
  
•  Discover:	
  Use	
  low-­‐level	
  API	
  
    –  Full	
  control	
  over	
  graphics	
  
    –  Classes	
  like	
  Canvas,	
  Graphics,	
  Image,	
  Font	
  
    –  Time	
  consuming,	
  but	
  you	
  can	
  control	
  the	
  look	
  and	
  
       feel	
  
Display	
  
•  MIDP	
  GUI	
  could	
  be	
  seen	
  as	
  a	
  deck	
  of	
  cards	
  
•  No	
  mulFple	
  windows	
  
•  Display is	
  a	
  class	
  that	
  represents	
  the	
  screen	
  
   display	
  
•  Display has	
  a	
  single	
  GUI-­‐element	
  whose	
  
   content	
  is	
  controlled	
  by	
  one	
  app	
  at	
  any	
  Fme	
  
•  The	
  main	
  task	
  of	
  the	
  Display-­‐class	
  is	
  to	
  take	
  
   care	
  of	
  what	
  is	
  visible	
  at	
  the	
  screen	
  
Using	
  Display	
  –	
  class	
  in	
  Code	
  
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class MyMIDlet extends MIDlet
{
   public MyMIDlet() {}
   public void pauseApp() {}
   public void destroyApp(boolean ignore) {}
   public void startApp()
   {
      Display d = Display.getDisplay(this);
      d.setCurrent(…);
   }
}
Using	
  Display	
  
•  You	
  ask	
  reference	
  to	
  the	
  client	
  device's	
  display:	
  
    public void startApp(){
       Display d = Display.getDisplay(this)
    }

•  SpecificaFon	
  says	
  that	
  this	
  is	
  done	
  in	
  startApp-­‐
   method	
  
•  A^er	
  ge_ng	
  the	
  reference,	
  you	
  can	
  use	
  Display-­‐
   classes	
  methods:	
  
    –  public void setCurrent(Displayable next)
    –  public void setCurrent(Alert alert, Displayable
       nestDisplayable)
Display’s	
  methods	
  
•    boolean flashBacklight(int d)
•    boolean isColor()
•    int numColors()
•    boolean vibrate(int duration)
Displayable	
  
•  Display	
  is	
  responsible	
  for	
  changing	
  GUI	
  –	
  
   elements	
  on	
  the	
  screen	
  
•  These	
  GUI-­‐elements	
  are	
  Displayable –	
  
   objects.	
  
•  Displayable is	
  a	
  abstract	
  class	
  that	
  has	
  
   couple	
  concrete	
  classes	
  
Class	
  Hierarchy	
  
Examples	
  of	
  Displayable	
  objects	
  
DelegaFon	
  Event	
  Handling	
  
DelegaFon	
  Event	
  Handling	
  
•  MIDlet's	
  event	
  handling	
  system	
  is	
  the	
  same	
  as	
  in	
  Java	
  SE	
  
•  DelegaFon	
  Event	
  	
  Model:	
  
     –  Simple	
  and	
  easy	
  to	
  learn	
  
     –  Support	
  a	
  clean	
  separa'on	
  between	
  applica'on	
  and	
  GUI	
  code	
  
     –  Facilitate	
  the	
  creaFon	
  of	
  robust	
  event	
  handling	
  code	
  which	
  is	
  
        less	
  error-­‐prone	
  (strong	
  compile-­‐Fme	
  checking)	
  
     –  Flexible	
  enough	
  to	
  enable	
  varied	
  applicaFon	
  models	
  for	
  event	
  
        flow	
  and	
  propagaFon	
  
     –  For	
  visual	
  tool	
  builders,	
  enable	
  run-­‐Fme	
  discovery	
  of	
  both	
  
        events	
  that	
  a	
  component	
  generates	
  as	
  well	
  as	
  the	
  events	
  it	
  may	
  
        observe	
  
     –  Support	
  backward	
  binary	
  compaFbility	
  with	
  the	
  old	
  model	
  
SeparaFon	
  of	
  GUI	
  and	
  BL	
  


                   RegistraFon	
  
Source	
                             Listener	
  
DelegaFon	
  Event	
  Model	
  and	
  MIDlets	
  
•  In	
  MIDP,	
  event	
  source	
  is	
  usually	
  Displayable-­‐
   object	
  
•  RegistraFon	
  is	
  done	
  with	
  
    –  setCommandListener(CommandListener l)
•  Listener	
  can	
  be	
  any	
  object,	
  which	
  class	
  has	
  
   implemented	
  the	
  CommandListener	
  interface!
Example	
  
•  Event	
  source	
  
     –  TextBox textbox = new TextBox(....);
•  Event	
  Listener	
  
     –  Cat listener = new Cat();
•  RegistraFon	
  
     –  textbox.setCommandListener(listener);
•  The	
  Cat-­‐class	
  must	
  implement	
  the	
  CommandListener-­‐class.	
  	
  
•  It	
  is	
  wise	
  to	
  add	
  some	
  commands	
  to	
  the	
  Textbox-­‐screen:	
  
     –  Command exitcommand = new Command(..);
     –  textbox.addCommand(exitcommand);
Listener	
  
•  Listener	
  can	
  be	
  any	
  class	
  that	
  implements	
  the	
  
   given	
  interface.	
  	
  
•  In	
  this	
  case,	
  Listener	
  is	
  a	
  class	
  called	
  “Cat”	
  
    class Cat implements CommandListener{
          public void commandAction(Command c,
                                    Displayable d){
            // This will be called
        }
    }
BL	
  and	
  GUI	
  in	
  the	
  same	
  class	
  
•  In	
  small	
  programs	
  it	
  is	
  usual	
  that	
  the	
  GUI	
  -­‐	
  and	
  the	
  
   applicaFon	
  code	
  is	
  implemented	
  in	
  the	
  same	
  class.	
  
•  Now	
  the	
  listener	
  is	
  the	
  same	
  class:	
  
     –  class OmaMIDlet extends MIDlet implements
        CommandListener
•  And	
  registraFon:	
  
     –  textbox.setCommandListener(this);

Weitere ähnliche Inhalte

Andere mochten auch (9)

libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
Metrology of threads
Metrology of threadsMetrology of threads
Metrology of threads
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
 
Moved to Speakerdeck
Moved to SpeakerdeckMoved to Speakerdeck
Moved to Speakerdeck
 
libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and Preferences
 
PM_WBS
PM_WBSPM_WBS
PM_WBS
 
Gear thread
Gear threadGear thread
Gear thread
 
Screw thread measurements and Gear measurement
Screw thread measurements and Gear measurementScrew thread measurements and Gear measurement
Screw thread measurements and Gear measurement
 
Java Web Services
Java Web ServicesJava Web Services
Java Web Services
 

Ähnlich wie Intro to MIDP Development

Session2-J2ME development-environment
Session2-J2ME development-environmentSession2-J2ME development-environment
Session2-J2ME development-environmentmuthusvm
 
iOS for C# Developers - DevConnections Talk
iOS for C# Developers - DevConnections TalkiOS for C# Developers - DevConnections Talk
iOS for C# Developers - DevConnections TalkMiguel de Icaza
 
Titanium appcelerator best practices
Titanium appcelerator best practicesTitanium appcelerator best practices
Titanium appcelerator best practicesAlessio Ricco
 
Caliburn.micro
Caliburn.microCaliburn.micro
Caliburn.microbwullems
 
Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Oliver Gierke
 
Event handling63
Event handling63Event handling63
Event handling63myrajendra
 
Interface
InterfaceInterface
Interfacevvpadhu
 
22Flutter.pdf
22Flutter.pdf22Flutter.pdf
22Flutter.pdfdbaman
 
Extending the Enterprise with MEF
Extending the Enterprise with MEFExtending the Enterprise with MEF
Extending the Enterprise with MEFBrian Ritchie
 
Android Jumpstart Jfokus
Android Jumpstart JfokusAndroid Jumpstart Jfokus
Android Jumpstart JfokusLars Vogel
 
Guice tutorial
Guice tutorialGuice tutorial
Guice tutorialAnh Quân
 
[PBO] Pertemuan 12 - Pemrograman Android
[PBO] Pertemuan 12 - Pemrograman Android[PBO] Pertemuan 12 - Pemrograman Android
[PBO] Pertemuan 12 - Pemrograman Androidrizki adam kurniawan
 
Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator Alessio Ricco
 
BEST PRACTICES PER LA SCRITTURA DI APPLICAZIONI TITANIUM APPCELERATOR - Aless...
BEST PRACTICES PER LA SCRITTURA DI APPLICAZIONI TITANIUM APPCELERATOR - Aless...BEST PRACTICES PER LA SCRITTURA DI APPLICAZIONI TITANIUM APPCELERATOR - Aless...
BEST PRACTICES PER LA SCRITTURA DI APPLICAZIONI TITANIUM APPCELERATOR - Aless...Whymca
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0DivyaR219113
 

Ähnlich wie Intro to MIDP Development (20)

Session2-J2ME development-environment
Session2-J2ME development-environmentSession2-J2ME development-environment
Session2-J2ME development-environment
 
iOS for C# Developers - DevConnections Talk
iOS for C# Developers - DevConnections TalkiOS for C# Developers - DevConnections Talk
iOS for C# Developers - DevConnections Talk
 
Java1 in mumbai
Java1 in mumbaiJava1 in mumbai
Java1 in mumbai
 
Titanium appcelerator best practices
Titanium appcelerator best practicesTitanium appcelerator best practices
Titanium appcelerator best practices
 
Caliburn.micro
Caliburn.microCaliburn.micro
Caliburn.micro
 
Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Whoops! Where did my architecture go?
Whoops! Where did my architecture go?
 
Event handling63
Event handling63Event handling63
Event handling63
 
Interface
InterfaceInterface
Interface
 
22Flutter.pdf
22Flutter.pdf22Flutter.pdf
22Flutter.pdf
 
Extending the Enterprise with MEF
Extending the Enterprise with MEFExtending the Enterprise with MEF
Extending the Enterprise with MEF
 
Android Jumpstart Jfokus
Android Jumpstart JfokusAndroid Jumpstart Jfokus
Android Jumpstart Jfokus
 
Google GIN
Google GINGoogle GIN
Google GIN
 
Guice tutorial
Guice tutorialGuice tutorial
Guice tutorial
 
Basic of Applet
Basic of AppletBasic of Applet
Basic of Applet
 
[PBO] Pertemuan 12 - Pemrograman Android
[PBO] Pertemuan 12 - Pemrograman Android[PBO] Pertemuan 12 - Pemrograman Android
[PBO] Pertemuan 12 - Pemrograman Android
 
Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator
 
BEST PRACTICES PER LA SCRITTURA DI APPLICAZIONI TITANIUM APPCELERATOR - Aless...
BEST PRACTICES PER LA SCRITTURA DI APPLICAZIONI TITANIUM APPCELERATOR - Aless...BEST PRACTICES PER LA SCRITTURA DI APPLICAZIONI TITANIUM APPCELERATOR - Aless...
BEST PRACTICES PER LA SCRITTURA DI APPLICAZIONI TITANIUM APPCELERATOR - Aless...
 
1- java
1- java1- java
1- java
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
 
Griffon Presentation
Griffon PresentationGriffon Presentation
Griffon Presentation
 

Mehr von Jussi Pohjolainen

Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDXJussi Pohjolainen
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript DevelopmentJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDXJussi Pohjolainen
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDXJussi Pohjolainen
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesJussi Pohjolainen
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platformJussi Pohjolainen
 
Intro to Java ME and Asha Platform
Intro to Java ME and Asha PlatformIntro to Java ME and Asha Platform
Intro to Java ME and Asha PlatformJussi Pohjolainen
 
Quick Intro to JQuery and JQuery Mobile
Quick Intro to JQuery and JQuery MobileQuick Intro to JQuery and JQuery Mobile
Quick Intro to JQuery and JQuery MobileJussi Pohjolainen
 

Mehr von Jussi Pohjolainen (20)

Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDX
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript Development
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
libGDX: Scene2D
libGDX: Scene2DlibGDX: Scene2D
libGDX: Scene2D
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: User Input
libGDX: User InputlibGDX: User Input
libGDX: User Input
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDX
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDX
 
Android Threading
Android ThreadingAndroid Threading
Android Threading
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platform
 
Intro to Asha UI
Intro to Asha UIIntro to Asha UI
Intro to Asha UI
 
Intro to Java ME and Asha Platform
Intro to Java ME and Asha PlatformIntro to Java ME and Asha Platform
Intro to Java ME and Asha Platform
 
Intro to PhoneGap
Intro to PhoneGapIntro to PhoneGap
Intro to PhoneGap
 
Quick Intro to JQuery and JQuery Mobile
Quick Intro to JQuery and JQuery MobileQuick Intro to JQuery and JQuery Mobile
Quick Intro to JQuery and JQuery Mobile
 
JavaScript Inheritance
JavaScript InheritanceJavaScript Inheritance
JavaScript Inheritance
 
JS OO and Closures
JS OO and ClosuresJS OO and Closures
JS OO and Closures
 
Short intro to ECMAScript
Short intro to ECMAScriptShort intro to ECMAScript
Short intro to ECMAScript
 

Kürzlich hochgeladen

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Kürzlich hochgeladen (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Intro to MIDP Development

  • 1. MIDP  Development   Jussi  Pohjolainen   Tampere  University  of  Applied  Sciences  
  • 2. Class  Diagram  of  MIDP  app   abstract  class  MIDlet   +  int  checkPermission(String)   #  abstract  void  destroyApp(boolean)   +  String  getAppProperty(String)   +  void  noFfyDestroyed()   #  abstract  pauseApp()   +  boolean  plaGormRequest(String)   +  void  resumeRequest()   #  abstract  void  startApp();   class  MyMIDlet  
  • 3. Code   import javax.microedition.midlet.MIDlet; import javax.microedition.lcdui.*; public class MyMIDlet extends MIDlet { public MyMIDlet() {} public void startApp() {} public void destroyApp(boolean unconditional) {} public void pauseApp() {} }
  • 4. MIDlet’s  Life  Cycle   Constructor   destroyApp()   Paused   Destroyed   startApp()   pauseApp()   AcFve  
  • 5. ApplicaFon  Manager   •  Applica'on  Manager  controls  all  the  methods   in  the  previous  slide   •  You  can  try  to  change  the  state  by  using   methods  like:   –  void notifyDestroyed() –  notifyPaused() –  resumeRequest()
  • 6. Intro  to  MIDP  GUI  
  • 7. Intro  to  GUI   •  Problem:  Mobile  Devices  are  totally  different   from  each  other   –  Screen  size,  ResoluFon?   –  Color  Depth?   –  Input  Devices?   •  Two  soluFons   –  Abstrac'on:  Let  MIDP  take  care  of  the  pracFcal   implementaFon   –  Discover:  Sniff  the  features  of  the  current  phone  and   act  according  to  them  
  • 8. AbstracFon  vs.  Discover   •  AbstracFon:  Use  high-­‐level  API   –  Portability  key  issue   –  Very  easy  to  use   –  LiXle  control  over  look  and  feel   •  Discover:  Use  low-­‐level  API   –  Full  control  over  graphics   –  Classes  like  Canvas,  Graphics,  Image,  Font   –  Time  consuming,  but  you  can  control  the  look  and   feel  
  • 9. Display   •  MIDP  GUI  could  be  seen  as  a  deck  of  cards   •  No  mulFple  windows   •  Display is  a  class  that  represents  the  screen   display   •  Display has  a  single  GUI-­‐element  whose   content  is  controlled  by  one  app  at  any  Fme   •  The  main  task  of  the  Display-­‐class  is  to  take   care  of  what  is  visible  at  the  screen  
  • 10. Using  Display  –  class  in  Code   import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class MyMIDlet extends MIDlet { public MyMIDlet() {} public void pauseApp() {} public void destroyApp(boolean ignore) {} public void startApp() { Display d = Display.getDisplay(this); d.setCurrent(…); } }
  • 11. Using  Display   •  You  ask  reference  to  the  client  device's  display:   public void startApp(){ Display d = Display.getDisplay(this) } •  SpecificaFon  says  that  this  is  done  in  startApp-­‐ method   •  A^er  ge_ng  the  reference,  you  can  use  Display-­‐ classes  methods:   –  public void setCurrent(Displayable next) –  public void setCurrent(Alert alert, Displayable nestDisplayable)
  • 12. Display’s  methods   •  boolean flashBacklight(int d) •  boolean isColor() •  int numColors() •  boolean vibrate(int duration)
  • 13. Displayable   •  Display  is  responsible  for  changing  GUI  –   elements  on  the  screen   •  These  GUI-­‐elements  are  Displayable –   objects.   •  Displayable is  a  abstract  class  that  has   couple  concrete  classes  
  • 17. DelegaFon  Event  Handling   •  MIDlet's  event  handling  system  is  the  same  as  in  Java  SE   •  DelegaFon  Event    Model:   –  Simple  and  easy  to  learn   –  Support  a  clean  separa'on  between  applica'on  and  GUI  code   –  Facilitate  the  creaFon  of  robust  event  handling  code  which  is   less  error-­‐prone  (strong  compile-­‐Fme  checking)   –  Flexible  enough  to  enable  varied  applicaFon  models  for  event   flow  and  propagaFon   –  For  visual  tool  builders,  enable  run-­‐Fme  discovery  of  both   events  that  a  component  generates  as  well  as  the  events  it  may   observe   –  Support  backward  binary  compaFbility  with  the  old  model  
  • 18. SeparaFon  of  GUI  and  BL   RegistraFon   Source   Listener  
  • 19. DelegaFon  Event  Model  and  MIDlets   •  In  MIDP,  event  source  is  usually  Displayable-­‐ object   •  RegistraFon  is  done  with   –  setCommandListener(CommandListener l) •  Listener  can  be  any  object,  which  class  has   implemented  the  CommandListener  interface!
  • 20. Example   •  Event  source   –  TextBox textbox = new TextBox(....); •  Event  Listener   –  Cat listener = new Cat(); •  RegistraFon   –  textbox.setCommandListener(listener); •  The  Cat-­‐class  must  implement  the  CommandListener-­‐class.     •  It  is  wise  to  add  some  commands  to  the  Textbox-­‐screen:   –  Command exitcommand = new Command(..); –  textbox.addCommand(exitcommand);
  • 21. Listener   •  Listener  can  be  any  class  that  implements  the   given  interface.     •  In  this  case,  Listener  is  a  class  called  “Cat”   class Cat implements CommandListener{ public void commandAction(Command c, Displayable d){ // This will be called } }
  • 22. BL  and  GUI  in  the  same  class   •  In  small  programs  it  is  usual  that  the  GUI  -­‐  and  the   applicaFon  code  is  implemented  in  the  same  class.   •  Now  the  listener  is  the  same  class:   –  class OmaMIDlet extends MIDlet implements CommandListener •  And  registraFon:   –  textbox.setCommandListener(this);