SlideShare ist ein Scribd-Unternehmen logo
1 von 22
App Development for
Nokia Asha Devices
with Java ME
                       Marlon Luz - INdT
               Nokia Developer Evangelist
                             @marlonluz
High-Level UI API
• GUI Components to create user
  interfaces
• Portable among MIDP compatible                   Displayable
  devices
   • Same look and feel                 Screen            Canvas
   • Small control on the look
     and feel
                                 Alert Form List TextBox GameCanvas
• All components are
  Displayables and they are
  subclasses of the Screen class
• Your app can create new
  instances of the components or
  extend them
Showing components and adding itens
to the components
  • Get the Display of the mobile and put your component in
    the display
    Display display = Display.getDisplay(midlet);
    Form form = new Form(“MyForm”);
    display.setCurrent(form);


  • Create a List component and add items in the List
    List list = new List(“My List”, Choice.IMPLCIT);
    list.append(“first”, null);
    list.append(“second”, null);
    list.append(“third”, null);
    display.setCurrent(list);
Simple Screens
 • Screens to user interact
    Alert                List   Textbox
Alert
• Notifications
• Dialog box of modal type
• Normally used to show error messages
  Alert alert = new Alert(“Alert”);
  alert.setType(AlertType.ERROR);
  alert.setString(“SOME ERROR”);
  display.setCurrent(alert);
• Tip: Error description and any message
  must be clear enough
List
• Mostrar escolhas ao usuário
  List list = new List(“Menu”,
              Choice.IMPLICIT);
  list.append(“New Game”, null);
  list.append(“High Scores”, null);
  list.append(“Help”, null);
  list.append(“About”, null);
  List.append(“Exit”, null);
  display.setCurrent(list);
TextBox
• Entrada de Dados pelo usuário

  TextBox textBox = new
  TextBox(“Type a
   message”,””,100,TextField.ANY);
  display.setCurrent(textBox);
Form
• Container for form items
• Kind of items:
   • TextField
   • StringItem
   • DateField
   • ImageItem
   • Gauge
   • CustomItem
   • ChoiceGroup
Managing items in the form

 • Adding items
   Form form = new Form(“form”);
   StringItem item = new StringItem(“text”,”text”);
   form.append(item);


 • Removing items
   form.delete(0); // deletes the first item
   form.deleteAll(); // deletes all items
Form items - TextField
• Use TextFields to the user input data
   TextField textField = new TextField(“TextField Label”,
    ”some text”,20,TextField.ANY);
   form.append(textField);

• Input types:
   TextField.ANY   - any char allowed
   TextField.EMAILADDR – email address chars allowed
   TextField.NUMERIC – integer number allowed
   TextField.PHONENUMBER – phone number chars allowed
   TextField.URL – URL chars allowed
   TextField.DECIMAL – decimal numbers allowed
Form items - TextField
• Other types:
   TextField.PASSWORD
   TextField.UNEDITABLE
   TextField.SENSITIVE
   TextField.NON_PREDICTIVE
   TextField.INITAL_CAPS_WORD
   TextField.CAPS_SENTENCE


• You can use the setConstraints() method to
  set the type after the item creation
Form items - StringItem
• Shows a static text

String str = "The game Shooter version 0.1 "+
 "was developed by Marlon Luz. For supporting "+
 "please send email for marlon.luz@live.com";

StringItem stringItem = new StringItem("About",str);

form.append(stringItem);
Form items - DateField
• Use DateField to show dates or to the
  user input dates

  DateField dateField = new DateField(“Birth
   Date”, DateField.DATE);

  java.util.Date date = new java.util.Date();

  dateField.setDate(date);

  form.append(dateField);
Form Items - Gauge
• Useful to show progress screens

  Gauge gauge = new Gauge(“Volume”,true,100,70);
  form.append(gauge);




  Gauge gauge =
   new Gauge(“Volume”, false,
   100,70);
  form.append(gauge);
Form Items - ImageItem
• It shows a image in a Form


Image image = Image.createImage("/foto.png");
ImageItem imageItem = new ImageItem("Picture",
           image, ImageItem.LAYOUT_CENTER, "");
form.append(imageItem);
Form Items - ChoiceGroup
• It shows options to choose

ChoiceGroup cgSex = new ChoiceGroup("Sex",
                            Choice.EXCLUSIVE);
