我有两个ListView。我想添加一些第一个listview的子视图到secview ListView。我这样做,但是我收到了这些错误:
08-13 04:48:48.049: W/System.err(23469): java.lang.UnsupportedOperationException: addView(View) is not supported in AdapterView
08-13 04:48:48.049: W/System.err(23469): at android.widget.AdapterView.addView(AdapterView.java:445)
08-13 04:48:48.049: W/System.err(23469): at ir.aiga.apps.quran.SuraSurface$16.onClick(SuraSurface.java:575)
08-13 04:48:48.049: W/System.err(23469): at android.view.View.performClick(View.java:3534)
08-13 04:48:48.049: W/System.err(23469): at android.widget.CompoundButton.performClick(CompoundButton.java:104)
08-13 04:48:48.049: W/System.err(23469): at android.view.View$PerformClick.run(View.java:14263)
08-13 04:48:48.049: W/System.err(23469): at android.os.Handler.handleCallback(Handler.java:605)
08-13 04:48:48.049: W/System.err(23469): at android.os.Handler.dispatchMessage(Handler.java:92)
08-13 04:48:48.049: W/System.err(23469): at android.os.Looper.loop(Looper.java:137)
08-13 04:48:48.049: W/System.err(23469): at android.app.ActivityThread.main(ActivityThread.java:4441)
08-13 04:48:48.049: W/System.err(23469): at java.lang.reflect.Method.invokeNative(Native Method)
08-13 04:48:48.049: W/System.err(23469): at java.lang.reflect.Method.invoke(Method.java:511)
08-13 04:48:48.049: W/System.err(23469): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-13 04:48:48.049: W/System.err(23469): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-13 04:48:48.049: W/System.err(23469): at dalvik.system.NativeStart.main(Native Method)
这是代码:
lv2=(ListView) dialog_searchResult.findViewById(R.id.lv_searchresault);
for(int i=0;i<arabicarray.length;i++){
if(ni[i].getnonarabic().contains(et_search.getText().toString())){
Log.i("found "+i,"word");
lv2.addView(lv1.getChildAt(i));
}
}