Note that there are some explanatory texts on larger screens.

plurals
  1. POnumberpicker not responding
    primarykey
    data
    text
    <p>I'm very new to Android I'm picking it up fast but not fast enough. I have number picker widget on my app. The widget loads on the page but there are two problems. The first is inside the widget box nothing is displayed where 0 was expected. The second problem is if either + or - button is pressed the app crashes. My device is Android 2.3.4 (HTC Wildfire) and I'm working in eclipse.</p> <p>Here is my java file</p> <pre><code> public class NumberPickerActivity extends Activity { private Button upButton; private Button downButton; private EditText editText; private int uprange = 20; private int downrange = 0; private int values = 0; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); upButton = (Button) findViewById(R.id.upButton); downButton = (Button) findViewById(R.id.downButton); editText = (EditText) findViewById(R.id.numberEditText); upButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { downButton.setBackgroundResource(R.drawable.timepicker_down_normal); upButton.setBackgroundResource(R.drawable.timepicker_up_pressed); if (values &gt;= downrange &amp;&amp; values &lt;= uprange) values++; if (values &gt; uprange) values = downrange; editText.setText("" + values); } }); downButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { downButton .setBackgroundResource(R.drawable.timepicker_down_pressed); upButton.setBackgroundResource(R.drawable.timepicker_up_normal); if (values &gt;= downrange &amp;&amp; values &lt;= uprange) values--; if (values &lt; downrange) values = uprange; editText.setText(values + ""); } }); } } </code></pre> <p>This is my xml</p> <pre><code> &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background" android:orientation="horizontal" &gt; &lt;Button android:id="@+id/upButton" android:layout_width="50sp" android:layout_height="50sp" android:layout_toLeftOf="@+id/numberEditText" android:background="@drawable/timepicker_up_normal" android:onClick="onupButtonPress"/&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/textView2" android:layout_alignLeft="@+id/textView2" android:layout_alignRight="@+id/textView2" android:layout_marginRight="43dp" android:text="Welcome whatever your name is" android:textSize="24sp" /&gt; &lt;Button android:id="@+id/downButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/numberEditText" android:layout_alignLeft="@+id/upButton" android:layout_alignRight="@+id/upButton" android:layout_below="@+id/upButton" android:background="@drawable/timepicker_down_normal" android:onClick="ondownButtonPress"/&gt; &lt;EditText android:id="@+id/numberEditText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/scanButton" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:background="@drawable/timepicker_input_selected" android:ems="10" android:gravity="center" android:inputType="number" /&gt; &lt;/RelativeLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload