Skip to content

Commit 6198659

Browse files
committed
[app] Allow get CheckoutApplication from any Activity
1 parent 3c57339 commit 6198659

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/src/main/java/org/solovyev/android/checkout/app/CheckoutApplication.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.solovyev.android.checkout.Billing;
44

5+
import android.app.Activity;
56
import android.app.Application;
67

78
import javax.annotation.Nonnull;
@@ -27,6 +28,13 @@ public String getPublicKey() {
2728
}
2829
});
2930

31+
/**
32+
* Returns an instance of {@link CheckoutApplication} attached to the passed activity.
33+
*/
34+
public static CheckoutApplication get(Activity activity) {
35+
return (CheckoutApplication) activity.getApplication();
36+
}
37+
3038
@Nonnull
3139
public Billing getBilling() {
3240
return mBilling;

0 commit comments

Comments
 (0)