Others errata - Android2eeAndroid2ee formation expert android
× Graphical User Interface

Others errata

More
12 years 5 months ago #24 by mseguy
Others errata was created by mseguy
Hello,
:oops:
Some errors have been found, below you can find the corrections:
  1. GUI is the acronym of Graphical User Interface
  2. Below the schema that shows the life cycle of an activity, the legend is missing: developer.android.com/guide/topics/fundamentals/activities.html, but you should have recognize it.
  3. Page 28,
    public void onTextChanged(CharSequence s, int start, int before, int count) {
    autoCompleteTextView.setText(textView.getText());
    }


    has to be modified by:
    public void onTextChanged(CharSequence s, int start, int before, int count) {
    textView.setText(autoCompleteTextView.getText());
    }


    (thanks to renaudm)
  4. Page 68,

    In the activity OtherActivty, the way to send back information to the calling activity is missing.
    To do that you can add a method setResultsForCaller. Then, when you want to save data (anywhere in your activity), just call this method. You can also use the method's body anywhere to do the same thing (store information that will be send back to the calling activity) :
    protected void setResultsForCaller () {
    	//I define an Intent to add the data
        Intent result = new Intent();
    	//I use a Bundle to store those data
        Bundle b = new Bundle();
    	//I add data i want to send back to the calling activity within the bundle
        b.putParcelableArray("com.whatever.data", items);
    	//I store the bundle in the Intent
        result.putExtras(b);
    	//And i ask to reminber this Intent as the result of my activity
        setResult(Activity.RESULT_OK, result);
    }


  5. Page 87,

    In the definition of the ListPreference in the preference.xml file,i wrote :
    <ListPreference 
          android:key="@string/list" 
          android:title="Choice dialog" 
          android:summary="Click to open a list of choices"
    android:entries="@array/i_like_array"
    android:dialogTitle="Choose what you like" />


    but you have to write:
    <ListPreference 
          android:key="@string/list" 
          android:title="Choice dialog" 
          android:summary="Click to open a list of choices"
    android:entries="@array/i_like_array"

    android:entryValues="@array/i_like_array"
    android:dialogTitle="Choose what you like" />


    or, you can write:
    <ListPreference 
          android:key="@string/list" 
          android:title="Choice dialog" 
          android:summary="Click to open a list of choices" 
    android:entries="@array/i_like_array"

    android:entryValues="@array/i_like_array_values"
          android:dialogTitle="Choose what you like" />


    In the first case, the entries (the list of characters displayed to the user) and the entryValues (the list of returned objects when a selection is done) are identical, in the second case, it's two different arrays.
    The usefulness of having a entryValues ??is to return an integer, a string or other. Most of the time entries and entryValues may be the same.


    The second mistake of this paragraph is where to declare the i_like_array. If you do that in the string.xml file, it doesn't work. You need to declare them (i_like_array et i_like_array_values) in a specific file : res\values\arrays.xml (beside the string.xml file).

    So the correct way to do that is:

    The string.xml file:
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <string name="hello">Hello World, PreferenceSimpleTuto!</string>
        <string name="app_name">PreferenceSimpleTuto</string>
        <string name="checkbox">Check Box</string>
        <string name="ringtone">Ring Tone</string>
        <string name="checkbox2">Check Box2</string>
        <string name="text">Text</string>
        <string name="list">List</string>
    </resources>


    the arrays.xml file:
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
    	<string-array name="i_like_array">
    		<item>chocolate</item>
    		<item>television</item>
    		<item>internet</item>
    		<item>nicotine</item>
    		<item>hug</item>
    		<item>Santa Claus</item>
    	</string-array>
    	<string-array name="i_like_array_values">
    		<item>chocolate</item>
    		<item>television</item>
    		<item>internet</item>
    		<item>nicotine</item>
    		<item>hug</item>
    		<item>SantaClaus</item>
    	</string-array>
    </resources>


  6. Page 215,

    I wrote

    "In the case of your production key, enter:
    $ keytool -list -alias alias_name -keystore my-release-key.keystore
    "


    I should have write:
    "In the case of your production key, enter:
    $ keytool -list -alias alias_name -keystore my-release-key.keystore -storepass my-keystore-password -keypass my-key-password
    "
  7. Page 222, 269:

    I wrote :

    <groupId>android</groupId>

    <artifactId>android</artifactId>



    The first groupId is wrong, I should have write:


    <groupId>com.google.android</groupId>

    <artifactId>android</artifactId>


Mathias Séguy
This email address is being protected from spambots. You need JavaScript enabled to view it.
Auteur Android2ee.com
Docteur en Mathématiques Fondamentales
Directeur Technique & Avant-vente
Expert Technique de l'Agence Nationale de la Recherche
Rédacteur sur Developpez.com

Please Log in or Create an account to join the conversation.

Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Affichage
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline