• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception rasied during rendering addView(View,LayoutParams) is not supported in AdapterView

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am trying to use a GirdView inside a Scroll View but It is showing error that

Exception rasied during rendering addView(View,LayoutParams) is not supported in AdapterView



This is my layout code

<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<GridView
android:id="@+id/gridView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="2" >

<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />

</GridView>

</ScrollView>


and I am getting this logcat

11-15 02:22:40.190: E/AndroidRuntime(2564): FATAL EXCEPTION: main
11-15 02:22:40.190: E/AndroidRuntime(2564): Process: com.example.scrollview_gridviewdemo, PID: 2564
11-15 02:22:40.190: E/AndroidRuntime(2564): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.scrollview_gridviewdemo/com.example.scrollview_gridviewdemo.MainActivity}: java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.app.ActivityThread.access$800(ActivityThread.java:135)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.os.Handler.dispatchMessage(Handler.java:102)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.os.Looper.loop(Looper.java:136)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.app.ActivityThread.main(ActivityThread.java:5017)
11-15 02:22:40.190: E/AndroidRuntime(2564): at java.lang.reflect.Method.invokeNative(Native Method)
11-15 02:22:40.190: E/AndroidRuntime(2564): at java.lang.reflect.Method.invoke(Method.java:515)
11-15 02:22:40.190: E/AndroidRuntime(2564): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-15 02:22:40.190: E/AndroidRuntime(2564): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-15 02:22:40.190: E/AndroidRuntime(2564): at dalvik.system.NativeStart.main(Native Method)
11-15 02:22:40.190: E/AndroidRuntime(2564): Caused by: java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.widget.AdapterView.addView(AdapterView.java:478)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.view.LayoutInflater.rInflate(LayoutInflater.java:759)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
11-15 02:22:40.190: E/AndroidRuntime(2564): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.app.Activity.setContentView(Activity.java:1929)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:110)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
11-15 02:22:40.190: E/AndroidRuntime(2564): at com.example.scrollview_gridviewdemo.MainActivity.onCreate(MainActivity.java:13)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.app.Activity.performCreate(Activity.java:5231)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-15 02:22:40.190: E/AndroidRuntime(2564): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
11-15 02:22:40.190: E/AndroidRuntime(2564): ... 11 more
11-15 02:27:40.845: I/Process(2564): Sending signal. PID: 2564 SIG: 9
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic