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;//**重點是把這條加上 安卓程序啟動就會停止**
}
});
}
保存在List中吧 數組中不能變長