If I place just the intent as I have in the onCreate method it works
fine. It goes and get the activity I'm calling.
On Aug 23, 2010, at 12:43 PM, Filip Havlicek wrote:
OK, did a quick look at it and seems fine. Another suggestion - try
to build the Intent the way you are right now, but comment
everything in your main activity's onCreate method and put just the
Intent build & code you have. Does it still call wrong activity?
Best regards,
Filip Havlicek
2010/8/23 Pedro Teixeira <[email protected]>
I'm sorry, I wasn't explicit, that's true. The intent is inside a
dialog box which has just a simple feedback message for the user.
And it's supposed to change activity when pressed ok, here is all
the code to be more specific:
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
if (selectedDeviceImage!=null){
doFileUpload();
// Go to camera mode
builder = new AlertDialog.Builder(addPic.this);
builder.setCancelable(false)
.setPositiveButton("Ok", new DialogInterface.OnClickListener
() {
public void onClick(DialogInterface dialog, int id) {
Intent addIntent = new Intent(v.getContext(),
thenNnowMode.class);
Bundle w = new Bundle();
String activityName = "addPic";
w.putString("activity", activityName);
w.putParcelable("bitmap", selectedDeviceImage);
addIntent.putExtras(w);
startActivity(addIntent);
finish();
}
});
AlertDialog alert = builder.create();
alert.setTitle("Picture added!");
alert.setIcon(R.drawable.icon_yep);
alert.show();
}else{
builder = new AlertDialog.Builder(addPic.this);
builder.setCancelable(false)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.setTitle("Please, pick a picture!");
alert.setIcon(R.drawable.icon_not);
alert.show();
}}
});
On Aug 23, 2010, at 11:57 AM, Filip Havlicek wrote:
Hi Pedro,
although I don't know what v in v.getContext() is, I would suggest
that instead of doing the class setting in constructor, try using
new Intent() and then set the class with Intent.setComponent
(ComponentName)
http://developer.android.com/reference/android/content/Intent.html#setComponent(android.content.ComponentName)
and see if it makes any difference.
Best regards,
Filip Havlicek
2010/8/23 Pedro Teixeira <[email protected]>
And here is my intent on the debugger showing the correct info:
Intent { cmp=com.pedroteixeira.thennnow/.thenNnowMode (has extras) }
On Aug 23, 2010, at 7:40 AM, pablisco wrote:
Hi,
Can we assume that thenNnowMode is an extension of Activity? Also, I
can see you pit the string "addPic" into the bundle. I hope you are
not trying to start the activity in this manner. To open an
activity,
say called AddPic (which must be an activity class) and simply call:
startActivity(new Intent(getContext(), AddPic.class));
Also some code from the mentioned classes may help solve your
problem.
On Aug 22, 11:39 pm, Pedro Teixeira <[email protected]>
wrote:
Hello,
I'm having a struggle understanding why my intent is not
working.. I
basically just copied paste from other examples in my code that
work
perfectly like this.. here it is:
Intent addIntent = new Intent(v.getContext(), thenNnowMode.class);
Bundle w = new Bundle();
String activityName = "addPic";
w.putString("activity", activityName);
w.putParcelable("bitmap", selectedDeviceImage);
//
a.putString("id", picId);
addIntent.putExtras(w);
startActivity(addIntent);
finish();
The intent is opening a different class called thenNnow.class
instead
of thenNnowMode.class.. and I have no idea why this is
happening.. any
suggestion? I've tried sending the intent to open other activities
other than thenNnowMode but it always opens thenNnow.. am I
missing
some silly syntax mistake? It's so strange.. its the same code
PS: Im not sure if it's relevant but the thenNnowMode class uses
the
device camera
--
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
Pedro Teixeira
www.pedroteixeira.org
--
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
--
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
Pedro Teixeira
www.pedroteixeira.org
--
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
--
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
Pedro Teixeira
www.pedroteixeira.org
--
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