Android Apps for Absolute Beginners

3rd Edition

By Wallace Jackson

Anybody can start building multimedia apps for the Android platform, and this book will show you how! Now updated to include both Android 4.4 and the new Android L, Android Apps for Absolute Beginners, Third Edition takes you through the process of getting your first Android apps up and running using plain English and practical examples.

Full Description

  • ISBN13: 978-1-484200-20-9
  • 712 Pages
  • User Level: Beginner
  • Publication Date: August 16, 2014
  • Available eBook Formats: EPUB, MOBI, PDF
  • Print Book Price: $44.99
  • eBook Price: $31.99
Buy eBook Buy Print Book Add to Wishlist

Related Titles

Full Description

Anybody can start building multimedia apps for the Android platform, and this book will show you how! Now updated to include both Android 4.4 and the new Android L, Android Apps for Absolute Beginners, Third Edition takes you through the process of getting your first Android apps up and running using plain English and practical examples. If you have a great idea for an Android app, but have never programmed before, then this book is for you.

This book cuts through the fog of jargon and mystery that surrounds Android apps development, and gives you simple, step-by-step instructions to get you started.

  • Teaches Android application development in language anyone can understand, giving you the best possible start in Android development
  • Provides simple, step-by-step examples that make learning easy, allowing you to pick up the concepts without fuss
  • Offers clear code descriptions and layout so that you can get your apps running as soon as possible

This book covers both Android 4.4 (KitKat) and Android L, but is also backwards compatible to cover the previous Android releases since Android 1.5.

What you’ll learn

  • Download, install, and configure the latest software needed for Android app development
  • Work efficiently using an integrated development environment (IDE)
  • Build useful, attractive applications and get them working immediately
  • Develop apps for both Android 4.4 and Android L
  • Create apps with ease using XML markup and drag-and-drop graphical layout editors
  • Use new media and graphics to skin your app so that it has maximum appeal
  • Create advanced apps combining XML, Java and new media content

Who this book is for

If you have a great idea for an Android app, but have never programmed before, then this book is for you. You don’t need to have any previous computer programming skills—as long as you have a desire to learn, and you know which end of the mouse is which, the world of Android apps development awaits!

Table of Contents

Table of Contents

1. Setting Up Your Android App Development System

2. Configuring Your Android App Development System

3. An Introduction to the Android Application Development Platform

4. Introduction to XML: Defining an Android App, its Design, and Constants

5. Introduction to Java: Objects, Methods, Classes and Interfaces

6. Android Screen Design: Writing to the Display using Activity and View

7. Making Apps Interactive: Intents, Event Handling and Menus

8: Android UI Design: Using ViewGroup Layout Containers

9: Android Graphics Design: Making Your UI Designs Visual

10: Android Animation: Making Your UI Designs Animated

11: Digital Video: Streaming Video, MediaPlayer, MediaController class

12: Digital Audio: Providing Aural Feedback for UI Designs & SoundPool

13: Services and Threads: Background Processin

14: Content Providers: Providing Data to Application

15: Developing for Android Wearable Devices

16: The Future of Android: 64-bit Android L

17: Appendix A: Audio Concepts, Terminology, and Codecs

Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.

Errata

Please Login to submit errata.

On page 85:
1. The image mentioned is not on the web address WallaceJackson.com is is on web page http://wallacejackson.com/mindtaffy-green.html

2. Filename of mentioned GIF file is not MindTaffyLogoAndroidGreen.gif but it is MT240 .gif

3. Dimensions of that GIF file is not 200x200, it is 240*180

4. Threrefore user must resize image, and resize canvas, which one can't do if has no previous experience with image manipulation software such as PhotoShop or Gimp

On page 85:
Author fails to mention (instruct) to reader that media files for this chapter are in Original_New_Media_Assets folder of downloadable source code.

On page 195:
With XML shown on page 195, Figure 6-26, reader cannot get scrren to look like the most righthand pciture on Figure 6-20. I can't attach screenshot here but it looks like:

http://i968.photobucket.com/albums/ae168/nenadbulatovic/device-2014-11-22-184725.png

Instead of uselesss screenshots of code, author should real listings of code, phase by phase as source code for book is just for the end of projects, not for the intermediate phases.

Complete code (according to screenshots from book) for this XML file is:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="horizontal" android:background="@drawable/galaxyinfoscreen" >

<LinearLayout android:orientation="vertical" android:layout_margin="12dip"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="#00000000">

<TextView android:text="@string/hello_world" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="48dip" android:textStyle="bold" />

<TextView android:text="@string/galaxy_name" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/galaxy_solar" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/galaxy_habit" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/galaxy_colony" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/galaxy_pop" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/galaxy_fleet" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/galaxy_ships" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>

<LinearLayout android:orientation="vertical" android:layout_margin="33dip"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="#00000000" >

<TextView android:text="@string/name_data" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/solar_data" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/habit_data" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/colony_data" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/pop_data" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/fleet_data" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<TextView android:text="@string/ships_data" android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>



