public class MainActivity extends Activity {
int i = 0;
String Image_url[] = new String[10];
@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 = 1; i < 11; i++) {
BmobQuery<Picture> query = new BmobQuery<Picture>();
query.addWhereEqualTo("id", i);
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[] = new String[10];
String IMAGE_URL = pic.getFileUrl(MainActivity.this);
Image_url[i] = IMAGE_URL;
}
});
} |
|