Forum forum członków oddziału zaczerskiego, reszty naszego zaczerskiego społeczeństwa i nie tylko Strona Główna forum członków oddziału zaczerskiego, reszty naszego zaczerskiego społeczeństwa i nie tylko
zapraszamy:)
 
 » FAQ   » Szukaj   » Użytkownicy   » Grupy  » Galerie   » Rejestracja 
 » Profil   » Zaloguj się, by sprawdzić wiadomo¶ci   » Zaloguj 

Practicing Essay Producing to Get Better at Composing

 
Napisz nowy temat   Odpowiedz do tematu    Forum forum członków oddziału zaczerskiego, reszty naszego zaczerskiego społeczeństwa i nie tylko Strona Główna -> Ogłoszenia
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomo¶ć
WilliamCrusa
Go¶ć






PostWysłany: ¦ro 18:05, 21 Cze 2017    Temat postu: Practicing Essay Producing to Get Better at Composing

?Android Software Enhancement
Chapter four. Beneath the Covers: Startup Code and Resources inside MJAndroid Software
Chapter 3 introduced the major software we use in such a book to illustrate common Android concepts. That chapter explained which data files make up the source code, however it didn’t actually cover any source code while in the software. We’ll get started with seeking at source code during this chapter. And to permit you to definitely get started developing an software speedily, we’ll begin with the to begin with task every standalone software has to perform: initialization.
The events covered with this chapter occur in between your selecting “Run As Android Application” from the Eclipse menu and seeing the map that MJAndroid displays at startup. This chapter shows how Android makes it painless to build relatively complex apps. In just 80 lines of code and some associated XML resource information, MJAndroid manages to:
Display an interactive map
Track the existing location for the Android phone and update the map
Develop a local databases of specifics and load person preferences into it
Produce a dynamically changing menu
Display person interface factors these types of as labels, buttons, and spinners
Run a new Activity to display a supporting screen
The Java code in an Android software interacts tightly with XML resource data files, so we’ll bounce again and forth relating to them in such a chapter. As we point out repeatedly, XML data files are easier to tweak during advancement and preserve over the life of an software. The design and style of Android encourages you to definitely specify the start looking and behavior within the software around the resource information.
Initialization Parameters in AndroidManifest.xml
As Chapter 3 explained, we told Android to launch Microjobs.java since the number one Activity for MJAndroid. We defined that within the Software tab on the AndroidManifest.xml editor. The to begin with part of your XML code that gains from that choice is revealed below:
This section with the chapter focuses relating to the XML during this file. The MicroJobs Activity is identified inside the manifest for the beginning for the file. This part from the file is normally created in Eclipse if you happen to 1st generate the Assignment you use to put in writing your software .
Like all nice XML information, line 1 has the standard declaration for the XML version also, the character encoding employed. Before we get into the Activities that make up the MJAndroid software, we define a small number of parameters and declare needed permissions for your whole software:
This is just the package name we gave when we created the software in Eclipse. It is also the default package for all the modules while in the software.
This can be an integer that should always increment with each individual new version for the software. Every software should include a version code, and it should always be a monotonically increasing integer from version to version. This allows other programs (these as Android Market, installers, and launchers) easily figure out which is the latest version of an software. The filename of your .apk file should include this same version quantity, so it is obvious which version it has.
This version identifier is regarded as a string, and it is intended to be increased like the version figures you usually see for programs. The naming convention is up to you, but generally the idea is to apply a scheme like m.n.o (for as more and more quantities as you must use), to identify successive amounts of change to the software. The idea is this is the version identifier that would be displayed into a person (either by your software or another software).
There are four of these in MJAndroid, and they declare that the software intends to make use of amenities of Android that require explicit permission from the consumer in the cell product jogging the software. The permission is requested once the software is installed, and from then on Android remembers that the consumer stated it was OK (or not) to run this software and obtain the secure functionality. There are lots of permissions by now defined in Android, all described on the Android documentation (search for android.Manifest.permission ). You can actually also define your have permissions and use them to restrict other applications’ accessibility to functions into your software, unless the consumer grants another software that permission. The permissions requested right here are:
ACCESS_FINE_LOCATION. which is required to obtain location help and advice from the GPS sensor.
ACCESS_LOCATION_EXTRA_COMMANDS. The Android documentation doesn’t tell us which location commands are “extra,” so we’ll ask for all of these.
CALL_PHONE. This will allow MJAndroid to request that the Dialer put a cellular phone call on its behalf.
ACCESS_MOCK_LOCATION. so we can get fake location content when we’re operating beneath the emulator.
INTERNET. so we can retrieve map tiles over an Internet relationship.
This is the filename for a PNG file that comprises the icon you’d like make use of on your software. In this particular case we’re telling the Android SDK to start looking for that icon file on the drawable subdirectory from the res (resources) directory underneath MJAndroid. Android will use this icon on your software inside the Android Desktop.
Turning our attention to the definition for your number one (and main) Activity, MicroJobs, we 1st define one or two attributes with the Activity:
The name with the Activity. The entire name belonging to the Activity consists of the package name (which in our software is “com.microjobsinc.mjandroid.MicroJobs”), but since this file is always put into use inside package’s namespace, we do not require to include the leading package names. The Android SDK strips the package name down to “.MicroJobs” when it creates this part of AndroidManifest.xml . and even the leading period is optional.
The label that we would like to appear within the top with the Android screen once the Activity is around the screen. We saw this before in HelloWorld, where we changed the string in strings.xml to match our software.
We then declare an intent filter that tells Android when this Activity should be run. We talked briefly about Intents in Chapter 1. and now we see them in use. As you’ll recall, when Android encounters an Intent to fulfill, it looks among the on hand Activities and Expert services to see something that can assistance the Intent. We established two attributes:
Right now Android is trying to launch this software, so it is trying for an Activity that declares itself wanting to resolve the MAIN action. Any software which is going to be launched by the Launcher needs to have exactly a single Activity or Assistance that makes this assertion.
The Intent resolver in Android employs this attribute to further qualify the Intent that it is trying for. In such a case, the qualification tends to be that we’d like for this Activity to be displayed from the Consumer Menu so the person can select it to start out this software. Specifying the LAUNCHER category accomplishes this. You’re able to have a perfectly valid software without this attribute-you just won’t be able to launch it from the Android consumer interface. Normally, again, you’ll have exactly 1 LAUNCHER for every software, and it will appear within the same intent filter since the opening Activity of your software.
The right content on your career. Discover unlimited learning on demand for all around $1/day .
Powrót do góry
Wy¶wietl posty z ostatnich:   
Napisz nowy temat   Odpowiedz do tematu    Forum forum członków oddziału zaczerskiego, reszty naszego zaczerskiego społeczeństwa i nie tylko Strona Główna -> Ogłoszenia Wszystkie czasy w strefie EET (Europa)
Strona 1 z 1

 
Skocz do:  
Możesz pisać nowe tematy
Możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach


fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2005 phpBB Group
subMildev free theme by spleen & Programosy
Regulamin