Android access to the database on the server end, save pictures do

Android access to the database on the server end, save pictures do

Started by Josie at February 01, 2016 - 10:51 PM

The picture is a path, set URL. to the local take this path from the server

Posted by Bartholomew at February 05, 2016 - 11:38 PM

Take pictures address from the server, such as image/XXX/1233455.JPG and then define a string baseUrl = 10.0.2.2:8080/Demo/, together and get the address.

In short you are not directly from the pictures, but pictures address according to the address, then taken out. For example:

	// Transmission network.
public Bitmap getPic(String uriPic) {
URL imageUrl = null;
Bitmap bitmap = null;
try {
imageUrl = new URL(uriPic);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
HttpURLConnection conn = (HttpURLConnection) imageUrl
.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(is);

is.close();

} catch (IOException e) {
e.printStackTrace();
}
return bitmap;
}


Get after the relative pictures to do deal with the case of BMP = Bitmap.createScaledBitmap (BMP, length, width,
true);

Posted by Tony at February 12, 2016 - 11:53 PM

Thank God~!

Posted by Alex at February 22, 2016 - 12:09 AM

Upstairs has said very clearly

Posted by Anastasia at March 08, 2016 - 12:15 AM

So to take, but should pay attention to the image size on the server, memory overflow error is too large will, all finally can most image compression processing, the method can Baidu, if Google can not be used.!

Posted by Louis at March 09, 2016 - 1:12 AM

Database to store image server, only address, that picture cutout, where there is address?

Posted by Marcy at December 15, 2016 - 8:34 PM

Hello, I also get a picture in this way, but if in URL picture is the name of the Chinese cannot display, is this how to deal with.

Posted by Lance at December 19, 2016 - 9:08 PM

Pictures with Chinese named, what talent do this, ha ha~

Posted by Carina at December 26, 2016 - 9:10 PM

Although not help, but still give you props. . .

Posted by Dempsey at January 03, 2017 - 9:52 PM

This gave me the idea

Posted by Ann at January 07, 2017 - 9:36 PM

Downloading need to compress pictures? Beginners

Posted by Geoffrey at January 10, 2017 - 9:37 PM

Hello, you this kind of method on the general JPG, PNG images can be obtained with BitMap and then displayed in the ImageView, but if I get to the GIF picture, use GIFVIEW on the network, set up when the picture of the resource is not using BitMap, so the network picture can only use BitMap, you can use other methods to do?

Posted by Upton at January 12, 2017 - 9:59 PM