[Mono-bugs] [Bug 640839] New: PreferencesActivity crash

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Sep 21 10:53:35 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=640839

https://bugzilla.novell.com/show_bug.cgi?id=640839#c0


           Summary: PreferencesActivity crash
    Classification: Mono
           Product: MonoDroid
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Runtime
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: marschills at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: No


Description of Problem:
Using PreferencesActivity.AddPreferencesFromResource appears to crash the
application.


Steps to reproduce the problem:
1. The following Java source works correctly

public class MainActivity extends Activity
{
    ....

    @Override
    public boolean onOptionsItemSelected(MenuItem item)
    {
        startActivity(new Intent(this,EditPreferences.class));

        return super.onOptionsItemSelected(item);
    }
}

public class EditPreferences extends PreferenceActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        addPreferencesFromResource(R.xml.preferences);
    }
}

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:key="first_preferencescreen">
    <CheckBoxPreference
                android:key="wifi enabled"
                android:title="WiFi" />
</PreferenceScreen>

2. The Monodroid equivalent crashes on the AddPreferencesFromResource() call
(with the same XML):

// Launching activity with a menu
Intent i = new Intent();
i.SetClassName(this, "myapp.EditPreferences");
i.AddFlags(ActivityFlags.NewTask);
StartActivity(i);

[Activity(Name="myapp.EditPreferences",Label = "Preferences")]
public class EditPreferences : PreferenceActivity
{
    public EditPreferences(IntPtr handle): base(handle)
    {
    }

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        AddPreferencesFromResource(Resource.xml.preferences);
    }
}



Actual Results:
Android.Runtime.JNIEnv.CanNonVirtualVoidMethod exception

Expected Results:
Inflated XML and preferences activity

How often does this happen? 
Always.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list