慕UI8511139
2021-05-02
SDK 6.0及以上需要动态申请,找资料学习一下吧
qq_慕勒7364117
2020-04-04
这web和h5一样吗
qq_Embedded_SJC_0
2020-04-01
qq_Embedded_SJC_0
2020-04-01
qq_慕工程6566427
2020-03-07
我大大
慕移动7060061
2020-03-07
public static Bitmap loadImage(String sendUrl) {
try {
URL url = new URL(sendUrl);
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setReadTimeout(5000);
conn.setRequestMethod("GET");
InputStream stream = conn.getInputStream();
String fileName = System.currentTimeMillis()+".jpg";
FileOutputStream outputStream = null;
File fileDownload = null;
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
File parent = Environment.getExternalStorageDirectory();
fileDownload = new File(parent, fileName);
outputStream = new FileOutputStream(fileDownload);
}
byte[] bytes = new byte[2 * 1024];
int lens;
if (outputStream != null) {
while ((lens = stream.read(bytes)) != -1) {
outputStream.write(bytes, 0, lens);
}
return BitmapFactory.decodeFile(fileDownload.getAbsolutePath());
} else {
return null;
}
} catch (MalformedURLException e) {
//这个URL能不能被解析成URL
e.printStackTrace();
Log.e("aa", "异常 MalformedURLException=" + e);
return null;
} catch (IOException e) {
e.printStackTrace();
Log.e("aa", "异常 IOException=" + e);
return null;
}
}
慕粉4326657
2019-11-11
看看图片地址是不是https的,是的话该用HttpsUrlConnection , 或者换个http的图片
慕用6508774
2019-08-31
https://github.com/nickgao1986/cardproject1
qq_小丑_117
2019-08-12
处理方式
慕粉1464742592
2019-07-17
Javan峰
2019-06-13
在return的时候会有这样的错误:SkImageDecoder::Factory returned null
张磊_seven
2019-06-08
你这是编译报错了吧,返回值对吗
慕九州3057956
2019-06-03
Android 5.0以上,除了在 AndroidManifest.xml 中加 读写权限外
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
还需要在代码中增加手动增加权限申请的代码:
public static void verifyStoragePerssion(Activity activity){
int writePerssion = ActivityCompat.checkSelfPermission(activity,Manifest.permission.WRITE_EXTERNAL_STORAGE);
int readPerssion = ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE);
if(writePerssion != PackageManager.PERMISSION_GRANTED || readPerssion != PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(activity, PERMISSIONS_STORGE, REQUEST_EXTERNAL_STORAGE);
}
}其中 REQUEST_EXTERNAL_STORAGE 和 PERMISSIONS_STORGE 定义如下:
private static final int REQUEST_EXTERNAL_STORAGE = 1;
private static String[] PERMISSIONS_STORGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
慕九州3057956
2019-05-21
把http改成https试试。
慕粉4069608
2019-05-15
actual 0xd532e53b != expected 0xebc651df 实际的内存地址与预期的内存地址不一致,你代码应该写的有问题
ggartist
2019-04-26
慕函数7387242
2019-04-25
调用这个API:void loadDataWithBaseURL (String baseUrl, String data, String mimeType, String encoding, String historyUrl) 即可, 视频中的public void loadData (String data, String mimeType, String encoding)这个API,根据官方文档说明,数据里如果带有"#","%","\","?"这四个特殊字符用 %23, %25, %27, %3f代替
慕函数7387242
2019-04-25
你参考一下源码中的HttpUtil,https://github.com/nickgao1986/httpTest,应该是return的原因,如果函数声明有返回值,
reaback
2019-04-17
https://github.com/nickgao1986/httpTest
慕粉2223448903
2019-04-03
qq_阿虚_03626768
2019-04-01
对书本信息的 增删改查
慕粉2223448903
2019-04-01
需要单独去学习后端的知识
幕布斯6552230
2019-02-27
https://github.com/nickgao1986
weibo_wannaReset_0
2019-02-21
秀儿是你吗,你是真的秀啊老铁
qq_慕的地5065565
2019-02-18
可是我的换了之后,运行也还是显示不出来,这是什么原因???