题目内容

下面是一个需要绑定服务的Activity类程序片断,阅读程序后简述该类主要编程逻辑。public class MainActivity extends Activity implements OnClickListener {private Button bindService;private Button unbindService;private MyService.DownloadBinder downloadBinder;private ServiceConnection connection = new ServiceConnection() {@Overridepublic void onServiceDisconnected(ComponentName name) {}@Overridepublic void onServiceConnected(ComponentName name, IBinder service) {downloadBinder = (MyService.DownloadBinder) service;Log.d("MainActivity", "onServiceConnected!");downloadBinder.startDownload();downloadBinder.getProgress();}};@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);bindService = (Button) findViewById(R.id.bind_service);unbindService = (Button) findViewById(R.id.unbind_service);bindService.setOnClickListener(this);unbindService.setOnClickListener(this);}@Overridepublic void onClick(View v) {switch (v.getId()) {case R.id.bind_service:Intent bindIntent = new Intent(this, MyService.class);bindService(bindIntent, connection, BIND_AUTO_CREATE);break;case R.id.unbind_service:unbindService(connection);break;default:break;}}}

查看答案
更多问题

阅读下面程序片断,请说明IntentService类运行逻辑。public class MyIntentService extends IntentService {public MyIntentService() {super("MyIntentService");}@Overrideprotected void onHandleIntent(Intent intent) {Log.d("MyIntentService", "Thread id is " + Thread.currentThread().getId());}@Overridepublic void onDestroy() {super.onDestroy();Log.d("MyIntentService", "onDestroy executed");}}

弹性力学基本方程中,静力平衡方程描述的是 与 之间的关系。

弹性力学基本方程中,几何方程描述应变与 之间的关系。

弹性力学基本方程中, 则是描述应力与应变间的关系。

答案查题题库