日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java类的实现程序_java – 如何在另一个类中实现处理程序?

發布時間:2025/3/15 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java类的实现程序_java – 如何在另一个类中实现处理程序? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在我的應用程序中,我有三個按鈕,當單擊一個按鈕時,它調用一個線程啟動的東西是我希望能夠在edittext字符串中輸入到線程并做一些工作然后讓它返回到UI線程我可以在哪里顯示它或將其放入opengl來顯示一個對象.我已經閱讀了Handles,我不確定我是否完全理解它們,也許有人知道如何制作我自己的處理程序代碼.此外,我已經閱讀了Async,我不認為這會對我的應用程序有利.(個人opion,如果它有利于我的應用程序讓我知道)我的問題是當我輸入按下該行時,我將如何從UI edittext獲取信息在DrawingUtils類中的線程然后完成工作然后它返回到UI以顯示或在openGl程序中輸入?

這是MainActivity類:

public class MainActivity extends Activity implements OnClickListener {

EditText cl;

TextView info;

Button enter;

Button line;

Button arc;

Line callLine = new DrawingUtils.Line();

Enter callEnter = new DrawingUtils.Enter();

Arc callArc = new DrawingUtils.Arc();

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

info = (TextView) findViewById(R.id.info);

enter = (Button) findViewById(R.id.enter);

line = (Button) findViewById(R.id.line);

arc = (Button) findViewById(R.id.arc);

Handler UIhandler = new Handler() {

@Override

public void handleMessage(Message msg) {

Bundle bundle = msg.getData();

String string = bundle.getString("myKey");

}

};

}

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

switch (v.getId()) {

case R.id.enter:

callEnter.start();

break;

case R.id.line:

callLine.start();

break;

case R.id.arc:

callArc.start();

break;

}

};

}

這是DrawingUtils類:

public class DrawingUtils {

MainActivity handle = new MainActivity();

// Thread classes for buttons

public static class Enter extends Thread {

Thread enter = new Thread() {

public void run() {

}

};

public static class Line extends Thread {

Thread line = new Thread() {

public void run() {

}

};

}

public static class Arc extends Thread {

Thread arc = new Thread() {

public void run() {

}

};

}

}

}

總結

以上是生活随笔為你收集整理的java类的实现程序_java – 如何在另一个类中实现处理程序?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。