Avoid creating new remote and beamer instances in onCreate()
This commit is contained in:
父節點
fa41bfd331
當前提交
661ef08e58
|
@ -44,14 +44,17 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
remote = new RoboVac11sRemote();
|
||||
if (remote == null)
|
||||
remote = new RoboVac11sRemote();
|
||||
|
||||
beamer = new AndroidIRBeamer(this);
|
||||
if (!beamer.isAvailable()) {
|
||||
Toast.makeText(this.getApplicationContext(),
|
||||
"No IR beamer found: entering debug mode",
|
||||
Toast.LENGTH_LONG).show();
|
||||
beamer = new DebugIRBeamer(this);
|
||||
if (beamer == null) {
|
||||
beamer = new AndroidIRBeamer(this);
|
||||
if (!beamer.isAvailable()) {
|
||||
Toast.makeText(this.getApplicationContext(),
|
||||
"No IR beamer found: entering debug mode",
|
||||
Toast.LENGTH_LONG).show();
|
||||
beamer = new DebugIRBeamer(this);
|
||||
}
|
||||
}
|
||||
|
||||
findViewById(R.id.schedule).setEnabled(
|
||||
|
|
Loading…
Reference in New Issue