Thursday, 15 July 2010

android - App doesnt't work with older versions -



android - App doesnt't work with older versions -

i developed app works perfect android 4.4, doesn't works 2.3.3. sorry english, , guess can help me, give thanks much.

log:

11-05 16:53:13.874 513-513/guaguas.costular.com.guaguas e/androidruntime﹕ fatal exception: main android.view.inflateexception: binary xml file line #3: error inflating class android.widget.textview @ android.view.layoutinflater.createview(layoutinflater.java:518) @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:568) @ android.view.layoutinflater.inflate(layoutinflater.java:386) @ android.view.layoutinflater.inflate(layoutinflater.java:320) @ android.widget.arrayadapter.createviewfromresource(arrayadapter.java:332) @ android.widget.arrayadapter.getview(arrayadapter.java:323) @ android.widget.abslistview.obtainview(abslistview.java:1430) @ android.widget.listview.measureheightofchildren(listview.java:1216) @ android.widget.listview.onmeasure(listview.java:1127) @ android.view.view.measure(view.java:8313) @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138) @ android.widget.linearlayout.measurechildbeforelayout(linearlayout.java:1017) @ android.widget.linearlayout.measurevertical(linearlayout.java:386) @ android.widget.linearlayout.onmeasure(linearlayout.java:309) @ android.view.view.measure(view.java:8313) @ android.support.v4.widget.drawerlayout.onmeasure(drawerlayout.java:863) @ android.view.view.measure(view.java:8313) @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138) @ android.widget.framelayout.onmeasure(framelayout.java:250) @ android.view.view.measure(view.java:8313) @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138) @ android.support.v7.internal.widget.actionbaroverlaylayout.onmeasure(actionbaroverlaylayout.java:453) @ android.view.view.measure(view.java:8313) @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138) @ android.widget.framelayout.onmeasure(framelayout.java:250) @ android.view.view.measure(view.java:8313) @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138) @ android.widget.framelayout.onmeasure(framelayout.java:250) @ android.view.view.measure(view.java:8313) @ android.view.viewroot.performtraversals(viewroot.java:839) @ android.view.viewroot.handlemessage(viewroot.java:1859) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:123) @ android.app.activitythread.main(activitythread.java:3683) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:507) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:597) @ dalvik.system.nativestart.main(native method) caused by: java.lang.reflect.invocationtargetexception @ java.lang.reflect.constructor.constructnative(native method) @ java.lang.reflect.constructor.newinstance(constructor.java:415) @ android.view.layoutinflater.createview(layoutinflater.java:505)             at com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56)             at android.view.layoutinflater.createviewfromtag(layoutinflater.java:568)             at android.view.layoutinflater.inflate(layoutinflater.java:386)             at android.view.layoutinflater.inflate(layoutinflater.java:320)             at android.widget.arrayadapter.createviewfromresource(arrayadapter.java:332)             at android.widget.arrayadapter.getview(arrayadapter.java:323)             at android.widget.abslistview.obtainview(abslistview.java:1430)             at android.widget.listview.measureheightofchildren(listview.java:1216)             at android.widget.listview.onmeasure(listview.java:1127)             at android.view.view.measure(view.java:8313)             at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138)             at android.widget.linearlayout.measurechildbeforelayout(linearlayout.java:1017)             at android.widget.linearlayout.measurevertical(linearlayout.java:386)             at android.widget.linearlayout.onmeasure(linearlayout.java:309)             at android.view.view.measure(view.java:8313)             at android.support.v4.widget.drawerlayout.onmeasure(drawerlayout.java:863)             at android.view.view.measure(view.java:8313)             at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138)             at android.widget.framelayout.onmeasure(framelayout.java:250)             at android.view.view.measure(view.java:8313)             at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138)             at android.support.v7.internal.widget.actionbaroverlaylayout.onmeasure(actionbaroverlaylayout.java:453)             at android.view.view.measure(view.java:8313)             at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138)             at android.widget.framelayout.onmeasure(framelayout.java:250)             at android.view.view.measure(view.java:8313)             at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138)             at android.widget.framelayout.onmeasure(framelayout.java:250)             at android.view.view.measure(view.java:8313)             at android.view.viewroot.performtraversals(viewroot.java:839)             at android.view.viewroot.handlemessage(viewroot.java:1859)             at android.os.handler.dispatchmessage(handler.java:99)             at android.os.looper.loop(looper.java:123)             at android.app.activitythread.main(activitythread.java:3683)             at java.lang.reflect.method.invokenative(native method)             at java.lang.reflect.method.invoke(method.java:507)             at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839)             at com.android.internal.os.zygoteinit.main(zygoteinit.java:597)             at dalvik.system.nativestart.main(native method) caused by: java.lang.unsupportedoperationexception: can't convert dimension: type=0x2 @ android.content.res.typedarray.getdimensionpixelsize(typedarray.java:463) @ android.view.view.<init>(view.java:1963) @ android.widget.textview.<init>(textview.java:344) @ android.widget.textview.<init>(textview.java:337)             at java.lang.reflect.constructor.constructnative(native method)             at java.lang.reflect.constructor.newinstance(constructor.java:415)             at android.view.layoutinflater.createview(layoutinflater.java:505)             at com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56)             at android.view.layoutinflater.createviewfromtag(layoutinflater.java:568)             at android.view.layoutinflater.inflate(layoutinflater.java:386)             at android.view.layoutinflater.inflate(layoutinflater.java:320)             at android.widget.arrayadapter.createviewfromresource(arrayadapter.java:332)             at android.widget.arrayadapter.getview(arrayadapter.java:323)             at android.widget.abslistview.obtainview(abslistview.java:1430)             at android.widget.listview.measureheightofchildren(listview.java:1216)             at android.widget.listview.onmeasure(listview.java:1127)             at android.view.view.measure(view.java:8313)             at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138)             at android.widget.linearlayout.measurechildbeforelayout(linearlayout.java:1017)             at android.widget.linearlayout.measurevertical(linearlayout.java:386)             at android.widget.linearlayout.onmeasure(linearlayout.java:309)             at android.view.view.measure(view.java:8313)             at android.support.v4.widget.drawerlayout.onmeasure(drawerlayout.java:863)             at android.view.view.measure(view.java:8313)             at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138)             at android.widget.framelayout.onmeasure(framelayout.java:250)             at android.view.view.measure(view.java:8313)             at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138)             at android.support.v7.internal.widget.actionbaroverlaylayout.onmeasure(actionbaroverlaylayout.java:453)             at android.view.view.measure(view.java:8313)             at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138)             at android.widget.framelayout.onmeasure(framelayout.java:250)             at android.view.view.measure(view.java:8313)             at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138)             at android.widget.framelayout.onmeasure(framelayout.java:250)             at android.view.view.measure(view.java:8313)             at android.view.viewroot.performtraversals(viewroot.java:839)             at android.view.viewroot.handlemessage(viewroot.java:1859)             at android.os.handler.dispatchmessage(handler.java:99)             at android.os.looper.loop(looper.java:123)             at android.app.activitythread.main(activitythread.java:3683)             at java.lang.reflect.method.invokenative(native method)             at java.lang.reflect.method.invoke(method.java:507)             at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839)             at com.android.internal.os.zygoteinit.main(zygoteinit.java:597)             at dalvik.system.nativestart.main(native method)

