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 June 12th, 2010, 04:01 AM
Registered User
 
Join Date: Sep 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default List2-2 at p.28

List2-2 shows the UI layout's TextView as follows;

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, HelloWorld"
/>

But the code generated by Eclipse & ADT-plugin is as follows;

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>


I like the 1st style rather than the 2nd style, because
android:text="Hello World, HelloWorld"
is more intuitive than
android:text="@string/hello"
.

How can I generate the 1st style ?

Or, what is the meaning of "@style/hello" ?
 
Old June 12th, 2010, 11:10 AM
Registered User
 
Join Date: Jun 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

@style/hello means instead of specifying the string right in the file, it is saying to "Look for the string with the attribute of 'hello' in the res/values/strings.xml file".

This is called "externalizing resources" so that in the future, you may edit the externalized resource file without changing code.

Last edited by sidneyyin; June 12th, 2010 at 11:23 AM.. Reason: punctuation
 
Old June 12th, 2010, 10:50 PM
Registered User
 
Join Date: Sep 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Smile to sidneyyin

You let me know the word "Externalizing Resources", I very appreciate your response.
I am a complete newbie to mobile phone technologies including MIDlets, so I have no opportunity for knowing it.
Thanks a lot!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 2 pp. 28 mdfinch BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 7 August 24th, 2009 04:34 PM
Urgent - 28# Out of Stack Space narooma.12 Crystal Reports 1 August 27th, 2008 11:16 AM
Chapter 28 code missing rCobbley BOOK: Excel 2003 VBA Programmer's Reference 0 November 1st, 2006 05:42 PM
Hibernate3 LazyInitialization with Ch. 28 grossmaa BOOK: Beginning JavaServer Pages 0 May 25th, 2006 09:46 AM
Ch 28 exercise using Eclipse keeotee BOOK: Beginning JavaServer Pages 1 April 2nd, 2006 12:09 PM





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