All pastes #796815 Raw Edit

Unbenannt

public java v1 · immutable
#796815 ·published 2007-11-25 13:24 UTC
rendered paste body
public class MainClass extends Activity  {    		@Override    public void onCreate(Bundle icicle) {        super.onCreate(icicle);        TextView tv = new TextView(this);        setContentView(tv);        MyThread mt = new MyThread(tv);        mt.start();    }}    class MyThread extends MainClass implements Runnable {	public Thread tr;	public TextView tv;		public MyThread (TextView t) {		this.tv = t;		tr = new Thread(this);	}		public void sendOutput(String s) {		tv.setText(s);	}		public void start() {		tr.start();	}	public void run() {		sendOutput("test");                                 //<-works    		try {    		    		     final ServerSocket ss = new ServerSocket(2323);    		     sendOutput("waiting");                         //<-works    		     Socket sock = ss.accept();                     sendOutput("connected");                       //<-breaks    	            }    		catch ( IOException ioe ){    		     sendOutput("IO Error: " + ioe.getMessage());   //<-works		    } 	}		}