編輯:關於android開發
最近看了一篇文章,把Android劃分成為一個王國,主要為分為以下
雙十一剛過,我們還是來說說這個強大的物流運輸公司吧
// 內部類
classMyOnclickListenerimplementsView.OnClickListener{
@Override
publicvoid onClick(View view){
switch(view.getId()){
case R.id.btn_activity:
Intent intent =newIntent();
intent.setClass(MainActivity.this,OtherActivity.class);
intent.putExtra("name","ZhangSan");
Bundle bundle =newBundle();
bundle.putInt("age",12);
bundle.putString("address","北京朝陽雙龍南裡18-1701");
intent.putExtra("bundle", bundle);
startActivity(intent);
break;
}
}
}
Intent intent = getIntent();
Bundle bundle = intent.getBundleExtra("bundle");
tv_show.setText("name:"+ intent.getStringExtra("name")+"\n"+
"age:"+ bundle.get("age")+"\n"+"address:"+ bundle.get
("address"));
@Override
protectedvoid onActivityResult(int requestCode,int resultCode,Intent
data){
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == REQUEST_CODE){
if(resultCode == RESULT_OK){
tv_result.setText(data.getStringExtra("result"));
}
}
Intent intent = getIntent();
intent.putExtra("result","我是Activity的結果");
setResult(RESULT_OK,intent);
// RESULT_OK 是Activity的常量finish();
findViewById(R.id.btn_sendSMS).setOnClickListener(newView
.OnClickListener(){
@Override
publicvoid onClick(View view){
Intent intent =newIntent();
intent.setData(Uri.parse("smsto:10086"));
intent.setAction(Intent.ACTION_SENDTO);
intent.putExtra("sms_body","10086,你好,我是測試發送的短信");
startActivity(intent);
}
});
Intent intent =newIntent(Intent.ACTION_PICK,
ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT_REQUEST);
if(requestCode == PICK_CONTACT_REQUEST){
Cursor cursor =null;
if(resultCode == RESULT_OK){
Uri uri = data.getData();
ContentResolver resolver = getContentResolver();
if(uri !=null){
cursor = resolver.query(uri,newString[]{ContactsContract.Contacts.DISPLAY_NAME},null,null,
null);
}
String name =null;
if(cursor.moveToFirst()){// True if the cursor is not empty
int columnIndex = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
name = cursor.getString(columnIndex);
et_contacts.setText(name);
}
}
}
android gridview畫分割線 android gridview畫分割線,如圖: 1。先上圖: 2.具體實現代碼: public class Lin
HBase Thrift2 CPU過高問題分析HBase Thrift2 CPU過高問題分析.pdf目錄目錄11.現象描述12.問題定位23.解決方案54.相關代碼51.
側滑1,側滑如圖是效果圖
Android 自定義控件的使用,android自定義控件首先自定義一個attrs.xml的資源文件,聲明自定義屬性 <?xml version=1.0 enco