Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 下载的图像会自动调整大小_Android_Menuitem - Fatal编程技术网

Android 下载的图像会自动调整大小

Android 下载的图像会自动调整大小,android,menuitem,Android,Menuitem,我从服务器下载图像并使用以下代码保存它们: private void downloadImages(String[] images, String fileName){ for (int i = 0; i < images.length; i++) { try { url = new URL(images[i]); String outputName = i+fileName; inpu

我从服务器下载图像并使用以下代码保存它们:

private void downloadImages(String[] images, String fileName){

    for (int i = 0; i < images.length; i++) {

        try {
            url = new URL(images[i]);

            String outputName = i+fileName;

            input = url.openConnection().getInputStream();
            output = activity.openFileOutput(outputName, Context.MODE_PRIVATE);

            int read;
            byte[] data = new byte[1024];

            while ((read = input.read(data)) != -1){
                output.write(data, 0, read);
            }

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (output != null)
                try {
                    output.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            if (input != null)
                try {
                    input.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
        }
    }
}
private Drawable[] readMenuImages(){   

    Drawable[] drawable = new Drawable[myJSONObject.getMenuItems().length]; 

    for(int i=0 ; i < myJSONObject.getMenuItems().length ; i++){


        try {
              drawable[i]=Drawable.createFromStream(activity.openFileInput(i+activity.getString(R.string.menuItemImgarabicfilename)), "ImageStream");



        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }          

    return drawable;
}
事实上,我不明白发生了什么,也不知道如何解决这个问题

我已经访问了此线程,但它没有帮助

谢谢你的帮助