I need to get the activity in order to request permissions
<p>I am using the "Digits" which is allows the user to login with their phone number. It is provided by Twitter. Anyhow, since I am developing for API level 23, I need to request permission to read contacts from the user. I am overriding the <code>onClick()</code> method that it supplies me in order to request permission during run-time. However, I do not know how to pass through an <code>Activity</code> for the constructor.</p>

<p>This is the class that I am instantiating with:</p>

<pre><code>public class DigitsRegisterButton extends DigitsAuthButton {

    final int loginPerm = 2;
    LoginActivity activity;

    public DigitsRegisterButton(Context c) {
        super(c);
        init();
    }
    public DigitsRegisterButton(Context c, AttributeSet attrs) {
        super(c, attrs);
        init();
    }

    public DigitsRegisterButton(Context c, AttributeSet attrs, int defStyle) {
        super(c, attrs, defStyle);
        init();
    }

    @Override
    public void onClick(View v) {
        int loginPermissionCheck = ContextCompat.checkSelfPermission(getContext(), Manifest.permission.CAMERA);
        if (loginPermissionCheck != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(/* Need Activity Here */, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, loginPerm);
        }
        super.onClick(v);
    }
}
</code></pre>

<p><code>onClick()</code> that gets Overridden in <code>DigitsAuthButton</code>:</p>

<pre><code>@Override
    public void onClick(View v) {
        final DigitsAuthConfig digitsAuthConfig = digitsAuthConfigBuilder.build();
        getDigitsClient().startSignUp(digitsAuthConfig);

        if (onClickListener != null) {
            onClickListener.onClick(v);
        }
    }
</code></pre>

<p>Activity Class:</p>

<pre><code>public class LoginActivity extends AppCompatActivity implements LocationListener {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_nav_bar);

        DigitsRegisterButton digitsButton = (DigitsRegisterButton) findViewById(R.id.account_auth_button);
        digitsButton.setCallback(new AuthCallback() {

            @Override
            public void success(DigitsSession session, String phoneNumber) {
                // TODO: associate the session userID with your user model
                //username phone number, password is auth session
                Toast.makeText(getApplicationContext(), "Authentication successful for " + phoneNumber, Toast.LENGTH_LONG).show();
                //new Login(getParentFragment(), )
            }

            @Override
            public void failure(DigitsException exception) {
                Log.d("Digits", "Sign in with Digits failure", exception);
            }
        });
    }
</code></pre>