Did you register the activity in the manifest?
J
On Apr 2, 2010 1:29 PM, Darshan Hegde darshanr...@gmail.com 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 LocationType
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.javaiIntents/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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
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.