title: android java/kotlin recyclerview items not visible
body: <p>i am trying to build an app that scans for bluetooth devices and displays them in a recyclerview. i am writing some of the app using java and some of the app in kotlin. for some reason my recyclerview items aren't visible. somebody please help me to find what mistake that i am making. i am posting the code for my activity and also my recycler view. To clarify my question. The discovery succeeds, devices are found, and all the inherited methods in my adapter seem to be called. I placed log messages in them and I still see nothing in the recyclerview. Why is nothing show up? here is my activity written in java : </p>
  
  <pre><code>public class ToofActivity extends AppCompatActivity implements CompoundButton.OnCheckedChangeListener {
  
  private static final String TAG = "ToofActivity";
  private static final int REQUEST_COARSE_LOCATION = 222;
  
  private static BluetoothAdapter btAdapter;
  
  private TextView mStatusLabel;
  private Switch mStatusSwitch;
  private ProgressBar mProgressBar;
  private RecyclerView mDeviceRecylcer;
  private static ArrayList&lt;BluetoothDevice&gt; mDevices = new ArrayList&lt;&gt;();
  private DeviceAdapter mAdapter;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_toof);
  
      checkLocationPermission();
  
      btAdapter = BluetoothAdapter.getDefaultAdapter();
  
      mStatusLabel = (TextView) findViewById(R.id.status_view);
      mStatusLabel.setText(btAdapter.isEnabled() ? "Active" : "Inactive");
      mStatusSwitch = (Switch) findViewById(R.id.status_switch);
      mStatusSwitch.setChecked(btAdapter.isEnabled());
      mStatusSwitch.setOnCheckedChangeListener(this);
      mProgressBar = (ProgressBar) findViewById(R.id.search_progress_bar);
      mDeviceRecylcer = (RecyclerView) findViewById(R.id.device_recycler);
  
      mDeviceRecylcer.setLayoutManager(new LinearLayoutManager(this));
      mAdapter = new DeviceAdapter(getApplicationContext());
      mDeviceRecylcer.setAdapter(mAdapter);
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.options_menu, menu);
      return super.onCreateOptionsMenu(menu);
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      switch (item.getItemId()) {
          case R.id.searchOption:
              DiscoveryTask discovery = new DiscoveryTask(btAdapter, this, mProgressBar);
              discovery.setOnCompleteListener(new DiscoveryTask.OnCompletedListener() {
                  @Override
                  public void onComplete() {
                      mAdapter.updateItems(mDevices);
                  }
              });
              discovery.execute((Void) null);
              break;
      }
  
      return true;
  }
  
  @Override
  public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      if (isChecked) {
          btAdapter.enable();
          mStatusLabel.setText("Active");
      } else {
          btAdapter.disable();
          mStatusLabel.setText("Inactive");
      }
  }
  
  public static void setDeviceList(ArrayList&lt;BluetoothDevice&gt; deviceList) {
      mDevices.clear();
      mDevices = deviceList;
  }
  
  protected void checkLocationPermission() {
      if (this.checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)
              != PackageManager.PERMISSION_GRANTED) {
  
          ActivityCompat.requestPermissions(this,
                  new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},
                  REQUEST_COARSE_LOCATION);
      }
  }
  
  @Override
  public void onRequestPermissionsResult(int requestCode,
                                         String permissions[], int[] grantResults) {
      switch (requestCode) {
          case REQUEST_COARSE_LOCATION: {
              if (grantResults.length &lt;= 0
                      || grantResults[0] != PackageManager.PERMISSION_GRANTED) {
                  checkLocationPermission();
                  break;
              }
          }
      }
  }
  }
  </code></pre>
  
  <p>and here is the code for my recyclerview written in kotlin : </p>
  
  <pre><code>class DeviceAdapter(val mContext : Context) : RecyclerView.Adapter&lt;DeviceAdapter.DeviceHolder&gt;(){
  
  val mDevices = ArrayList&lt;BluetoothDevice&gt;()
  
  fun updateItems(list: ArrayList&lt;BluetoothDevice&gt;){
      mDevices.clear()
      mDevices.addAll(list)
      Log.d(TAG, "updating items : $mDevices")
      notifyDataSetChanged()
  }
  
  override fun onBindViewHolder(holder: DeviceHolder, position: Int) {
      Log.d(TAG, "onBindViewHolder called!")
      holder.bindItems(mDevices.get(position))
  }
  
  override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): DeviceHolder{
      Log.d(TAG, "onCreateViewHolder called!")
      val v = LayoutInflater.from(mContext).inflate(R.layout.device_item, parent, false)
      return DeviceHolder(v)
  }
  
  override fun getItemCount(): Int {
      return mDevices.size
  }
  
  inner class DeviceHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
  
          val nameView = itemView.findViewById(R.id.nameView) as TextView
          val addrView = itemView.findViewById(R.id.addressView) as TextView
  
      fun bindItems(btDevice: BluetoothDevice){
          Log.d(TAG, "holder created!")
          nameView.text = btDevice.name
          addrView.text = btDevice.address
      }
  }
  
  companion object {
      val TAG = "DeviceAdapter"
  }
  
  }
  </code></pre>
  
  <p>thank you for helping me.</p>