public class BookActivity extends AppCompatActivity { private BookBiz bookBiz=new BookBiz(); private List<BookList.DataBean> mData=new ArrayList<>(); private BookListAdapter adapter; private ListView mlistView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_book); mlistView=findViewById(R.id.book_lv); initView(); } private void initView() { bookBiz.listView(new BookCallback<List<BookList.DataBean>>() { @Override public void onError(Exception ex) { } @Override public void onSuccess(List<BookList.DataBean> response) { if (response.size()==0){ Log.e("List","返回结果是空"); return; } mData.addAll(response); Log.e("main1","数据"+mData.size()); } }); Log.e("main2","数据"+mData.size()); adapter=new BookListAdapter(this,mData); mlistView.setAdapter(adapter); } protected static void start(Context context){ Intent intent=new Intent(context,BookActivity.class); context.startActivity(intent); } }
我在后台的log显示的main1 有数据可是在main2里显示没有数据。在Callback返回有数据 可是就是拿不到
离歌丶D
相关分类