开发者

Starting an activity from a random class

I've adapted the GridInputProcessor class of the 3D-Gallery (https://android.googlesource.com/platform/packages/apps/Gallery3D/+/master/src/com/cooliris/media/GridInputProcessor.j开发者_高级运维ava ) so that it detects upward/downward swipes.

The detection of swipes works, but I now want to start another activity (or draw a bitmap on the currently displayed activity), but I seemingly can't use startActivity(mContext, myIntent), because the class declaration is public final class GridInputProcessor implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener { so it doesn't extend Activity...

Can I still start an Activity through this class, or how would I go about doing this? I have also tried sending a broadcast, but this is also not "implemented".


I went with re-using the context of an activity that I know is running at the time of the swipe (where the actual swipe occurs) via:

theOtherActivitysContext.startActivity(...)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