private void initView(View view) { data.clear(); refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refreshLayout); list_books = (ListViewCompat) view.findViewById(R.id.list_books); List<Book> list = mDao.queryAllBookList(); if (list != null && list.size() > 0) { data.addAll(list); } bookAdapter = new BookAdapter(getActivity(), data); list_books.setAdapter(bookAdapter); list_books.setOnItemClickListener(this); refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { data.clear(); data.addAll(mDao.queryAllBookList()); refreshLayout.setRefreshing(false); bookAdapter.notifyDataSetChanged(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initFilter(); mManager = (WifiP2pManager) getSystemService(WIFI_P2P_SERVICE); mChannel = mManager.initialize(this, getMainLooper(), new WifiP2pManager.ChannelListener() { @Override public void onChannelDisconnected() { Log.e("initialize","onChannelDisconnected"); mManager.initialize(MainActivity.this,getMainLooper(),this); } }); thisDevice = (TextView) findViewById(R.id.thisD); listView = (ListViewCompat) findViewById(R.id.listView); adapter = new WifiP2pDeviceAdapter(this,peers); listView.setAdapter(adapter); }
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.layout_statistics,null); if (itemAdapterStatistics == null) { itemAdapterStatistics = new ItemAdapterStatistics(getActivity(), R.layout.list_item_statistic); } ListViewCompat lv = (ListViewCompat)view.findViewById(R.id.listViewStatistics); lv.setAdapter(itemAdapterStatistics); Download(false); return view; }
@Override protected View onCreateView(final Context context) { listView = new ListViewCompat(context); listView.setBackgroundColor(Color.BLACK); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { listView.setAlpha(0.8f); } return listView; }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.donation_activity); ArrayList<Item> items = getItemsList(this); if (items == null || items.isEmpty()) { Snackbar.make(findViewById(R.id.donation_list), getString(R.string.error_IAP), Snackbar.LENGTH_LONG).show(); finish(); } else { ((ListViewCompat) findViewById(R.id.donation_list)).setAdapter(new DonationAdapter(this, items)); } }