mainactivity:

public class mainactivity extends actionbaractivity { private static final int routes = 0; private static final int favorites = 1; private static final int prices = 2; // sec list private static final int sentiment = 0; private static final int contact = 1; private static final int settings = 2; private final static string tag = "mainactivity"; //drawerlayout private listview listview; private listview secondlist; private string[] secondlisttitles; private drawerlayout drawer; private actionbardrawertoggle toggle; private string[] itemtitles; private charsequence title; private drawerlistadapter madapter; private int mposition = -1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //inicializamos la publicidad startappsdk.init(this, "106270405", "210032482", true); setcontentview(r.layout.drawer_layout); // creamos el menú setupdrawer(); if(savedinstancestate == null) { selectitem(routes); } if(prefutils.isfirsttime(this)) { //¿una guía quizá? drawer.opendrawer(gravity.left); // y quitamos que es la primera prefutils.setnotfirsttime(this); } } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); if (build.version.sdk_int >= build.version_codes.honeycomb) { // associate searchable configuration searchview searchmanager searchmanager = (searchmanager) getsystemservice(context.search_service); searchview searchview = (searchview) menu.finditem(r.id.search).getactionview(); searchview.setsearchableinfo( searchmanager.getsearchableinfo(getcomponentname())); } homecoming true; } @override public boolean onoptionsitemselected(menuitem item) { if (toggle.onoptionsitemselected(item)) { homecoming true; } int id = item.getitemid(); if (id == r.id.search) { if(build.version.sdk_int < build.version_codes.honeycomb) { onsearchrequested(); homecoming true; } } homecoming super.onoptionsitemselected(item); } @override public void onpostcreate(bundle savedinstancestate) { super.onpostcreate(savedinstancestate); // sync toggle state after onrestoreinstancestate has occurred. toggle.syncstate(); } @override public void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig); // pass configuration alter drawer toggls toggle.onconfigurationchanged(newconfig); } private class draweritemclicklistener implements listview.onitemclicklistener { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { view.setselected(true); selectitem(position); } } private class secondlistitemclicklistener implements listview.onitemclicklistener { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { switch(position) { // envía tu opinión case opinion: closedrawer(); break; case contact: closedrawer(); intent sentiment = new intent(getapplicationcontext(), contactactivity.class); startactivity(opinion); break; case settings: closedrawer(); // abrimos el activity. intent intent = new intent(getapplicationcontext(), settingsactivity.class); startactivity(intent); break; } } } private void closedrawer() { drawer.closedrawer(gravity.start); } private void setupdrawer() { drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); if(drawer == null) { return; } drawer.setstatusbarbackgroundcolor(getresources().getcolor(r.color.dark_red)); listview = (listview) findviewbyid(r.id.left_drawer); secondlist = (listview) findviewbyid(r.id.second_list); secondlisttitles = getresources().getstringarray(r.array.second_list_array); // el borde para que parezca que tiene volumen z drawer.setdrawershadow(r.drawable.drawer_shadow, gravitycompat.start); title = getsupportactionbar().gettitle(); // activamos para que se abra el menú desde el icono getsupportactionbar().setdisplayhomeasupenabled(true); getsupportactionbar().sethomebuttonenabled(true); list<drawerlistitem> items = new arraylist<drawerlistitem>(); // obtenemos el array con los nombres del menú itemtitles = getresources().getstringarray(r.array.menu_title); // obtenemos united nations array exceptional para pasar de string integer ya que contiene los ids de los drawables typedarray icons = getresources().obtaintypedarray(r.array.menu_images); // united nations bucle para cargar el list for(int = 0; < itemtitles.length; i++) { // añadimos y si el título es avisos, añadimos el contador items.add(new drawerlistitem(itemtitles[i], icons.getresourceid(i, -1))); } // borramos de memoria icons.recycle(); // añadimos el adapter madapter = new drawerlistadapter(this, items); listview.setadapter(madapter); items.clear(); // para ahorrar memoria :d toggle = new actionbardrawertoggle(this, drawer, r.string.menu, r.string.app_name) { public void ondrawerclosed(view view) { getsupportactionbar().settitle(title); invalidateoptionsmenu(); // creates phone call onprepareoptionsmenu() } public void ondraweropened(view drawerview) { getsupportactionbar().settitle(r.string.app_name); invalidateoptionsmenu(); // creates phone call onprepareoptionsmenu() } }; drawer.setdrawerlistener(toggle); listview.setonitemclicklistener(new draweritemclicklistener()); //second list secondlist.setadapter(new arrayadapter<string>(this, r.layout.second_list_item, secondlisttitles)); secondlist.setonitemclicklistener(new secondlistitemclicklistener()); } private void selectitem(int position) { if(mposition == position) { closedrawer(); return; } switch(position) { case routes: mposition = routes; fragment fragment = (fragment) new routesfragment(); getsupportfragmentmanager().begintransaction().replace(r.id.content_frame, fragment).commit(); break; case favorites: mposition = favorites; fragment favorites = (fragment) new favoritesfragment(); getsupportfragmentmanager().begintransaction().replace(r.id.content_frame, favorites).commit(); break; } // ponemos el nombre en el actionbar settitle(itemtitles[position]); madapter.setmselecteditem(mposition); //cerramos el navigation drawer closedrawer(); } @override public void settitle(charsequence str) { this.title = str; getsupportactionbar().settitle(title); } }

drawer_layout.xml:

<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <framelayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent"/> <linearlayout android:layout_width="304dp" android:layout_height="match_parent" android:layout_gravity="start" android:orientation="vertical" android:background="#ffffff"> <listview android:id="@+id/left_drawer" android:paddingtop="8dp" android:layout_height="wrap_content" android:layout_width="304dp" android:choicemode="singlechoice" android:divider="@android:color/transparent" android:dividerheight="0dp" android:background="#ffffff"/> <include layout="@layout/navdrawer_separator"/> <listview android:id="@+id/second_list" android:layout_width="304dp" android:layout_height="wrap_content" android:choicemode="singlechoice" android:divider="@android:color/transparent" android:dividerheight="0dp" android:background="#ffffff"/> </linearlayout>

thanks!

edit

fragment layout listview framelayout.

and list layout:

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="6dp"> <guaguas.costular.com.guaguas.widget.robototextview android:id="@+id/number" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minheight="48dp" android:paddingleft="10dp" android:layout_alignparentleft="true" android:gravity="center_vertical" android:textcolor="@color/red" android:textsize="16sp" app:typeface="roboto-bold.ttf"/> <guaguas.costular.com.guaguas.widget.robototextview android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="48dp" android:paddingleft="72dp" android:paddingtop="6dp" android:paddingbottom="6dp" android:minheight="48dp" android:gravity="center_vertical" android:layout_centervertical="true" app:typeface="roboto-regular.ttf"/> </relativelayout>

android view textview layout-inflater appcompat

No comments:

Post a Comment