Robotium does not necessarily start the activities in the way they are started in normal use. It is possible that the test would be ran first, in which case the first and only activity on the stack is the login activity. After the user logs in, that activity finishes. This would leave the stack empty, and getCurrentActivity would return null.