1.android studioå¦ä½è°ç¨ç³»ç»ç¸å
android studioå¦ä½è°ç¨ç³»ç»ç¸å
å¨Android Studioä¸ï¼å¯ä»¥ä½¿ç¨Intentè°ç¨ç³»ç»ç¸åã以ä¸æ¯å ·ä½æ¥éª¤ï¼
1. å¨ä½ çAndroid Studio项ç®ä¸å建ä¸ä¸ªButtonæImageViewï¼ç¨äºè§¦åæå¼ç¸åçäºä»¶ã
2. å¨ButtonæImageViewçOnClickäºä»¶ä¸æ·»å 以ä¸ä»£ç ï¼
Intent intent = new Intent(Intent.ACTION_PICK,络相cas c源码 android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, PICK_IMAGE_REQUEST);
å ¶ä¸ï¼PICK_IMAGE_REQUESTæ¯ä¸ä¸ªæ´æ°å¸¸éï¼ç¨äºå¨Activityè¿åç»ææ¶è¿è¡è¯å«ã
3. å¨Activityä¸æ·»å 以ä¸ä»£ç ï¼ä»¥å¤çä»ç¸åè¿åçç»æï¼
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {
Uri uri = data.getData();
// 使ç¨uriå è½½å¾ç
}
}
å¨è¿ä¸ªæ¹æ³ä¸ï¼æ们æ£æ¥requestCodeæ¯å¦çäºPICK_IMAGE_REQUESTï¼resultCodeæ¯å¦çäºRESULT_OKï¼ä»¥ådataådata.getData()æ¯å¦ä¸ä¸ºnullãå¦æè¿äºæ¡ä»¶é½æ»¡è¶³ï¼æ们就å¯ä»¥ä½¿ç¨data.getData()æ¹æ³è·åä»ç¸åä¸éæ©çå¾ççUriï¼å¹¶ä½¿ç¨è¿ä¸ªUriå è½½å¾çã
注æï¼å¨ä½¿ç¨æå¼ç¸åçIntentæ¶ï¼éè¦å¨AndroidManifest.xmlæ件ä¸æ·»å 以ä¸æéï¼
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
è¿ä¸ªæéç¨äºè¯»ååå¨å¨è®¾å¤ä¸çå¾çã
2025-01-19 07:522998人浏览
2025-01-19 07:512953人浏览
2025-01-19 06:421682人浏览
2025-01-19 06:332671人浏览
2025-01-19 06:171633人浏览
2025-01-19 06:04130人浏览
为维护海鲜水产品市场计量秩序,严厉打击计量违法行为,近日,北京市丰台区市场监管局开展海鲜水产品市场电子计价秤专项监督检查。中国消费者报记者董芳忠摄影报道责任编辑:赵英男
1.股票k线出现m走势代表什么2.如何看K线图如何分析一直股票的K线走势)股票k线出现m走势代表什么 股票k线出现m走势是指股票的K线出现双顶的形态图,它是指个股在上涨的过程中,由于支撑上涨的因素