Wrox Programmer Forums
|
BOOK: Beginning Android 4 Application Development
This is the forum to discuss the Wrox book Beginning Android 4 Application Development by Wei-Meng Lee; ISBN: 978-1-1181-9954-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Android 4 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 July 17th, 2013, 05:17 AM
Authorized User
 
Join Date: Dec 2011
Posts: 43
Thanks: 11
Thanked 0 Times in 0 Posts
Question Chapter 2, pg 82. "R.layout.main" Error

Hi, I am currently on page 82 in chapter 2, the "Communication between fragments" exercise:

In the Main Activity, the book instructs you to enter the following code:
Code:
public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
I have a problem with the last line, it says that "main cannot be resolved or is not a field" and I don't understand the error,

Update
Fixed the problem, basically I didn't think, I changed the setContentView so that it actually referenced my activity as it had the wrong name

Thanks very much,

Nick

Last edited by Nick Makin; July 17th, 2013 at 06:22 AM..
 
Old July 17th, 2013, 08:45 PM
Registered User
 
Join Date: Jul 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

check that the activity name is actually main, in the new java the default name is something like MainActivity or something like that





Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception in thread "main" javax.crypto.BadPadd?ingException: pad block corrupted boy18nj BOOK: Beginning Cryptography with Java 9 June 6th, 2011 12:50 AM
Chapter 15. "Sign Up for new account" gets error: 26 - Error Locating Server/Instance Tanya Roslyakova BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 March 8th, 2011 10:34 AM
Chapter 6 - pg.228 ThemeList "not declared" lsochia BOOK: Beginning ASP.NET 4 : in C# and VB 3 February 8th, 2011 03:50 AM
MSXSL gives error message for "for" inside "select" ilyaz XSLT 1 December 9th, 2010 05:02 PM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM





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