How to use an accountpicker?
<p>I've copied code from here <a href="https://developers.google.com/android/reference/com/google/android/gms/common/AccountPicker#public-methods" rel="nofollow">https://developers.google.com/android/reference/com/google/android/gms/common/AccountPicker#public-methods</a> and then I've done what is said here <a href="https://developers.google.com/android/guides/setup#ensure" rel="nofollow">https://developers.google.com/android/guides/setup#ensure</a> . </p>

<p>Why I have an error when call AccountPicker? How to fix it?</p>

<p>My code:</p>

<pre><code>public class HButtonActivity extends Activity {
    String accountName;
    int ACCOUNT_PICKER_REQ_CODE = 184567;
    @SuppressWarnings("deprecation")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Intent intent = AccountPicker.newChooseAccountIntent(null, null, new String[]{"com.google"},
                false, null, null, null, null);
        startActivityForResult(intent, ACCOUNT_PICKER_REQ_CODE);
    }
    public void NewButtonClicked(View arg){
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == ACCOUNT_PICKER_REQ_CODE &amp;&amp; resultCode == RESULT_OK) {
            accountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
            Log.i("Point",accountName);
        }
    }
}
</code></pre>

<p>When I run this I have these errors:</p>

<pre><code>5848-5848/com.example.amadey.myapplication3 E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.amadey.myapplication3, PID: 5848
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.amadey.myapplication3/com.example.amadey.myapplication3.HButtonActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.android.gms.common.account.CHOOSE_ACCOUNT pkg=com.google.android.gms (has extras) }
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5001)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.android.gms.common.account.CHOOSE_ACCOUNT pkg=com.google.android.gms (has extras) }
            at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
            at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
            at android.app.Activity.startActivityForResult(Activity.java:3424)
            at android.app.Activity.startActivityForResult(Activity.java:3385)
            at com.example.amadey.myapplication3.HButtonActivity.onCreate(HButtonActivity.java:62)
            at android.app.Activity.performCreate(Activity.java:5231)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5001)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
</code></pre>