3

Hello I'm currently having no luck with sussing out how to process an image after I have pulled a url out as async only allows for one return does anyone have any suggestions?

    /**
     * After completing background task Dismiss the progress dialog
     * **/
    protected void onPostExecute(String json) {
        // dismiss the dialog after getting song information

        try {
               JSONObject jsonObject = new JSONObject(json);
               JSONArray jsonArray = jsonObject.getJSONArray("users");
               JSONObject arrayElement_0 = jsonArray.getJSONObject(0);
               uname = arrayElement_0.getString(TAG_USERNAME);
               ptitle = arrayElement_0.getString(TAG_PROFILETITLE);
               age = arrayElement_0.getString(TAG_AGE);
               gender = arrayElement_0.getString(TAG_GENDER);
               status = arrayElement_0.getString(TAG_STATUS);
               small = arrayElement_0.getString(TAG_SMALL);

        BitmapFactory.decodeStream((InputStream)new URL(small).getContent());
4

3 回答 3

0

如果您需要返回多个东西,只需返回一个数组。

于 2013-04-21T23:03:56.883 回答
0

创建一个可以同时保存位图和其余数据的类?尽管将位图保留在一个类中是一个坏主意(它们使用大量内存)。一般来说,最好单独处理位图。

于 2013-04-21T23:38:40.750 回答
0

这是其他人在如何做到这一点上苦苦挣扎的最好例子,希望这会有所帮助:) http://codehenge.net/blog/2011/06/android-development-tutorial-asynchronous-lazy-loading-and-caching-of -listview-图像/

于 2013-04-23T18:08:11.390 回答