Finding an Android XML tag -


i attempting fix error "your content must have listview id attribute 'android.r.list'.

i have found answer following question on stack exchange:

your content must have listview id attribute 'android.r.id.list'

i had applied solution, wished ask question:

"then how reference android-defined xml tag?

however due reputation system, unable comment small question. apologise this, can please answer question?

thank in advance.

for information, listview:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical" android:layout_width="match_parent"     android:layout_height="match_parent">     <listview         android:id="@android:id/list"         android:layout_width="match_parent"         android:layout_height="wrap_content">     </listview> </linearlayout> 

and trying pass:

   lv = (listview) convertview.findviewbyid(r.id.exceedinglist); 

and error i'm getting:

 java.lang.runtimeexception: unable start activity componentinfo{com.example.denny.phonebelt/com.example.denny.phonebelt.settingsmenu}: java.lang.runtimeexception: content must have listview id attribute 'android.r.id.list' 

just in case problem caused bug reason, i'll cp actual code here:

    final button exceedinglimitbutton = (button)findviewbyid(r.id.exceedinglimitbutton);     exceedinglimitbutton.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             final alertdialog.builder exceedinglimitdialog = new alertdialog.builder(settingsmenu.this);             //setting listview             layoutinflater inflater = getlayoutinflater();             view convertview = inflater.inflate(r.layout.exceeding_dialog, null);             lv = (listview) convertview.findviewbyid(android.r.id.list);             arrayadapter<string> adapter = new arrayadapter<>(settingsmenu.this, android.r.layout.simple_list_item_single_choice, exceedingselection);             lv.setadapter(adapter);             lv.setonitemselectedlistener(new adapterview.onitemselectedlistener() {                 @override                 public void onitemselected(adapterview<?> parent, view view, int position, long id) {                     int selecteditem = integer.parseint(exceedingselection[position]);                     phonebelt.setexceedint(selecteditem);                     string selection = getstring(r.string.selection);                     string message = (selection + selecteditem);                     toast toast = toast.maketext(settingsmenu.this, message, toast.length_long);                     toast.show();                 }                  @override                 public void onnothingselected(adapterview<?> parent) {                     toast toast = toast.maketext(settingsmenu.this, "you have not selected anything", toast.length_short);                     toast.show();                 }             });             exceedinglimitdialog.setview(convertview);             exceedinglimitdialog.settitle(r.string.exceeding_limit_title);             exceedinglimitdialog.setmessage(r.string.exceeding_limit_message);             exceedinglimitdialog.setcancelable(true);             alertdialog alert = exceedinglimitdialog.create();             alert.show();         }     }); 

instead of:

android:id="@android:id/list" 

write:

 android:id="@+id/list" 

you have declare new id , mark list it.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -