English 中文(简体)
(a) 采用海底地图的最佳途径;
原标题:The best way to use bitmaps in android ;)

我必须制作和申请表片,显示新的杂志及其网页。 每个杂志都有大约70页,每一页都有大约700 000台 by的图像。 主要读物显示大形象和小孔(Gall Viewery)的图像。 我与3.2国合作。 当我增加画面,我尝试幻灯片时,它确实进展顺利。 有时甚至装上所有图像,LogCat显示我这一信息:

11-17 14:30:51.598: D/skia(5868): libjpeg error 105 <  Ss=%d, Se=%d, Ah=%d, Al=%d> from read_scanlines [128 168]
11-17 14:30:51.598: D/skia(5868): --- decoder->decode returned false

Now I put into gallery about 7 images which I scale like this:

public Bitmap decodeFile(String f) {
    try {
        BitmapFactory.Options o = new BitmapFactory.Options();
        o.inJustDecodeBounds = true;
        BitmapFactory.decodeStream(new FileInputStream(f),null,o);

        final int REQUIRED_SIZE=75;

        int width_tmp=o.outWidth, height_tmp=o.outHeight;
        int scale=1;
        while(true) {
            if(width_tmp/2<REQUIRED_SIZE || height_tmp/2<REQUIRED_SIZE)
                break;
            width_tmp/=2;
            height_tmp/=2;
            scale*=2;
        }
        BitmapFactory.Options o2 = new BitmapFactory.Options();
        o2.inSampleSize=scale;
        return BitmapFactory.decodeStream(new FileInputStream(f), null, o2);
    } catch (FileNotFoundException e) {}
    return null;
}

并且如上所示:

    public View getView(int position, View convertView, ViewGroup parent) {
        View retval = LayoutInflater.from(parent.getContext()).inflate(R.layout.viewitem, null);
        ImageView iV = (ImageView) retval.findViewById(R.id.image);
        String path = ArrayHelper.list.get(position).get("pageId").toString();
        Bitmap bP = decodeFile(Environment.getExternalStorageDirectory() + "/MCW/" + path + "/head.jpg");
        iV.setImageBitmap(bP);
        return retval;
    }

今后,我会有更多的热情,我可以想象会如何工作。

我的问题是:应该做些什么? 我应如何装上图像?

最佳回答

你问了一个一般性问题,因此,我能做的最好办法是给你一个一般性答案。 你们在杂志上有一个整页的蓝图。 你们只应使用页面图。 其余应为实际案文。 这将大大减少你的记忆脚印。 此外,你应当照亮这些比照地图。 查阅

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签