Familja Java dhe J2ME


In Eclipse, go to Help -> Install New Software



Yüklə 8,99 Mb.
səhifə6/8
tarix17.09.2018
ölçüsü8,99 Mb.
#68797
1   2   3   4   5   6   7   8

In Eclipse, go to Help -> Install New Software

  • In Eclipse, go to Help -> Install New Software

  • Click ‘Add’ in top right

  • Enter:

    • Name: ADT Plugin
    • Location: https://dl-ssl.google.com/android/eclipse/
  • Click OK, then select ‘Developer Tools’, click Next

  • Click Next and then Finish

  • Afterwards, restart Eclipse

  • Specify SDK location (next 3 slides)

    • Must do this every time start a new project in a new location (at least in Windows)










Need

  • Need

  • the

  • items

  • circled

  • Then

  • click

  • Finish



src – your source code

  • 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



Used to define some of the resources

  • 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


Auto-generated: you shouldn’t edit it

  • 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));


Eclipse has a great UI creator

  • 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




Click ‘Create’ to make layout modifications

  • Click ‘Create’ to make layout modifications

  • When in portrait mode can select ‘Portrait’ to make a res sub folder for portrait layouts

    • Likewise for Landscape layouts while in landscape mode
    • Will create folders titled ‘layout-port’ and ‘layout-land’
  • Note: these ‘port’ and ‘land’ folders are examples of ‘alternate layouts’, see here for more info

    • http://developer.android.com/guide/topics/resources/providing-resources.html
  • Avoid errors by making sure components have the same id in both orientations, and that you’ve tested each orientation thoroughly





In res/values

  • In res/values

    • strings.xml
  • Application wide available strings

  • Promotes good software engineering

  • UI components made in the UI editor should have text defined in strings.xml

  • Strings are just one kind of ‘Value’ there are many others



Contains characteristics about your application

  • Contains characteristics about your application

  • When have more than one Activity in app, NEED to specify it in manifest file

  • Need to specify Services and other components too

  • Also important to define permissions and external libraries, like Google Maps API





Activity

  • Activity

    • http://developer.android.com/guide/topics/fundamentals/activities.html
  • Service

    • http://developer.android.com/guide/topics/fundamentals/services.html
  • Content Providers

  • Broadcast Receivers

  • Android in a nutshell:

    • http://developer.android.com/guide/topics/fundamentals.html


The basis of android applications

  • 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





Yüklə 8,99 Mb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə