xml - Android crashing nothing in logcat -
https://github.com/benireydman/slide_menu-slide_menu if see if can crash logs help.
i tested out , keeps crashing when run function.
i have removed function , ran app can certainty cause of it. put function involved in, left out detail unimportant.
public void function(){ if(this >= that1){ button1.setenabled(false); } else { button1.setenabled(true); } if(this >= that2){ button2.setenabled(false); } else { button2.setenabled(true); } if(this >= that3){ button3.setenabled(false); } else { button3.setenabled(true); } if(this >= that4){ button4.setenabled(false); } else { button4.setenabled(true); } } <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/buttongray"></item> <item android:drawable="@drawable/buttonclick" android:state_pressed="true"></item> <item android:drawable="@drawable/button" android:state_enabled="false"></item> </selector>
more code
<linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:weightsum="4"> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/selector_state2_xml" android:id="@+id/upgbutton" android:layout_gravity="center_horizontal" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/selector_state3_xml" android:id="@+id/upgbutton1" android:layout_gravity="center_horizontal" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/selector_state4_xml" android:id="@+id/upgbutton2" android:layout_gravity="center_horizontal" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/selector_state5_xml" android:id="@+id/upgbutton3" android:layout_gravity="center_horizontal" /> </linearlayout>
and @ beginning of oncreateview
public void setbutton() { button1 = (button) rootview.findviewbyid(r.id.upgbutton); button2 = (button) rootview.findviewbyid(r.id.upgbutton1); button3 = (button) rootview.findviewbyid(r.id.upgbutton2); button4 = (button) rootview.findviewbyid(r.id.upgbutton3); }
code fragment
function called cookiechange
view.onclicklistener mstartlistener = new view.onclicklistener() { public void onclick(view v) { if (loop == 0) { mchronometer.setbase(systemclock.elapsedrealtime()); mchronometer.start(); starttime = system.currenttimemillis(); loop++; } else if (loop == 1) { millis = system.currenttimemillis()-starttime; mchronometer.stop(); context context = getactivity().getapplicationcontext(); charsequence text = "your time is: " + (millis/1000); int duration = toast.length_short; toast toast = toast.maketext(context, text, duration); toast.setgravity(gravity.bottom, 0, 25); toast.show(); cookiestr(); loop++; } else if (loop == 2) { mchronometer.setbase(systemclock.elapsedrealtime()); cookiecalc(); textview mytext = (textview) rootview.findviewbyid(r.id.edittext2); mytext.settext("= " + cookies); textview mytext2 = (textview) rootview.findviewbyid(r.id.edittext); mytext2.settext("stop watch close possible 5"); cookiechange(); loop = 0; } } };
Comments
Post a Comment