如何在其他活动中调用一个活动? [英] How to call a activity in other activity?

查看:80
本文介绍了如何在其他活动中调用一个活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我想编写一个创建多个活动的应用程序.换句话说,当单击每个激活了子应用程序的图标调用时(例如,调用我的画廊或我的提醒),会有一个菜单应用程序.

我不知道如何调用子活动(或子应用程序).我应该使用意图吗?还是有其他方法?

谢谢

Hi to all
I want to write a App that created multi activities. in other words, there is a menu App when click on every icon call active a sub application(for example call a my gallery or my reminder).

I don''t know how to call sub activities (or sub application). Do I should use intent? or there are other ways?

thank you

推荐答案

意图将是调用它们的最佳方法!
intent would be the best way to call them!!


使用显式或隐式意图.视情况而定.

use explicit or implicit intent. depends on situation.

public class MyActivity extends Activity
{
.... onCreate(....)
{
Intent intent = new Intent(MyActivity.this,CalledActivity.class);
//after that start the intent ... u can get exact syntax from developer.android.com
startActivity(intent);
}

}


这篇关于如何在其他活动中调用一个活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