static MainActivity ths;
@Overrideprotected void onCreate(Bundle savedInstanceState) {....ths = this;TextView showName = (TextView)findViewById(R.id.showName);public static MainActivity getInstance() { return ths; }....public void updateTheTextView(final String t) {MainActivity.this.runOnUiThread(new Runnable() { public void run() { showName.append(t); } }); }}Others.java欲使用MainActivity的texview就只要如下:MainActivity.getInstance().updateTheTextView(strAddress);
沒有留言:
張貼留言