u012536005
小横
2014-12-25 03:35

多个url 怎么保存到数组中呢 求大神给看看下面的代码拿错 了 痛苦啊

1
  • 数组 url
  • android

package com.li.textc;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.app.Activity;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import cn.bmob.v3.Bmob;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.datatype.BmobFile;
import cn.bmob.v3.listener.FindListener;

public class MainActivity extends Activity {
String Image_url[]=null;
int i ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

    // Bmob加入的代码
    Bmob.initialize(this, "9ce1856638d44a6cefdfb67f721d0127");
    // HorizontalScrollView horizontalScrollView = (HorizontalScrollView)
    // findViewById(R.id.scrollView);
    // Bmob加入的代码
    for (i = 0; i < 10; i++) {
        int k = i +1;

        BmobQuery<Picture> query = new BmobQuery<Picture>();
        query.addWhereEqualTo("id", k);

        query.findObjects(this, new FindListener<Picture>() {

            @Override
            public void onError(int arg0, String arg1) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onSuccess(List<Picture> arg0) {
                Picture pics = arg0.get(0);
                BmobFile pic = pics.getPicture();
                String IMAGE_URL = pic.getFileUrl(MainActivity.this);

                Image_url[i] = IMAGE_URL;//**重点是把这条加上 安卓程序启动就会停止**

            }

        });

    }
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

7条回答