当前位置:网站首页>Activity jump encapsulation
Activity jump encapsulation
2022-07-05 10:16:00 【asahi_ xin】
public class ActivityManager {
/** * activity Jump without parameters * * @param context Context * @param cls The goal is */
public static void goActivity(Context context, Class<? extends Activity> cls) {
startActivity(context, cls, null, -1, -1);
}
/** * activity Jump band parameters * * @param context Context * @param cls The goal is * @param bundle Parameters */
public static void goActivity(Context context, Class<? extends Activity> cls, Bundle bundle) {
startActivity(context, cls, bundle, -1, -1);
}
/** * activity Jump callback without parameters * * @param context Context * @param cls The goal is * @param requestCode Request code */
public static void goActivityForResult(Context context, Class<? extends Activity> cls, int requestCode) {
startActivity(context, cls, null, requestCode, -1);
}
/** * activity Jump callback with parameters * * @param context Context * @param cls The goal is * @param bundle Parameters * @param requestCode Request code */
public static void goActivityForResult(Context context, Class<? extends Activity> cls, Bundle bundle, int requestCode) {
startActivity(context, cls, bundle, requestCode, -1);
}
/** * activity Callback * * @param context Context * @param bundle Parameters * @param resultCode Result code */
public static void comeActivitySetResult(Context context, Bundle bundle, int resultCode) {
startActivity(context, null, bundle, -1, resultCode);
}
private static void startActivity(Context context, Class<? extends Activity> cls, Bundle bundle, int requestCode, int resultCode) {
Intent intent;
if (null != cls) {
intent = new Intent(context, cls);
} else {
intent = new Intent();
}
if (null != bundle) {
intent.putExtras(bundle);
}
if (-1 != resultCode) {
((Activity) context).setResult(resultCode, intent);
} else {
if (-1 != requestCode) {
((Activity) context).startActivityForResult(intent, requestCode);
} else {
context.startActivity(intent);
}
}
}
}
边栏推荐
- Swift tableview style (I) system basic
- A large number of virtual anchors in station B were collectively forced to refund: revenue evaporated, but they still owe station B; Jobs was posthumously awarded the U.S. presidential medal of freedo
- Six simple cases of QT
- C#函数返回多个值方法
- The most complete is an I2C summary
- AtCoder Beginner Contest 258「ABCDEFG」
- 高级 OpenCV:BGR 像素强度图
- TypeError: Cannot read properties of undefined (reading ‘cancelToken‘)
- . Net delay queue
- Unity粒子特效系列-毒液喷射预制体做好了,unitypackage包直接用 -下
猜你喜欢
Getting started with Apache dolphin scheduler (one article is enough)
《天天数学》连载58:二月二十七日
@Serializedname annotation use
Node red series (29): use slider and chart nodes to realize double broken line time series diagram
[论文阅读] KGAT: Knowledge Graph Attention Network for Recommendation
自动化规范检查软件如何发展而来?
Advanced opencv:bgr pixel intensity map
程序员搞开源,读什么书最合适?
双容水箱液位模糊PID控制系统设计与仿真(Matlab/Simulink)
最全是一次I2C总结
随机推荐
How to get the STW (pause) time of GC (garbage collector)?
mongoDB副本集
Hard core, have you ever seen robots play "escape from the secret room"? (code attached)
@JsonAdapter注解使用
Getting started with Apache dolphin scheduler (one article is enough)
[论文阅读] KGAT: Knowledge Graph Attention Network for Recommendation
如何獲取GC(垃圾回收器)的STW(暫停)時間?
报错:Module not found: Error: Can‘t resolve ‘XXX‘ in ‘XXXX‘
@SerializedName注解使用
[200 opencv routines] 219 Add digital watermark (blind watermark)
Glide advanced level
View Slide
Mysql80 service does not start
基于单片机步进电机控制器设计(正转反转指示灯挡位)
Energy momentum: how to achieve carbon neutralization in the power industry?
pytorch输出tensor张量时有省略号的解决方案(将tensor完整输出)
Unity particle special effects series - the poison spray preform is ready, and the unitypackage package is directly used - on
(1) Complete the new construction of station in Niagara vykon N4 supervisor 4.8 software
Windows uses commands to run kotlin
微信小程序中,从一个页面跳转到另一个页面后,在返回后发现页面同步滚动了