Android 7.0以上版本在OnCreate中添加:
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
builder.detectFileUriExposure()
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
builder.detectFileUriExposure()
2018-08-16
安卓7以后不能用這種file:///去訪問絕對路徑了好像。現在安卓8.1真機上運行這個是運行不了的。可以用FileProvider產生URI去訪問本地文件。
2018-06-16
// if(requestCode==RESULT_OK){ 去掉就可以顯示圖片了。因為RESULT_OK值為-1
2018-02-02
<intent-filter>
<action android:name="android.media.action.IMAGE_CAPTURE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
在配置文件中添加這些代碼,就可以跟系統相機一樣可以被其它程序調用。
<action android:name="android.media.action.IMAGE_CAPTURE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
在配置文件中添加這些代碼,就可以跟系統相機一樣可以被其它程序調用。
2017-12-15