Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First organize your import and respect android coding style. I correct the beggining of your code.</p> <pre><code>private static Button mRun, mClear, mHome; private static EditText mUserInput; private static TextView mUserOutput; //LinkedList Customer Queue created here. public static Queue&lt;String&gt; line = new LinkedList&lt;String&gt; (); private static String time; //time variable. private static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); //DateFormat variable. private int intervals; private int cashiers; private int processing_time; Thread arrival; Handler handler, handlerr, handlerrr; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.station); mClear = (Button)findViewById(R.id.button_clear); mHome = (Button) findViewById(R.id.button_home); mUserInput = (EditText) findViewById(R.id.s_userinput); mUserOutput = (TextView) findViewById(R.id.s_useroutput); if (mClear != null) { mClear.setOnClickListener(this); } if (mHome != null) { mHome.setOnClickListener(this); } } public void onClick(View view) { if (view == mClear) { line.clear(); mUserInput.setText(getString(R.string.line_cleared)); //Use string ressource ! mUserOutput.setText(""); System.out.println("cleared"); // Use string ressource } else if (view == mHome) { Intent a = new Intent(this, MainActivity.class); startActivity(a); } } </code></pre> <p>You have to use thread to do some complex calcul, get your data. But the initialization of a user interface can't be done in a worker thread. You have to be on the main thread. As usual everything is here : <a href="http://developer.android.com/guide/components/processes-and-threads.html" rel="nofollow">http://developer.android.com/guide/components/processes-and-threads.html</a> </p>
 

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