Did you register the activity in the manifest?
J

On Apr 2, 2010 1:29 PM, "Darshan Hegde" <[email protected]> wrote:

Hello,

I am a new bee to Android. I have Eclipse + ADT development
environment. I am trying to start a new activity by clicking on a
button on the existing activity. But package is not being resolved
some how,

here is my code...

package com.darshan.demos;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class intentsTest extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);

       Button button = (Button) findViewById(R.id.button);
       button.setOnClickListener(myNewActivity);
   }

   private OnClickListener myNewActivity = new OnClickListener() {
       public void onClick(View v) {
           Intent intent = new Intent();
           ComponentName comp = new
ComponentName(com.darshan.demos,com.darshan.demos.IntentsNew);
           intent.setComponent(comp);
           startActivity(intent);

       }
   };
}

IntentsNew is the new activity that I want to start.

The error is...

Description
Resource                                 Path   Location        Type
com.darshan.demos cannot be resolved to a type  intentsTest.java
iIntents/src/com/darshan/demos  line 25 Java Problem
com.darshan.demos.IntentsNew cannot be resolved
intentsTest.java        iIntents/src/com/darshan/demos  line 25 Java Problem

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]<android-developers%[email protected]>
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to