Android用のMonoでFileDialogアクティビティを作成しました。ただし、ListView simpleadapterを使用する場合、MonoObjectからJavaObjectへのキャストに問題があるように思われます。onCreateを終了すると、VMが次のスタックトレースでクラッシュします。
07-05 15:04:46.493 D/FileDialogActivity( 3430): Left OnCreate
07-05 15:04:46.503 D/AndroidRuntime( 3430): Shutting down VM
07-05 15:04:46.503 W/dalvikvm( 3430): threadid=1: thread exiting with uncaught exception (group=0xb4127180)
07-05 15:04:46.523 D/dalvikvm( 3430): GC_CONCURRENT freed 115K, 3% free 9634K/9863K, paused 0ms+2ms
07-05 15:04:46.523 E/AndroidRuntime( 3430): FATAL EXCEPTION: main
07-05 15:04:46.523 E/AndroidRuntime( 3430): java.lang.ClassCastException: mono.android.runtime.JavaObject cannot be cast to java.util.Map
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.SimpleAdapter.bindView(SimpleAdapter.java:147)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.SimpleAdapter.createViewFromResource(SimpleAdapter.java:126)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.SimpleAdapter.getView(SimpleAdapter.java:114)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.AbsListView.obtainView(AbsListView.java:2033)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.ListView.makeAndAddView(ListView.java:1772)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.ListView.fillDown(ListView.java:672)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.ListView.fillFromTop(ListView.java:732)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.ListView.layoutChildren(ListView.java:1625)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.AbsListView.onLayout(AbsListView.java:1863)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:925)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.View.layout(View.java:11278)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewGroup.layout(ViewGroup.java:4224)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1489)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.os.Handler.dispatchMessage(Handler.java:99)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.os.Looper.loop(Looper.java:137)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at android.app.ActivityThread.main(ActivityThread.java:4424)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at java.lang.reflect.Method.invokeNative(Native Method)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at java.lang.reflect.Method.invoke(Method.java:511)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-05 15:04:46.523 E/AndroidRuntime( 3430): at dalvik.system.NativeStart.main(Native Method)
いくつかのコード:
IList<IDictionary<string, object>> mData = new List<IDictionary<string, object>>();
AddFiles(files, mData); // Which just new Dictionary with filedata and icon from a list of files.
SimpleAdapter fileAdapter = new SimpleAdapter(this, mData,
Resource.Layout.FileDialogRow,
new string[] { FileKey, FileImage },
new int[] { Resource.Id.fdrowname, Resource.Id.fdrowimage }
);
ListAdapter = fileAdapter;
Log.Debug("Left OnCreate");
他の誰かがAndroid用MonoでSimpleAdapterを使用するときに問題がありますか?または、ここで何が起こるかについての手がかりはありますか?