public class DisplayContext
extends java.lang.Object
Constructor and Description |
---|
DisplayContext(IResourceProvider resourceProvider,
android.content.Context context)
Creates a DisplayContext with an Android app context.
|
DisplayContext(IResourceProvider resourceProvider,
android.view.ViewGroup viewGroup)
Creates a DisplayContext with a view group.
|
Modifier and Type | Method and Description |
---|---|
void |
setCurrentActivity(android.app.Activity activity)
Sets the activity responsible for invoking the payment library.
|
public DisplayContext(IResourceProvider resourceProvider, android.content.Context context)
resourceProvider
- Resource provider, use ch.datatrans.payment.android.ResourceProvidercontext
- App context. If this is not the current Activity
, make sure to invoke
setCurrentActivity(Activity)
before starting the payment process.public DisplayContext(IResourceProvider resourceProvider, android.view.ViewGroup viewGroup)
resourceProvider
- Resource provider, use ch.datatrans.payment.android.ResourceProviderviewGroup
- View group to which view objects are added. If the view group's context
is not the current Activity
, make sure to invoke setCurrentActivity(Activity)
before starting the payment process.public void setCurrentActivity(android.app.Activity activity)
DisplayContext(IResourceProvider, Context)
) or the context of the view group
(DisplayContext(IResourceProvider, ViewGroup)
) is already an activity, this method does
not need to be invoked.
Otherwise, this setter is mandatory. The library will throw an exception if the activity cannot be determined when the payment process is started.
activity
- Invoking activity