Android – how to create a file from an image URL without downloading an image

How do I create a file from an imageurl?

I know what to do

I want to know how to create a file object without downloading an image from the URL

I have tried the following

File file = new File("http://www.planwallpaper.com/static/images/Winter-Tiger-Wild-Cat-Images.jpg");

I want to use this file in status.setmedia

    StatusUpdate status = new StatusUpdate(twitterMessage);
    status.setMedia(file );
    try {
           twitter4j.Status response = twitter.updateStatus(status);
           return response.toString();
    } catch (TwitterException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
    }

But it didn't succeed

Please help me to create a file directly from imageurl without downloading an image

resolvent:

You don't have. Files are used for local files. URLs are used for some content stored on the server, especially in this case, the server itself is not a device, so the URL does not point to local files... Unless you download a copy of the content to a local file

Check whether the API provides parameter types other than file, such as URI. The library will be used to support network-based media sources. If not, you have no choice but to download data and provide files pointing to local copies

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>