我想知道是否可以在Android中使用JSON或JSOUP在“search by image”页面上传图像,而无需使用任何Google API。提前致谢
答案 0 :(得分:1)
Yes it is possible to convert an image in Base64 string and send to server using Json or any other way.
e.g.
Bitmap bitmap=BitmapFactory.decodeResource(getResources(),R.drawable.facebook);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 70, stream); byte[] byteArray = stream.toByteArray();
String encodedImage = Base64.encodeToString(byteArray,Base64.DEFAULT);