1

我有一个注销功能。因此,当用户注销时,我想中止 BroadcastReceiver。但是在标题中出现错误。我究竟做错了什么?

public static void logout(Context context, String empid)
{
    try
    {
        Log.d("Testing", "TRY 2  LOGOUT me " + empid );
        try
        {
            Log.d("Testing", "TRY handle logout");
            db = new DbAdapter_User(context);
            db.open();
            db.handleLogout();
            db.close();
        }
        catch(Exception e)
        {
            Log.d("Testing", "CATCH handlelogout " + e.toString());
        }
        Log.d("Testing", "When logout class is " +  context.getClass());
        if (!context.getClass().equals(LogIn.class))
        {
             Log.d("Testing", "In IF When logout class is " +  context.getClass());
            context.startActivity(new Intent(context, LogIn.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
        }
        Log.d("Testing", "logout: setting Global variables ");
        ((GlobalMobileVianet)context.getApplicationContext()).setUserId("000000");
        ((GlobalMobileVianet)context.getApplicationContext()).setPassword("");
        Log.d("Testing", "logout: DONE setting Global variables ");
        try
        {
            Log.d("Testing", "TRY session manager aborted");
            SessionManager sessionManager = new SessionManager();
            sessionManager.abortBroadcast();
         }
        catch(Exception e)
        {
            Log.d("Testing", "CATCH session manager aborted " + e.toString());
        }
         LogoutNotification(context);

    }
    catch (Exception e)
    {
        Log.d("Testing", "CATCH 2  LOGOUT me " + e.toString() );
    }
}
4

0 回答 0