コード例 #1
0
  void bindView(View v) {
    mHistoryList = (RecyclerView) v.findViewById(R.id.history_list);

    layoutManager = new LinearLayoutManager(getActivity());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mHistoryList.setLayoutManager(layoutManager);

    // Getting data from SHared Preference

    historyListAdapter = new HistoryListAdapter(db.getAllDestination(), getActivity());
    mHistoryList.setAdapter(historyListAdapter);
    historyListAdapter.notifyDataSetChanged();
  }
コード例 #2
0
        @Override
        public void onReceive(Context context, Intent intent) {
          if (intent.getAction().equalsIgnoreCase("history")) {
            if (db.getAllDestination().length != 0) {
              historyListAdapter = new HistoryListAdapter(db.getAllDestination(), getActivity());
              layoutManager = new LinearLayoutManager(getActivity());
              layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
              try {
                mHistoryList.setLayoutManager(layoutManager);

                mHistoryList.setAdapter(historyListAdapter);
                historyListAdapter.notifyDataSetChanged();
              } catch (NullPointerException ex) {
                ex.printStackTrace();
              }
            }
          }
        }