Skip to content

Commit

Permalink
Issue #26: Applying logs to class ActivityUtility.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShutUpPaulo committed Apr 30, 2016
1 parent a2bd22d commit 0ad8196
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@
import android.content.Intent;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.util.Log;

public class ActivityUtility{

private static final String TAG = "ActivityLog";

public static void restartActivity(Activity activity){

Log.d(TAG, "restartActivity: beggining the restart of the activity");

Intent intent = activity.getIntent();
activity.finish();
activity.startActivity(intent);
Expand All @@ -21,10 +27,11 @@ public static void restartActivity(Activity activity){
public static void clearBackStack(FragmentActivity fragmentActivity){
FragmentManager manager = fragmentActivity.getSupportFragmentManager();
if (manager.getBackStackEntryCount() > 0){
Log.d(TAG, "clearBackStack: the back stack is ready to be cleared");
FragmentManager.BackStackEntry first = manager.getBackStackEntryAt(0);
manager.popBackStack(first.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
}else{
//Nothing to do.
}
}
}
}

0 comments on commit 0ad8196

Please sign in to comment.