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

You are currently viewing the BOOK: Beginning Android 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 January 17th, 2012, 06:46 PM
Registered User
 
Join Date: Jan 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default help linking activities to events pg43

i did everything and a little more according to the book but when the activities app launches and i click the center pad button it doesnt show my activities2 i get kicked out and goes into the debugging console not sure why it does that instead of switching to activities 2 like on page 46 figure 2-13 i would greatly appreciate for someone can take the time and help me out with this? http://dl.dropbox.com/u/29274016/share/%20activity2.png here is a link of the screenshot of what i'm trying to describe help it helps looks like you got to copy and paste the link to your browser thanks in advance!
Larry
 
Old January 17th, 2012, 07:39 PM
Authorized User
 
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
Default

Hi Larry
It is hard to tell what is going on. It appears that when Activity2 is launched there is an error. Check the manifest file and be sure that it is correct. If you can't figure it out, post your code so we can check it.
Cliff
__________________
"Software to the Stars"
Failure is not an option. It comes bundled with your Microsoft products.
 
Old January 18th, 2012, 03:59 PM
Registered User
 
Join Date: Jan 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

still cant find anything that wouldn't let activity to switch to activity 2

Code:
package larryv1979.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
 

public class MainActivity extends Activity {
	String tag = "Events";
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.main);
        Log.d(tag, "In the onCreate() event");
    }
    
    public boolean onKeyDown(int keyCode, KeyEvent event)
    {
    	if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER)
    	{
    		startActivity(new Intent("larryv1979.activity2"));
    		
    	}
		return false;
    }
    {
    	
    }
    public void onStart()
    {
    	super.onStart();
    	Log.d(tag, "In the onStart() event");
    }
    public void onRestart()
    {
    	super.onRestart();
    	Log.d(tag, "In the onRestart() event");
    }
    public void onResume()
    {
    	super.onResume();
    	Log.d(tag, "In the onResume() event");
    }
    public void onPause()
    {
    	super.onPause();
    	Log.d(tag, "in the onPause() event");
    }
    public void onStop()
    {
    	super.onStop();
    	Log.d(tag, "In the onStop() event");
    }
    public void onDestroy()
    {
    	super.onDestroy();
    	Log.d(tag, "In the onDestroy() event");
    	
    	
    	
    	
    }
}
 
Old January 18th, 2012, 07:56 PM
Authorized User
 
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
Default

Hi Larry
I don't see anything wrong in the code. The error says 'activity not found'.
I had the same problem. Mine was in the Manifest file. Look closely at the names of activity2, larryv1979.activity2, and what is in the Manifest file. It seems the Manifest name should be all uppercase. What I have in mine is:

MainActivity: startActivity(new Intent("net.learn2devlop.ACTIVITY2"));
Activity2: Activity2
Manifest: // new activity 2
<activity
android:label="Activity 2"
android:name ="Activity2"
>
<intent-filter >
<action android:name="net.learn2devlop.ACTIVITY2" />
<category android:name="android.intent.category.DEFAULT" />

Note the uppercase!
Hope this helps
Cliff
__________________
"Software to the Stars"
Failure is not an option. It comes bundled with your Microsoft products.
 
Old January 18th, 2012, 10:49 PM
Registered User
 
Join Date: Jan 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thank you got it working!

Cliff,

Thank you for your time to help me out your suggestion work!

Very much appreciated!
Larry





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 2 Linking Activities with Intents Gink BOOK: Beginning Android Application Development 2 January 11th, 2012 08:21 PM
Ch2 - Linking Activities Using Intents droid404 BOOK: Beginning Android Application Development 2 December 27th, 2011 01:30 PM
Activities Example Attempting to Connect Debugger rman BOOK: Beginning Android Application Development 0 August 22nd, 2011 09:34 AM
Chapter 2- Activities nghelam2008 BOOK: Beginning Android Application Development 0 May 26th, 2011 05:58 AM
Linking sherr8 Access 2 July 30th, 2003 02:29 PM





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