编程方式启动“添加帐户”活动的Andr​​oid 2.2 [英] Programatically starting the 'Add Account' activity in Android 2.2

查看:99
本文介绍了编程方式启动“添加帐户”活动的Andr​​oid 2.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试了Android SDK,在过去的几天里,在准备写一个应用程序的商店,但是我已经跨越有点问题的运行。

I've been experimenting with the Android SDK over the past few days, in readiness to write an App for the store, however I've run across a bit of a problem.

应用程序我会写要求用户与手机相关的谷歌帐户。在检索和利用该身份验证令牌等是不是一个问题,但是我希望能够证明该活动的用户将达到正常通过进入通过菜单设置 - > Accounts->添加帐户。

The App I'll be writing requires that the user has a Google account associated with the phone. Retreiving and making use of the Auth token etc was not a problem, however I would like to be able to show the activity that a user would normal reach by going through the menus Settings->Accounts->Add Account.

现在通过实验我已经能够使用下面的命令来启动从shell这项活动。

Now through experimentation I've been able to launch this activity from the shell using the following command.

am start -n com.google.android.gsf/.login.AccountIntroActivity

我有使用意向级的表演在JAVA中同样的动作的麻烦。

I'm having trouble performing the same action in JAVA using the Intent class.

会有人能告诉我先不管这可以通过JAVA来实现,其次我怎么能去了解它吗?

Would anyone be able to tell me firstly whether or not this can be done via JAVA, and secondly how I could go about it please?

如果我不得不接受的同步设置屏幕,然后我会(这可以通过Settings.ACTION_SYNC_SETTINGS意图实现的),但它会是相当不错的,能够给用户直接引导到需要的画面。

If I have to settle for the Sync Settings screen then I will (this can be achieved through the Settings.ACTION_SYNC_SETTINGS intent), however it'd be quite nice to be able to direct the user straight to the required screen.

推荐答案

退房的<一个href="http://developer.android.com/intl/de/reference/android/provider/Settings.html#ACTION_ADD_ACCOUNT">ACTION_ADD_ACCOUNT

startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT));

这篇关于编程方式启动“添加帐户”活动的Andr​​oid 2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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