cgSex.append("Male", null);
cgSex.append("Female", null);
form.append(cgSex);

ChoiceGroup cgSkills =
   new ChoiceGroup("Skills", Choice.MULTIPLE);
cgSkills.append("Java", null);
cgSkills.append("C++", null);
cgSkills.append("C#", null);
form.append(cgSkills);
Form Items - Spacer
• Space between items



  Spacer space = new Spacer(10,20);
  form.append(space);
Form Items - Tickers
• Ticker is like CNN news or the marquee HTML tag


  Ticker ticker = new Ticker(“The ticker sample”);
  form.setTicker(ticker);
Commands
• Commands can be applied in all Displayable
  components
  Command cmdExit = new Command("Exit",
                          Command.EXIT, 1);
  Command cmdOk = new Command(“OK",
                            Command.OK, 1);
  Command cmdList1 = new Command("List1",
                          Command.ITEM, 1);
  Command cmdList2 = new Command("List2",
                          Command.ITEM, 2);
  form.addCommand(cmdExit);
  form.addCommand(cmdOk);
  form.addCommand(cmdList1);
  form.addCommand(cmdList2);
Commands
• You have to define a class to implement the
  CommandListener interface
    public class SampleApp extends MIDlet implements CommandListener{


• You have to set the listener in the displayable component

  form.setCommandListener(this);
Commands
 • The commandAction() method must be implemented to
   handle the commands

   public void commandAction(Command c, Displayable d) {
       if (c == cmdExit) {
           notifyDestroyed();
       }
   }
Obrigado!
             Marlon Luz
 ext-marlon.luz@nokia.com
               @marlonluz

Weitere ähnliche Inhalte

Was ist angesagt?

Image contro, and format functions in vb
Image contro, and format functions in vbImage contro, and format functions in vb
Image contro, and format functions in vb
Amandeep Kaur
 
XMetaL Dialog Odds & Ends
XMetaL Dialog Odds & EndsXMetaL Dialog Odds & Ends
XMetaL Dialog Odds & Ends
XMetaL
 

Was ist angesagt? (20)

Java awt tutorial javatpoint
Java awt tutorial   javatpointJava awt tutorial   javatpoint
Java awt tutorial javatpoint
 
28 awt
28 awt28 awt
28 awt
 
tL19 awt
tL19 awttL19 awt
tL19 awt
 
Awt components
Awt componentsAwt components
Awt components
 
Vs c# lecture4
Vs c# lecture4Vs c# lecture4
Vs c# lecture4
 
AWT Packages , Containers and Components
AWT Packages , Containers and ComponentsAWT Packages , Containers and Components
AWT Packages , Containers and Components
 
Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4
 
Dr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWTDr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWT
 
Basic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in JavaBasic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in Java
 
Awt components
Awt componentsAwt components
Awt components
 
java-Unit4 chap2- awt controls and layout managers of applet
java-Unit4 chap2- awt controls and layout managers of appletjava-Unit4 chap2- awt controls and layout managers of applet
java-Unit4 chap2- awt controls and layout managers of applet
 
Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
Windows Forms For Beginners Part - 3
Windows Forms For Beginners Part - 3Windows Forms For Beginners Part - 3
Windows Forms For Beginners Part - 3
 
Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1
 
Image contro, and format functions in vb
Image contro, and format functions in vbImage contro, and format functions in vb
Image contro, and format functions in vb
 
Awt controls ppt
Awt controls pptAwt controls ppt
Awt controls ppt
 
Active x control
Active x controlActive x control
Active x control
 
XMetaL Dialog Odds & Ends
XMetaL Dialog Odds & EndsXMetaL Dialog Odds & Ends
XMetaL Dialog Odds & Ends
 
Awt and swing in java
Awt and swing in javaAwt and swing in java
Awt and swing in java
 

Andere mochten auch (6)

Wardi app
Wardi appWardi app
Wardi app
 
Introduction to twitter
Introduction to twitterIntroduction to twitter
Introduction to twitter
 
Social Media for Small Business
Social Media for Small BusinessSocial Media for Small Business
Social Media for Small Business
 
Marketing in Ministry
Marketing in MinistryMarketing in Ministry
Marketing in Ministry
 
Blogging for beginners
Blogging for beginnersBlogging for beginners
Blogging for beginners
 
Keeping Up With The Carters
Keeping Up With The Carters Keeping Up With The Carters
Keeping Up With The Carters
 

Ähnlich wie Nokia Asha App Development - Part 2

MIDP GUI Development: Alert, List, Form, TextBox
MIDP GUI Development: Alert, List, Form, TextBoxMIDP GUI Development: Alert, List, Form, TextBox
MIDP GUI Development: Alert, List, Form, TextBox
Jussi Pohjolainen
 
Implement a Javascript application that allows the user to enter strin.docx
Implement a Javascript application that allows the user to enter strin.docxImplement a Javascript application that allows the user to enter strin.docx
Implement a Javascript application that allows the user to enter strin.docx
mckerliejonelle
 
12 High Level UI Event Handling
12 High Level UI Event Handling12 High Level UI Event Handling
12 High Level UI Event Handling
corneliuskoo
 
Windows Programming with AWT
Windows Programming with AWTWindows Programming with AWT
Windows Programming with AWT
backdoor
 

Ähnlich wie Nokia Asha App Development - Part 2 (20)

Gui
GuiGui
Gui
 
MIDP GUI Development: Alert, List, Form, TextBox
MIDP GUI Development: Alert, List, Form, TextBoxMIDP GUI Development: Alert, List, Form, TextBox
MIDP GUI Development: Alert, List, Form, TextBox
 
GUI (graphical user interface)
GUI (graphical user interface)GUI (graphical user interface)
GUI (graphical user interface)
 
GWT Widgets
GWT WidgetsGWT Widgets
GWT Widgets
 
Scmad Chapter05
Scmad Chapter05Scmad Chapter05
Scmad Chapter05
 
Java awt
Java awtJava awt
Java awt
 
Mobile Application Development class 007
Mobile Application Development class 007Mobile Application Development class 007
Mobile Application Development class 007
 
06 win forms
06 win forms06 win forms
06 win forms
 
Implement a Javascript application that allows the user to enter strin.docx
Implement a Javascript application that allows the user to enter strin.docxImplement a Javascript application that allows the user to enter strin.docx
Implement a Javascript application that allows the user to enter strin.docx
 
Mobile Application Development,J2ME,UNIT-4-JNTU
Mobile Application Development,J2ME,UNIT-4-JNTUMobile Application Development,J2ME,UNIT-4-JNTU
Mobile Application Development,J2ME,UNIT-4-JNTU
 
12 High Level UI Event Handling
12 High Level UI Event Handling12 High Level UI Event Handling
12 High Level UI Event Handling
 
engineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.pptengineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.ppt
 
Advance Java Programming (CM5I) 1.AWT
Advance Java Programming (CM5I) 1.AWTAdvance Java Programming (CM5I) 1.AWT
Advance Java Programming (CM5I) 1.AWT
 
Ingles 2do parcial
Ingles   2do parcialIngles   2do parcial
Ingles 2do parcial
 
13457272.ppt
13457272.ppt13457272.ppt
13457272.ppt
 
Treinamento Qt básico - aula III
Treinamento Qt básico - aula IIITreinamento Qt básico - aula III
Treinamento Qt básico - aula III
 
Windows Programming with AWT
Windows Programming with AWTWindows Programming with AWT
Windows Programming with AWT
 
Visualbasic tutorial
Visualbasic tutorialVisualbasic tutorial
Visualbasic tutorial
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
Rethink Frontend Development With Elm
Rethink Frontend Development With ElmRethink Frontend Development With Elm
Rethink Frontend Development With Elm
 

Mehr von Marlon Luz

Mehr von Marlon Luz (20)

Como a Microsoft faz software: Desgerenciando Pessoas
Como a Microsoft faz software: Desgerenciando PessoasComo a Microsoft faz software: Desgerenciando Pessoas
Como a Microsoft faz software: Desgerenciando Pessoas
 
Homo Appiens - O ser humano que desenvolve Apps. Você é um?
Homo Appiens - O ser humano que desenvolve Apps. Você é um?Homo Appiens - O ser humano que desenvolve Apps. Você é um?
Homo Appiens - O ser humano que desenvolve Apps. Você é um?
 
Microsoft & Internet of Things
Microsoft & Internet of ThingsMicrosoft & Internet of Things
Microsoft & Internet of Things
 
Construindo Universal Apps para Windows e Windows Phone
Construindo Universal Apps para Windows e Windows PhoneConstruindo Universal Apps para Windows e Windows Phone
Construindo Universal Apps para Windows e Windows Phone
 
Loja de aplicativos e portal do desenvolvedor
Loja de aplicativos e portal do desenvolvedorLoja de aplicativos e portal do desenvolvedor
Loja de aplicativos e portal do desenvolvedor
 
O que há de novo no Windows Phone
O que há de novo no Windows PhoneO que há de novo no Windows Phone
O que há de novo no Windows Phone
 
Agilidade em aplicativos mobile
Agilidade em aplicativos mobileAgilidade em aplicativos mobile
Agilidade em aplicativos mobile
 
Loja de Aplicativos e Portal do Desenvolvedor
Loja de Aplicativos e Portal do DesenvolvedorLoja de Aplicativos e Portal do Desenvolvedor
Loja de Aplicativos e Portal do Desenvolvedor
 
Desenvolvendo Apps para Windows phone
Desenvolvendo Apps para Windows phoneDesenvolvendo Apps para Windows phone
Desenvolvendo Apps para Windows phone
 
Desenvolvimento para Windows Phone
Desenvolvimento para Windows PhoneDesenvolvimento para Windows Phone
Desenvolvimento para Windows Phone
 
Babel fish, Guias e APIs
Babel fish, Guias e APIsBabel fish, Guias e APIs
Babel fish, Guias e APIs
 
Desenvolvimento de Apps para celulares Nokia Lumia & Nokia asha
Desenvolvimento de Apps para celulares Nokia Lumia & Nokia ashaDesenvolvimento de Apps para celulares Nokia Lumia & Nokia asha
Desenvolvimento de Apps para celulares Nokia Lumia & Nokia asha
 
Potencialidades de um telefone celular para pessoas com necessidades especiais
Potencialidades de um telefone celular para pessoas com necessidades especiaisPotencialidades de um telefone celular para pessoas com necessidades especiais
Potencialidades de um telefone celular para pessoas com necessidades especiais
 
Nokia Asha App Development - Part 1
Nokia Asha App Development - Part 1Nokia Asha App Development - Part 1
Nokia Asha App Development - Part 1
 
Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2
 
Game Development for Nokia Asha Devices with Java ME #1
Game Development for Nokia Asha Devices with Java ME #1Game Development for Nokia Asha Devices with Java ME #1
Game Development for Nokia Asha Devices with Java ME #1
 
Distribua sua App para o mundo e ganhe $$
Distribua sua App para o mundo e ganhe $$Distribua sua App para o mundo e ganhe $$
Distribua sua App para o mundo e ganhe $$
 
Desenvolvendo Games para Nokia Asha
Desenvolvendo Games para Nokia AshaDesenvolvendo Games para Nokia Asha
Desenvolvendo Games para Nokia Asha
 
Programação para mobile: Serviços e Aplicativos
Programação para mobile: Serviços e AplicativosProgramação para mobile: Serviços e Aplicativos
Programação para mobile: Serviços e Aplicativos
 
In-app purchasing for java me apps
In-app purchasing for java me appsIn-app purchasing for java me apps
In-app purchasing for java me apps
 

Nokia Asha App Development - Part 2

  • 1. App Development for Nokia Asha Devices with Java ME Marlon Luz - INdT Nokia Developer Evangelist @marlonluz
  • 2. High-Level UI API • GUI Components to create user interfaces • Portable among MIDP compatible Displayable devices • Same look and feel Screen Canvas • Small control on the look and feel Alert Form List TextBox GameCanvas • All components are Displayables and they are subclasses of the Screen class • Your app can create new instances of the components or extend them
  • 3. Showing components and adding itens to the components • Get the Display of the mobile and put your component in the display Display display = Display.getDisplay(midlet); Form form = new Form(“MyForm”); display.setCurrent(form); • Create a List component and add items in the List List list = new List(“My List”, Choice.IMPLCIT); list.append(“first”, null); list.append(“second”, null); list.append(“third”, null); display.setCurrent(list);
  • 4. Simple Screens • Screens to user interact Alert List Textbox
  • 5. Alert • Notifications • Dialog box of modal type • Normally used to show error messages Alert alert = new Alert(“Alert”); alert.setType(AlertType.ERROR); alert.setString(“SOME ERROR”); display.setCurrent(alert); • Tip: Error description and any message must be clear enough
  • 6. List • Mostrar escolhas ao usuário List list = new List(“Menu”, Choice.IMPLICIT); list.append(“New Game”, null); list.append(“High Scores”, null); list.append(“Help”, null); list.append(“About”, null); List.append(“Exit”, null); display.setCurrent(list);
  • 7. TextBox • Entrada de Dados pelo usuário TextBox textBox = new TextBox(“Type a message”,””,100,TextField.ANY); display.setCurrent(textBox);
  • 8. Form • Container for form items • Kind of items: • TextField • StringItem • DateField • ImageItem • Gauge • CustomItem • ChoiceGroup
  • 9. Managing items in the form • Adding items Form form = new Form(“form”); StringItem item = new StringItem(“text”,”text”); form.append(item); • Removing items form.delete(0); // deletes the first item form.deleteAll(); // deletes all items
  • 10. Form items - TextField • Use TextFields to the user input data TextField textField = new TextField(“TextField Label”, ”some text”,20,TextField.ANY); form.append(textField); • Input types: TextField.ANY - any char allowed TextField.EMAILADDR – email address chars allowed TextField.NUMERIC – integer number allowed TextField.PHONENUMBER – phone number chars allowed TextField.URL – URL chars allowed TextField.DECIMAL – decimal numbers allowed
  • 11. Form items - TextField • Other types: TextField.PASSWORD TextField.UNEDITABLE TextField.SENSITIVE TextField.NON_PREDICTIVE TextField.INITAL_CAPS_WORD TextField.CAPS_SENTENCE • You can use the setConstraints() method to set the type after the item creation
  • 12. Form items - StringItem • Shows a static text String str = "The game Shooter version 0.1 "+ "was developed by Marlon Luz. For supporting "+ "please send email for marlon.luz@live.com"; StringItem stringItem = new StringItem("About",str); form.append(stringItem);
  • 13. Form items - DateField • Use DateField to show dates or to the user input dates DateField dateField = new DateField(“Birth Date”, DateField.DATE); java.util.Date date = new java.util.Date(); dateField.setDate(date); form.append(dateField);
  • 14. Form Items - Gauge • Useful to show progress screens Gauge gauge = new Gauge(“Volume”,true,100,70); form.append(gauge); Gauge gauge = new Gauge(“Volume”, false, 100,70); form.append(gauge);
  • 15. Form Items - ImageItem • It shows a image in a Form Image image = Image.createImage("/foto.png"); ImageItem imageItem = new ImageItem("Picture", image, ImageItem.LAYOUT_CENTER, ""); form.append(imageItem);
  • 16. Form Items - ChoiceGroup • It shows options to choose ChoiceGroup cgSex = new ChoiceGroup("Sex", Choice.EXCLUSIVE); cgSex.append("Male", null); cgSex.append("Female", null); form.append(cgSex); ChoiceGroup cgSkills = new ChoiceGroup("Skills", Choice.MULTIPLE); cgSkills.append("Java", null); cgSkills.append("C++", null); cgSkills.append("C#", null); form.append(cgSkills);
  • 17. Form Items - Spacer • Space between items Spacer space = new Spacer(10,20); form.append(space);
  • 18. Form Items - Tickers • Ticker is like CNN news or the marquee HTML tag Ticker ticker = new Ticker(“The ticker sample”); form.setTicker(ticker);
  • 19. Commands • Commands can be applied in all Displayable components Command cmdExit = new Command("Exit", Command.EXIT, 1); Command cmdOk = new Command(“OK", Command.OK, 1); Command cmdList1 = new Command("List1", Command.ITEM, 1); Command cmdList2 = new Command("List2", Command.ITEM, 2); form.addCommand(cmdExit); form.addCommand(cmdOk); form.addCommand(cmdList1); form.addCommand(cmdList2);
  • 20. Commands • You have to define a class to implement the CommandListener interface public class SampleApp extends MIDlet implements CommandListener{ • You have to set the listener in the displayable component form.setCommandListener(this);
  • 21. Commands • The commandAction() method must be implemented to handle the commands public void commandAction(Command c, Displayable d) { if (c == cmdExit) { notifyDestroyed(); } }
  • 22. Obrigado! Marlon Luz ext-marlon.luz@nokia.com @marlonluz