Don't crash if device doesn't have Bluetooth

This commit is contained in:
Felix Ableitner 2016-09-30 16:50:27 +09:00
parent 2ed57f6dec
commit 8334cd3926

View file

@ -39,7 +39,8 @@ class FirstStartActivity extends AppCompatActivity with OnEditorActionListener w
setContentView(R.layout.activity_first_start) setContentView(R.layout.activity_first_start)
setTitle(R.string.welcome) setTitle(R.string.welcome)
username.setText(BluetoothAdapter.getDefaultAdapter.getName.trim) val name = Option(BluetoothAdapter.getDefaultAdapter).map(_.getName.trim).getOrElse("")
username.setText(name)
username.setOnEditorActionListener(this) username.setOnEditorActionListener(this)
done.setOnClickListener(this) done.setOnClickListener(this)