Category : android-activity

I am trying to do a copy of Space Invaders with Kotlin and Android Studio to learn more about this kind of development but I have this error happening : E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.spaceinvaders, PID: 3982 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.spaceinvaders/com.example.spaceinvaders.GameView}: java.lang.InstantiationException: java.lang.Class<com.example.spaceinvaders.GameView> has no zero argument constructor at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2914) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3119) ..

Read more

My app has a navigation drawer implemented, when I clicked on the buttons, they work and take me to a fragment. Here’s the code in the main activity that linked the button to the fragment: @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { int id = item.getItemId(); if (id == R.id.nav_storyboard) { getSupportActionBar().setTitle("Storyboard"); getSupportFragmentManager().beginTransaction().replace(R.id.container,new HomeFragment()).commit(); } ..

Read more

I have 3 activities in my app Introductyactivity use as splash screen then Main activity where i have menu and I open 3rd activity from there. Now i press back key the screen goes to splash screen rather than go on Main activity I also make parent activity but it does not work. Source: Android ..

Read more

I have four fragments in a bottom navigation view which is initialised in the MainActivity class: public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); BottomNavigationView navView = findViewById(R.id.nav_view); AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( R.id.navigation_home, R.id.navigation_simulation, R.id.navigation_news, R.id.navigation_settings) .build(); NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); NavigationUI.setupWithNavController(navView, navController); } ..

Read more