On page 195:
With code published
on page 192, Figure 6-24, improved to code
on page 195, Figure 6-26
and page 197, Figure 6-27

is not possible to get result as on
Page 188, Figure 6-20 (picture on right)
Page 206, Figure 6-36 (left hand)




On page 213 to 257:

Passing of values ​​between the main view and the edit view (vice versa on OK button) It does not work because a lot of code , especially working with the "intent " is missing.

Missing code in:

MainActivity.Java

public boolean onOptionsItemSelected(MenuItem item){
switch(item.getItemId()){
case R.id.edit_galaxy:
Intent editIntent = new Intent(this, EditGalaxy.class);
editIntent.putExtra("editIntent_galaxyColonies", String.valueOf(milkyWay.galaxyColonies));
editIntent.putExtra("editIntent_galaxyLifeforms", String.valueOf(milkyWay.galaxyLifeforms));
editIntent.putExtra("editIntent_galaxyFleets", String.valueOf(milkyWay.galaxyFleets));
editIntent.putExtra("editIntent_galaxyStarships", String.valueOf(milkyWay.galaxyStarships));
this.startActivity(editIntent);
break;
case R.id.action_settings:
break;
default:
return super.onOptionsItemSelected(item);
}
return true;

EditGalaxy.Java

public class EditGalaxy extends Activity {
Button colonyButton, popButton, fleetButton, shipsButton;
EditText colonyEdit, popEdit, fleetEdit, shipsEdit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit);
instantiateUi();
getMainData();
colonyButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
MainActivity.milkyWay.galaxyColonies = Long.parseLong(colonyEdit.getText().toString());
MainActivity.colonyData.setText(String.valueOf(MainActivity.milkyWay.galaxyColonies));
}});
popButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
MainActivity.milkyWay.galaxyLifeforms = Double.parseDouble(popEdit.getText().toString());
MainActivity.popData.setText(String.valueOf(MainActivity.milkyWay.galaxyLifeforms));
}});
fleetButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
MainActivity.milkyWay.galaxyFleets = Integer.parseInt(fleetEdit.getText().toString());
MainActivity.fleetData.setText(String.valueOf(MainActivity.milkyWay.galaxyFleets));
}});
shipsButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
MainActivity.milkyWay.galaxyStarships = Integer.parseInt(shipsEdit.getText().toString());
MainActivity.shipsData.setText(String.valueOf(MainActivity.milkyWay.galaxyStarships));
}});
}
private void instantiateUi() {
colonyButton = (Button)findViewById(R.id.submit_colony);
popButton = (Button)findViewById(R.id.submit_pop);
fleetButton = (Button)findViewById(R.id.submit_fleet);
shipsButton = (Button)findViewById(R.id.submit_ships);
colonyEdit = (EditText)findViewById(R.id.edit_colony);
popEdit = (EditText)findViewById(R.id.edit_pop);
fleetEdit = (EditText)findViewById(R.id.edit_fleet);
shipsEdit = (EditText)findViewById(R.id.edit_ships);
}
private void getMainData() {
Intent intename = getIntent();
colonyEdit.setText((String) intename.getSerializableExtra("editIntent_galaxyColonies"));
popEdit.setText((String) intename.getSerializableExtra("editIntent_galaxyLifeforms"));
fleetEdit.setText((String) intename.getSerializableExtra("editIntent_galaxyFleets"));
shipsEdit.setText((String) intename.getSerializableExtra("editIntent_galaxyStarships"));
}
}

I'm new on this environment, not with Java. I don't know if this is the best way to make a data refresh of the main activity view.

On page 241:
This will not produce desired result:

android:layout_alignLeft="@+id/edit_colony"

but this will:

android:layout_alignLeftOf="@+id/edit_colony"

On page 329:

There is no ImageButton1source.png file in the book asset repository.

On page 349:

To implement the NinePatchDrawable, you will add an android:background="ninepatchasset""

should be :

To implement the NinePatchDrawable, you will add an android:background="@drawable/ninepatchasset"

On page 362:

Error in XML file activity_main.xml in sample code included with book, there is one " more than it should be at the end of this line:

android:orientation="horizontal" android:background="#00000000" android:id="@+id/llh" >"

On page 389:

In the book:
"3. Now you are ready to create the anim_lightship.xml file. The easiest way to
do this is to copy the <item> tags from the inside of the anim_andromeda.xml"

Should be:

"3. Now you are ready to create the anim_lightship.xml file. The easiest way to
do this is to copy the <item> tags from the inside of the anim_milkyway.xmll"

On page 416:

planetFlyOverUri = Uri.parse( "android.resource://" + getPackage() + "/" + R.raw.flyover );

should be

planetFlyOverUri = Uri.parse( "android.resource://" + getPackageName() + "/" + R.raw.flyover );

as there is no getPackage()
but there is getPackageName()