'Move "preparation task" to a MainActivity before launching gui
I have a running Android java written application and I would like to improve it.
For know my mainactivity, called DrugListActivty extend AppCompat. In short it's a recyclerView with Room database management.
I would like to move some part of the code in a MainActivity, in charge of checking database or onPause for example.
For now (and it's not working) I made :
public class MainActivity extends AppCompatActivity {
//some stuff
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, DrugListActivity.class);
startActivity(intent);
}
And DrugListActivity became
public class DrugListActivity extends MainActivity {
//etc
I have blink effect, DrugListActivty is launch again and again and again.
Is my idea bad (move to simply code)? If is a good idea, there must be a right way to do it but I can't find any help.
So I'm asking the experts.
Thanks in advance for reading me, your advises and your time.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
