java - I have an "inflate exception" error in Android Studio -


i've modified xml code still error:

    <?xml version="1.0" encoding="utf-8"?> <listview xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/list"     android:orientation="vertical"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:paddingbottom="@dimen/activity_vertical_margin"     android:paddingleft="@dimen/activity_horizontal_margin"     android:paddingright="@dimen/activity_horizontal_margin"     android:paddingtop="@dimen/activity_vertical_margin"     tools:context="com.example.android.miwok.numbersactivity"/> 

and java code..

import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.util.log; import android.widget.arrayadapter; import android.widget.gridview; import android.widget.linearlayout; import android.widget.listview; import android.widget.textview;  import java.util.arraylist;  public class numbersactivity extends appcompatactivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_numbers);           arraylist<string> words = new arraylist<string>();          words.add(0, "one");         words.add(1, "two");         words.add(2, "three");         words.add(3, "four");         words.add(4, "five");         words.add(5, "six");         words.add(6, "seven");         words.add(7, "eight");         words.add(8, "nine");         words.add(9, "ten");              arrayadapter<string> itemsadapter =                 new arrayadapter<string>(this, android.r.layout.simple_list_item_1, words);            listview listview = (listview) findviewbyid(r.id.list);              listview.setadapter(itemsadapter);       } } 

android.view.inflateexception: binary xml file line #2: error inflating class gridviewview

i've change listview, still exist.

please give solution, i'm in udacity android course.

i recreate project same code, , thing changed paddings of xml file.
have look:

java:

import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.widget.arrayadapter; import android.widget.listview;  import java.util.arraylist;  public class numbersactivity extends appcompatactivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_numbers);          arraylist<string> words = new arraylist<string>();          words.add(0, "one");         words.add(1, "two");         words.add(2, "three");         words.add(3, "four");         words.add(4, "five");         words.add(5, "six");         words.add(6, "seven");         words.add(7, "eight");         words.add(8, "nine");         words.add(9, "ten");          arrayadapter<string> itemsadapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, words);          listview listview = (listview) findviewbyid(r.id.list);          listview.setadapter(itemsadapter);     } } 

xml (with modification):

<?xml version="1.0" encoding="utf-8"?> <listview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/list" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="16dp" android:paddingleft="16dp" android:paddingright="16dp" android:paddingtop="16dp" tools:context="com.example.android.miwok.numbersactivity"/> 

i had result on simulator:

image_simulator


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -