문제

I want to try developing an android application that can send image/pdfFile from android to android device. For example i have a list of patients. when i click an item it will go to send file to patient that i have clicked. Then the sent file will be stored in database. and will serve as sent file history. Just like an instant messaging. I found an example of instant messaging but this only sending texts not images/files

here AndroidIM

Could anyone convert it to sending images?I really don't know how. Or just link me to some tutorial in sending images/files to another device. I am using also database for storing history of sent files.

도움이 되었습니까?

해결책

send the image to you PHP backend using the Http MultiPart Request like the following :

try{
 HttpClient client = new DefaultHttpClient();
    HttpPost request = new HttpPost(url);

    MultipartEntity entity = new MultipartEntity(
            HttpMultipartMode.BROWSER_COMPATIBLE);

    File file = new File(imagePath);
    ContentBody encFile = new FileBody(file,"image/png");

    entity.addPart("images", encFile);
    request.setEntity(entity);

}catch(Exception e ){

}

and please give me some feedback .

Hope That Helps .

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top