Adding ZenKey Button to Android

To use the ZenKey button, add the following to your XML layout:

         <com.xci.zenkey.sdk.widget.ZenKeyButton
             android:id="@+id/zenKeyButton"
             android:layout_width="match_parent" 
             android:layout_height="wrap_content"/>

When using the ZenKey Button inside a fragment, set the fragment on the ZenKeyButton in order to receive the result inside the fragment’s onActivityResult() method. Otherwise, the result will be received in the onActivityResult() method of the host activity.

public class MyFragment extends Fragment {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.my_layout);
        findViewById(R.id.myZenKeyButton).setFragment(this);
    }
}

📘

Additional Button Options

To learn more about button variations, view adding the ZenKey button to an Android project.


Did this page help you?