com.xtremelabs.robolectric.shadows
Class ShadowActivity

java.lang.Object
  extended by com.xtremelabs.robolectric.shadows.ShadowContext
      extended by com.xtremelabs.robolectric.shadows.ShadowContextWrapper
          extended by com.xtremelabs.robolectric.shadows.ShadowActivity
Direct Known Subclasses:
ShadowListActivity, ShadowMapActivity

@Implements(value=android.app.Activity.class)
public class ShadowActivity
extends ShadowContextWrapper


Constructor Summary
ShadowActivity()
           
 
Method Summary
 void assertNoBroadcastListenersRegistered()
          Checks the ApplicationContext to see if BroadcastListeners are still registered.
 android.view.View findViewById(int id)
          Checks to ensure that thecontentView has been set
 void finish()
           
 android.app.Application getApplication()
           
 android.app.Application getApplicationContext()
           
 android.view.View getContentView()
          Non-Android accessor.
 android.content.Intent getIntent()
           
 android.view.LayoutInflater getLayoutInflater()
           
 android.app.Activity getParent()
           
 int getResultCode()
          Non-Android accessor.
 android.content.Intent getResultIntent()
          Non-Android accessor.
 android.view.Window getWindow()
          Constructs a new Window (a TestWindow) if no window has previously been set.
 boolean isFinishing()
           
 void onDestroy()
          Checks to see if BroadcastListeners are still registered.
 void setContentView(int layoutResID)
          Sets the contentView for this Activity by invoking the LayoutInflater
 void setContentView(android.view.View view)
           
 void setIntent(android.content.Intent intent)
           
 void setResult(int resultCode)
           
 void setResult(int resultCode, android.content.Intent data)
           
 
Methods inherited from class com.xtremelabs.robolectric.shadows.ShadowContextWrapper
__constructor__, getContentResolver, getNextStartedActivity, getNextStartedService, getPackageManager, getPackageName, getResources, getSharedPreferences, getSystemService, peekNextStartedActivity, peekNextStartedService, registerReceiver, sendBroadcast, startActivity, startService, unregisterReceiver
 
Methods inherited from class com.xtremelabs.robolectric.shadows.ShadowContext
getResourceLoader, getString, getString, getText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShadowActivity

public ShadowActivity()
Method Detail

getApplication

@Implementation
public final android.app.Application getApplication()

getApplicationContext

@Implementation
public final android.app.Application getApplicationContext()
Overrides:
getApplicationContext in class ShadowContextWrapper

setIntent

@Implementation
public void setIntent(android.content.Intent intent)

getIntent

@Implementation
public android.content.Intent getIntent()

setContentView

@Implementation
public void setContentView(int layoutResID)
Sets the contentView for this Activity by invoking the LayoutInflater

Parameters:
layoutResID - ID of the layout to inflate
See Also:
getContentView()

setContentView

@Implementation
public void setContentView(android.view.View view)

setResult

@Implementation
public final void setResult(int resultCode)

setResult

@Implementation
public final void setResult(int resultCode,
                                           android.content.Intent data)

getLayoutInflater

@Implementation
public android.view.LayoutInflater getLayoutInflater()

findViewById

@Implementation
public android.view.View findViewById(int id)
Checks to ensure that thecontentView has been set

Parameters:
id - ID of the view to find
Returns:
the view
Throws:
java.lang.RuntimeException - if the contentView has not been called first

getParent

@Implementation
public final android.app.Activity getParent()

finish

@Implementation
public void finish()

isFinishing

@Implementation
public boolean isFinishing()
Returns:
whether finish() was called

getWindow

@Implementation
public android.view.Window getWindow()
Constructs a new Window (a TestWindow) if no window has previously been set.

Returns:
the window associated with this Activity

onDestroy

@Implementation
public void onDestroy()
Checks to see if BroadcastListeners are still registered.

Throws:
java.lang.RuntimeException - if any listeners are still registered
See Also:
assertNoBroadcastListenersRegistered()

assertNoBroadcastListenersRegistered

public void assertNoBroadcastListenersRegistered()
Checks the ApplicationContext to see if BroadcastListeners are still registered.

Throws:
java.lang.RuntimeException - if any listeners are still registered
See Also:
ShadowApplication.assertNoBroadcastListenersRegistered(android.content.Context, String)

getContentView

public android.view.View getContentView()
Non-Android accessor.

Returns:
the contentView set by one of the setContentView() methods

getResultCode

public int getResultCode()
Non-Android accessor.

Returns:
the resultCode set by one of the setResult() methods

getResultIntent

public android.content.Intent getResultIntent()
Non-Android accessor.

Returns:
the Intent set by setResult(int, android.content.Intent)