启动屏幕活动适用于线程类,但它不会扩展或实现Thread。那么Thread如何在Activity中工作?
答案 0 :(得分:1)
为什么活动不会延伸Thread class
。您可以像Runnable
中那样实施Activity
:
public class AndroidRunnable extends Activity implements Runnable{
Thread myThread;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
@Override
public void run() {
// TODO Auto-generated method stub
}
}
请参阅此示例,了解如何使用线程创建启动画面活动: