Wrox Programmer Forums
|
BOOK: Professional Android 2 Application Development
This is the forum to discuss the Wrox book Professional Android 2 Application Development, 2nd Edition by Reto Meier; ISBN: 978-0-470-56552-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android 2 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2010, 10:08 AM
Registered User
 
Join Date: Apr 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 4 ToDo List - modifying existing views

For my studies I have to develop an Android Application based on version 1.6 and I want to modify some existing views like shown in chapter 2. So, one question:

Where are the differences between version 1.6 and 2.1 concerning the modification of existing views? I have tested the book example "ToDo-List" with version 1.6 and nothing worked. Where exactly in the example are elements of version 2.1? Or which of them can be reused for version 1.6?

Thanks for response.
 
Old April 29th, 2010, 10:41 AM
Reto's Avatar
Wrox Author
 
Join Date: Oct 2008
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts
Default

Could you describe the problems you had with the TodoList example?

The changes from 1.6 to 2.1 shouldn't affect the code samples is Chapter 2, so maybe something else is causing your issues.
__________________
Reto Meier

Author, "Professional Android 4 Application Development", Wrox, ©2012, 2010, 2008
@retomeier
 
Old April 29th, 2010, 11:34 AM
Registered User
 
Join Date: Apr 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 4

Sorry, it was not Chapter 2 (like I wrote in the text). It was rather in Chapter 4 (like I wrote in the headline) where you have shown how to modify existing views. The same code works for me with Android 2.1, but not with 1.6.

I think it has something to do with the XML-Layout files. Because when I debugged the code there was nothing wrong in JAVA Code. The error arrives after calling the method "notifyDataSetChanged" (aa is the name of the ArrayAdapter):

Code:
 myEditText.setOnKeyListener(new OnKeyListener() {
   	  public boolean onKey(View v, int keyCode, KeyEvent event) {
   	    if (event.getAction() == KeyEvent.ACTION_DOWN)
          if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER)
   	      {    	 
            // Add a new todo item and clear the input box.
            todoItems.add(0, myEditText.getText().toString());
   	        myEditText.setText("");
   	        aa.notifyDataSetChanged();
	          return true;   	        
   	      }
   	    return false;
   	  }
    });
The debugger identifies an error of the PhoneLayoutInflater when the method "ArrayAdapter.createViewFromResource(...)" is called.

I hope I could describe my question/problem in a more understandable way. Thanks for help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
ToDo List Problems - Chapter 4 wolverineik BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 0 February 28th, 2010 09:29 AM
Chapter 6 Todo List removeItem abowman BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 4 February 5th, 2010 11:18 AM
Issues with Chapter 2 Todo List .add() on key listener Swak BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 2 January 22nd, 2010 06:43 AM
Chapter 4 Customising Your Todo List MMC2 BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 0 May 12th, 2009 08:34 AM
Chapter 7 - List Views Not Refreshing VBNovice BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 3 January 31st, 2007 08:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.