Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2
This is the forum to discuss the Wrox book Professional Android Application Development by Reto Meier; ISBN: 9780470344712
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 30th, 2008, 01:29 AM
Registered User
 
Join Date: Nov 2008
Location: San Francisco, CA, .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default I am finding the book a bit over my head

I have an issue with the basic structure that I can't seem to get past. I am using Eclipse and trying to run through the examples in chapter 4. Here is my issue:

I have a project i setup in Eclipse. Under it have have the usual default setup. I compile and run the default code just fine. When I try to edit the TodoListItemView source file I get an error in the AndroidManifest.xml file in the project root. Here is that file and the <X> in the code below is the issue. The error message is "TDLIV.com.TodoListItemView does not extend android.app.Activity"

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="(deleted the http)schemas.android.com/apk/res/android"
      package="TDLIV.com"
      android:versionCode="1"
      android:versionName="1.0.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".TodoListItemView"
<X> android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

So far, I am trying to do step #1 on page 83. That code is as follows and shows no errors.
--------------------------
package TDLIV.com;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.TextView;
import android.app.Activity;
import android.os.Bundle;

public class TodoListItemView extends TextView {

      /** Constructors. Each should call init() */
      public TodoListItemView (Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
      }

      public TodoListItemView (Context context) {
        super(context);
        init();
      }

      public TodoListItemView (Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
      }

      private void init() {
      }

}
_______________________

I am obviously a novice and would really appreciate anyones comments greatly. I used to do some java coding for fun but was not using Eclipse.

Thanks in advance for any help.

Fred
Reply With Quote
  #2 (permalink)  
Old November 30th, 2008, 01:07 PM
Reto's Avatar
Wrox Author
Points: 287, Level: 5
Points: 287, Level: 5 Points: 287, Level: 5 Points: 287, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2008
Location: London, United Kingdom
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts
Default

  It looks like the error your seeing in the Chapter 4 example is because the class you've created in step 1 (TodoListItemView) is not an Activity, so you can't put it directly into the Manifest as you've done. It needs to be referenced by a Layout that's in turn used by an ArrayAdapter within an Activity -- that's what's shown in steps 5 and 6.

  What might have caused the confusion is that the example you're looking at in Chapter 4 builds on an earlier example -- the To-do List example in Chapter 2 (page 37). To do the steps in the Chapter 4 example you need to have created that earlier TodoList Activity. The example in Chapter 4 lets you change the appearance of each of the to-do list Items shown in the ListView.

  From the looks of things, I'd say you can probably skip straight to step 5 on page 39 of the Chapter 2 example. Steps 5 through 8 show how to create the Activity layout and the Activity class that you need for Chapter 4. Alternatively, if you want to skip Chapter 2 entirely, you can download the source code for it from here:

http://www.wrox.com/WileyCDA/WroxTit...-DOWNLOAD.html

...and jump straight into the Chapter 4 example.

Let me know how you get on, hopefully I'll be able to help.

Cheers
Reto

--
Author, Professional Android Application Development
Reply With Quote
  #3 (permalink)  
Old November 30th, 2008, 02:40 PM
Registered User
 
Join Date: Nov 2008
Location: San Francisco, CA, .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the help. Of course, I see that now. I'll move on and give it another try.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
finding free book "Beginning Jsp Book" ruzdi JSP Basics 0 December 7th, 2007 01:46 PM
64 Bit - Issue in 64 bit IIS calling Win32 API Hubman General .NET 1 August 24th, 2006 09:19 AM
Finding the DB Sailor.mdb of Beginning ASP DB book anna Classic ASP Databases 2 August 5th, 2006 01:13 PM
I am so in over my head AnnMarie Dreamweaver (all versions) 1 May 19th, 2005 02:19 PM
Can't get my head around - help. Mantis MySQL 2 February 23rd, 2005 12:19 PM



All times are GMT -4. The time now is 11:44 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.