I have an app with a menu, my menu has the option to logout from the app my idea is to create a file to keep all my reusable function so icreate a Support file, on my support file I have the logout function and I'm trying to call the logout from my mainactivity class, but I keep getting this error:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
I was testing the funciton my only doing "Log.e...." i have able to log the text
 public boolean onNavigationItemSelected(MenuItem item) { 
    int id = item.getItemId(); 
    if (id == R.id.home) {
        Toast.makeText(this, "Home", Toast.LENGTH_LONG).show();
    } else if (id == R.id.nav_logout) { 
        com.myapp.myapp.MAIN.Support.Support support = new com.myapp.myapp.MAIN.Support.Support();
        support.logout();
    }
    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
public class Support extends Activity {
     public void logout() {
        Intent intent = new Intent(context, com.myapp.myapp.MAIN.Activities.LoginActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); 
        startActivity(intent);
        Log.e(TAG, "Aquii");
    }
}
