android - Why Application shuts down as soon as it's launched even if there's no error caution? -
i have 3 xml files layouts such as
- activity_behind_left_simple.xml
- activity_behind_right_simple.xml
- activity_main.xml
i implemented textviews activity_behind_left_simple.xml
, shows list of menu. works fine.
so did same on activity_behind_right_simple.xml
, too.
however, application shuts down it's launched:(
why that? what's wrong right side? activity_behind_left_simple.xml
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" style="@style/leftbehindmenuscroll" > <linearlayout style="@style/behindmenuscrollcontent" android:paddingtop="25dp" > <textview style="@style/behindmenuitemtitle" android:text="people" /> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" > <jp.fureco.iconview android:id="@+id/iconviewitem4" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="15dp" android:textsize="20dp"/> <textview android:layout_marginleft="10dp" style="@style/behindmenuitemlabel" android:text="visitor" /> </linearlayout> </linearlayout> </scrollview>
activity_behind_right_simple.xml
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" style="@style/rightbehindmenuscroll" > <linearlayout style="@style/behindmenuscrollcontent" android:paddingtop="25dp" > <textview style="@style/behindmenuitemtitle" android:text="messages" /> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" > <jp.fureco.iconview android:id="@+id/iconviewitem5" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="15dp" android:textsize="20dp"/> <textview android:layout_marginleft="10dp" style="@style/behindmenuitemlabel" android:text="received" /> </linearlayout> </linearlayout> </scrollview>
simplesidedrawer.java
.... public view setleftbehindcontentview(int leftbehindlayout) { final view content = ((layoutinflater) getcontext().getsystemservice(context.layout_inflater_service)).inflate(leftbehindlayout, mleftbehindbase); string[] icons = getresources().getstringarray(r.array.icons); iconview iv4 = (iconview) findviewbyid(r.id.iconviewitem4); iv4.settypeface(typeface.createfromasset(getcontext().getassets(), "icons.ttf")); iv4.settext(icons[8]); iconview iv5 = (iconview) findviewbyid(r.id.iconviewitem5); iv5.settypeface(typeface.createfromasset(getcontext().getassets(), "icons.ttf")); iv5.settext(icons[315]); mleftpaddingrect = new rect(content.getpaddingleft(), content.getpaddingtop(), content.getpaddingright(), content.getpaddingbottom()); mleftbehindview = content; return content; } ....
then if remove part, application won't shuts down anymore.
how can fix?
iconview iv5 = (iconview) findviewbyid(r.id.iconviewitem5); iv5.settypeface(typeface.createfromasset(getcontext().getassets(), "icons.ttf")); iv5.settext(icons[315]);
mainactivity.java
... @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); getsize(); mactionbar = getactionbar(); mactionbar.hide(); mnav = new simplesidedrawer(this); mnav.setleftbehindcontentview(r.layout.activity_behind_left_simple); mnav.setrightbehindcontentview(r.layout.activity_behind_right_simple); ....
simplesidedrawer.java i've found this. matter?
public view setrightbehindcontentview(int rightbehindlayout) { final view content = ((layoutinflater) getcontext().getsystemservice(context.layout_inflater_service)).inflate(rightbehindlayout, mrightbehindbase); mrightpaddingrect = new rect(content.getpaddingleft(), content.getpaddingtop(), content.getpaddingright(), content.getpaddingbottom()); mrightbehindview = content; return content; }
part2
public view setleftbehindcontentview(int leftbehindlayout) { final view content = ((layoutinflater) getcontext().getsystemservice(context.layout_inflater_service)).inflate(leftbehindlayout, mleftbehindbase); string[] icons = getresources().getstringarray(r.array.icons); iconview iv4 = (iconview) findviewbyid(r.id.iconviewitem4); iv4.settypeface(typeface.createfromasset(getcontext().getassets(), "icons.ttf")); iv4.settext(icons[25]); iconview iv5 = (iconview) findviewbyid(r.id.iconviewitem5); iv5.settypeface(typeface.createfromasset(getcontext().getassets(), "icons.ttf")); iv5.settext(icons[26]); iconview iv6 = (iconview) findviewbyid(r.id.iconviewitem6); iv6.settypeface(typeface.createfromasset(getcontext().getassets(), "icons.ttf")); iv6.settext(icons[117]); mleftpaddingrect = new rect(content.getpaddingleft(), content.getpaddingtop(), content.getpaddingright(), content.getpaddingbottom()); mleftbehindview = content; return content; }
you need give reference inflated layout. try views acessing inside setleftbehindcontentview method:
e.g: iconview iv5 = (iconview) content.findviewbyid(r.id.iconviewitem5);
note: assuming view corresponding r.id.iconviewitems lies inside inflated layout file.
Comments
Post a Comment