0

At the last line of my below code I would like to understand the function (this, R.layout.device_name) as device_name layout doesn't exist on my code. I also would like to know where I can define it.

 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //BTAdapter
    BTAdapter = BluetoothAdapter.getDefaultAdapter();

    //SwitchBT
    Switch switch_OnOff = (Switch)findViewById(R.id.switchbt);
    switch_OnOff.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

    //ListView / ArrayAdapter
    pairedDevicesAdapter = newArrayAdapter<String>(this,R.layout.device_name)
ZF007
  • 3,708
  • 8
  • 29
  • 48
  • That is layout file and that needs to be in layout folder, but this is basic development so I advise going through some tutorials of android. – Vir Rajpurohit Jan 06 '20 at 11:30
  • If I add this file to my layout folder, what should be in there ? Also would you recommend any tutorials ? – am_AndroidStudio Jan 06 '20 at 11:32
  • https://developer.android.com/courses – Vir Rajpurohit Jan 06 '20 at 11:33
  • 1
    Does this answer your question? [Meaning of R.layout.activity\_main in android development (JAVA language)](https://stackoverflow.com/questions/32649447/meaning-of-r-layout-activity-main-in-android-development-java-language) – Hack5 Jan 06 '20 at 12:47
  • Yes thank you ! My problem is solved I just had to create a new layout file called 'device_name' - right click on 'res/layout' and my code appeared as correct. However, I don't really see the use of this class as it only contains a TextView... – am_AndroidStudio Jan 06 '20 at 13:25
  • Post your solution based from comments as answer to close this open-standing question. – ZF007 Jan 06 '20 at 14:55

0 Answers0