标签:mystra android ui线程 异步线程 代码
本文地址: http://blog.csdn.net/caroline_wendy
@Override public void onClick(View v) { String status = mEditStatus.getText().toString(); Log.d(TAG, "onClick with status: " + status); //通过 new PostTask().execute(status); } private final class PostTask extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { YambaClient yambaClient = new YambaClient("student", "password"); try { yambaClient.postStatus(params[0]); return "Successfully posted"; } catch (YambaClientException e) { e.printStackTrace(); return "Failed to post to yamba service"; } } @Override protected void onPostExecute(String s) { super.onPostExecute(s); Toast.makeText(StatusActivity.this, s, Toast.LENGTH_LONG).show(); } }
Android - UI线程和异步(AsyncTask)线程
标签:mystra android ui线程 异步线程 代码
原文地址:http://blog.csdn.net/caroline_wendy/article/details/41819395