[英]How to get Image through HTTP on Android 9.0 and then crop Image?
我之前用過android 7.1.1(API 25) Build-tools,前幾天版本已經升級到8.1.0(API 27)...
但現在使用 android 9.0(API 28) 和設備也是。
圖像裁剪 function 無法正常工作,我什至無法通過 HTTP 加載圖像我需要你的建議......請幫助我(;_;)
我正在嘗試 Lib 但我不使用gradle
而我正在使用java 1.6
public void imageForCrop(String imagePath){
Uri imageUri = Uri.parse(imagePath);
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(imageUri, "image/*");
String path = imageUri.getPath();
path = path.substring(path.lastIndexOf("/"),path.lastIndexOf("."))+"_new.jpg";
imageUri =Uri.fromFile(new File(Environment.getExternalStorageDirectory().getAbsolutePath(), path));
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);
callerObject.startActivityForResult(intent, IMAGE_FOR_CROP);
}
也許 HTTP 請求未在 Android 8 和 9 中啟用。
實現這一點的簡單方法是將此屬性用於您的 AndroidManifest.xml ,您可以在其中允許所有請求的所有 http :
android:usesCleartextTraffic="true"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.