I have been working on this program for some time. I was stuck about how I could handle many of my button issues. I have three buttons that need to start different threads, but I've seen stuff on Google for threading and multithreading and I could not find the answer for which I was looking for. In my understanding, running a public null () can be said only once in a class for thread? How do I create more than one thread that is different in code in a class?
The example of what I have seen is the best solution to my problem:
@ Override public void onClick (see v) {// TODO Auto- Generated method stub switch (v.getId ()) {case R.id.Line: // Call to thread line break; Case R.id.Enter: // Enter Call to Thread Break; Case R.id.arc // Call to Thread Arch} Enter example thread and thread thread:
log into thread = new thread () {Public Zero Run () {Drawing Utilts Call = New Drawing Utilities (); EditText cl = (EditText) findViewById (R.id.editText1); In the string = cl.gettext (). ToString (); (In) call.setInputCoords; NotifyAll (); }}; Thread Line = New Thread () {Public Running Zero () {info.setText ("X, Y, Enter Z for Point 1"); Try {wait (); } Grip (Interrupted E) E. {// TODO Auto-Generated Catch Block e.printStackTrace (); } Call.addLine (); Info.setText ("Enter Z for X, Y, Point 2"); Try {wait (); } Grip (Interrupted E) E. {// TODO Auto-Generated Catch Block e.printStackTrace (); } Call.addLine (); }}; Line.start ();
create another internal square that extends thread
class line thread {increases public zero run ()) {drawing ilets call = new drawing utilities (); EditText cl = (EditText) findViewById (R.id.editText1); In the string = cl.gettext (). ToString (); (In) call.setInputCoords; NotifyAll (); }}; Now start using the new line (). Start ()
No comments:
Post a Comment