当前位置:网站首页>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);
}
}
}
}
边栏推荐
- Unity particle special effects series - the poison spray preform is ready, and the unitypackage package is directly used - on
- Using directive in angualr2 to realize that the picture size changes with the window size
- Apache dolphin scheduler system architecture design
- > Could not create task ‘:app:MyTest.main()‘. > SourceSet with name ‘main‘ not found.问题修复
- QT event filter simple case
- ConstraintLayout的流式布局Flow
- 请问大佬们 有遇到过flink cdc mongdb 执行flinksql 遇到这样的问题的么?
- Cut off 20% of Imagenet data volume, and the performance of the model will not decline! Meta Stanford et al. Proposed a new method, using knowledge distillation to slim down the data set
- Click the picture in the mobile browser and the picture will not pop up
- Pagoda panel MySQL cannot be started
猜你喜欢

硬核,你见过机器人玩“密室逃脱”吗?(附代码)

mysql80服务不启动
![[NTIRE 2022]Residual Local Feature Network for Efficient Super-Resolution](/img/f3/782246100bca3517d95869be80d9c5.png)
[NTIRE 2022]Residual Local Feature Network for Efficient Super-Resolution

驱动制造业产业升级新思路的领域知识网络,什么来头?

【系统设计】指标监控和告警系统

Single chip microcomputer principle and Interface Technology (esp8266/esp32) machine human draft

A high density 256 channel electrode cap for dry EEG

《天天数学》连载58:二月二十七日

Fluent generates icon prompt logo widget

Meitu lost 300 million yuan in currency speculation for half a year. Huawei was exposed to expand its enrollment in Russia. Alphago's peers have made another breakthrough in chess. Today, more big new
随机推荐
自动化规范检查软件如何发展而来?
Have you learned to make money in Dingding, enterprise micro and Feishu?
程序员搞开源,读什么书最合适?
php解决redis的缓存雪崩,缓存穿透,缓存击穿的问题
isEmpty 和 isBlank 的用法区别
[C language] the use of dynamic memory development "malloc"
@Jsonadapter annotation usage
.Net之延迟队列
Z-blog template installation and use tutorial
宝塔面板MySQL无法启动
The comparison of every() and some() in JS uses a power storage plan
> Could not create task ‘:app:MyTest.main()‘. > SourceSet with name ‘main‘ not found.问题修复
QT realizes signal transmission and reception between two windows
伪类元素--before和after
Fluent generates icon prompt logo widget
Constrained layout flow
Design and Simulation of fuzzy PID control system for liquid level of double tank (matlab/simulink)
Wechat applet - simple diet recommendation (2)
程序员如何活成自己喜欢的模样?
StaticLayout的使用详解