Here I tried to copy the name of the package in the class part but apparently it isn't working please help
CodePudding user response:
as a second param for intent you should pass desired Activitys class, not package name
e.g. if you would want to open new instance of MainActivity:
new Intent(MainActivity.this, com.example.goaltracker.MainActivity.class);
in fact com.example.goaltracker. prefix isn't needed, you may just import desired Activity class (new Intent(MainActivity.this, DesiredActivity.class))
PS. NEVER post code/text as screenshot!!!
CodePudding user response:
Instead of this:
Intent intent = new Intent(MainActivity.this, com.example.goaltracker.Class);
Use this :
Intent intent = new Intent(MainActivity.this, goaltracker.Class);
And when you create an activity, the preference is to name the first caractere of the word in uppercase, for example : GoalTracker.class
