[Mono-bugs] [Bug 639679] StartActivity() requiring intent to have FLAG_ACTIVITY_NEW_TASK and not assuming the caller's task affinity
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Sep 21 10:42:34 EDT 2010
https://bugzilla.novell.com/show_bug.cgi?id=639679
https://bugzilla.novell.com/show_bug.cgi?id=639679#c1
Jonathan Pryor <jpryor at novell.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jpryor at novell.com
--- Comment #1 from Jonathan Pryor <jpryor at novell.com> 2010-09-21 14:42:33 UTC ---
And for the "what would Java do" side of things, here's the equivalent Java:
package com.jprl.mines;
import android.app.*;
import android.content.*;
import android.os.*;
import android.view.View;
import android.widget.*;
public class MinesActivity extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String[] items = new String[]{
"Item One",
"Second Item",
};
ArrayAdapter<String> adapter = new ArrayAdapter<String> (
this,
android.R.layout.simple_list_item_1,
items);
setListAdapter(adapter);
getListView().setOnItemClickListener(new
AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int
position, long id) {
Intent intent = new Intent ();
intent.setClassName(getBaseContext(),
"monoDroidTesting.SubActivity");
startActivity (intent);
}
});
}
}
The result:
E/AndroidRuntime( 432): android.content.ActivityNotFoundException: Unable to
find explicit activity class {com.jprl.mines/monoDroidTesting.SubActivity};
have you declared this activity in your AndroidManifest.xml?
E/AndroidRuntime( 432): at
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
E/AndroidRuntime( 432): at
android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
E/AndroidRuntime( 432): at
android.app.Activity.startActivityForResult(Activity.java:2749)
E/AndroidRuntime( 432): at
android.app.Activity.startActivity(Activity.java:2855)
E/AndroidRuntime( 432): at
com.jprl.mines.MinesActivity$1.onItemClick(MinesActivity.java:31)
E/AndroidRuntime( 432): at
android.widget.AdapterView.performItemClick(AdapterView.java:284)
E/AndroidRuntime( 432): at
android.widget.ListView.performItemClick(ListView.java:3285)
E/AndroidRuntime( 432): at
android.widget.AbsListView$PerformClick.run(AbsListView.java:1640)
E/AndroidRuntime( 432): at
android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 432): at
android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 432): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 432): at
android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 432): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime( 432): at
java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 432): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 432): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 432): at dalvik.system.NativeStart.main(Native Method)
i.e. Java also fails, but for a DIFFERENT reason: the class
"monoDroidTesting.SubActivity" doesn't exist. (Which makes sense, we can't
very well ask Android to launch a type that doesn't exist...)
Note that we do NOT get an error about FLAG_ACTIVITY_NEW_TASK.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list