Android setting new Intent from Activity class
<p>I have class that extends Activity. That has a "Logout" menu options. When I click that it calling logout(context) from another class (not extends from Activity). </p>

<pre><code>public class MyTask extends Activity{

@Override
public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.listlayout); 
}  
   @Override
   public boolean onCreateOptionsMenu(Menu menu)
   {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.mytaskmenu, menu); 
return true;
   }   
   @Override 
   public boolean onOptionsItemSelected(MenuItem item) { 
       switch (item.getItemId()) { 
           case R.id.logout: 
               Functions.logout(getBaseContext());
               return true; 
           default: 
              return true; 
        } 
    } 
}


 public class Functions {

    public static void logout(Context context)
    {
        DbAdapter_User db2= new DbAdapter_User(context);
        db2.open();
        db2.handleLogout();
        db2.close();
        context.startActivity(new Intent(context, LogIn.class));
    }
</code></pre>

<p>And the error is</p>

<pre><code>android.util.AndroidRuntimeException: 
Calling startActivity() from outside of an Activity  context requires the         FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
</code></pre>

<p>WHAT IS GOING WRONG?</p>
