Hello, first post here. I'm working on integrating Twitter authentication into my Android app and the login button isn't doing anything

android
login
firebase

#1
public class LoginActivity extends Activity{

    private TwitterLoginButton loginButton;
    private FirebaseAuth firebaseAuth;
    private ProgressDialog progressDialog;
    private Button login2;
    private static final String TAG = "LoginActivity.class";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        TwitterConfig config = new TwitterConfig.Builder(this)
                .logger(new DefaultLogger(Log.DEBUG))
                .twitterAuthConfig(new TwitterAuthConfig("CONSUMER_KEY", "CONSUMER_SECRET"))
                .debug(true)
                .build();
        Twitter.initialize(config);

        loginButton = (TwitterLoginButton) findViewById(R.id.login_button);
        loginButton.setCallback(new Callback<TwitterSession>() {
            @Override
            public void success(Result<TwitterSession> result) {


                progressDialog = new ProgressDialog(LoginActivity.this);
                progressDialog.setMessage("Logging you in");
                progressDialog.show();
                handleTwitterSession(result.data);
            }

            @Override
            public void failure(TwitterException exception) {
                // Do something on failure

                System.out.println("failed for some reason");
            }
        });



        firebaseAuth = FirebaseAuth.getInstance();

        if(firebaseAuth.getCurrentUser() != null){
            finish();
            startActivity(new Intent(getApplicationContext(), MainActivity.class));
        }

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        loginButton.onActivityResult(requestCode, resultCode, data);
    }

    private void handleTwitterSession(TwitterSession session) {
        Log.d(TAG, "handleTwitterSession:" + session);

        AuthCredential credential = TwitterAuthProvider.getCredential(
                session.getAuthToken().token,
                session.getAuthToken().secret);


        firebaseAuth.signInWithCredential(credential)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        if (task.isSuccessful()) {
                            Log.d(TAG, "signInWithCredential:success");
                            FirebaseUser user = firebaseAuth.getCurrentUser();
                            checkUserAndStart(user);
                        } else {
                            Log.w(TAG, "signInWithCredential:failure", task.getException());
                            Toast.makeText(LoginActivity.this, "Authentication failed.",
                                    Toast.LENGTH_SHORT).show();
                        }

                   
                    }
                });
    }

    private void checkUserAndStart(FirebaseUser user){
        DatabaseReference db = FirebaseDatabase.getInstance().getReference().child("users").child(user.getUid()).child("bio");
        db.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                if (dataSnapshot.exists()){
                    progressDialog.dismiss();
                    finish();
                    startActivity(new Intent(getApplicationContext(), MainActivity.class));
                }else{
                    finish();
                    progressDialog.dismiss();
                    startActivity(new Intent(getApplicationContext(), CreateProfileActivity.class));
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });
    }

}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_login"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/baseColor"
    android:gravity="center"
    tools:context="com.morticia.android.pop.activities.LoginActivity">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"

            android:padding ="16dp"
            android:layout_gravity="center"
            android:weightSum="2">


            <Button
                android:id="@+id/button2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Login Two" />

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="70dp"
                android:src="@drawable/maincircmdpi"
                android:id="@+id/imageView4" />



            <com.twitter.sdk.android.core.identity.TwitterLoginButton
                android:id="@+id/login_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"

                android:layout_gravity="center_horizontal" />

        </LinearLayout>
    </ScrollView>
</RelativeLayout>

Anybody have an idea what the issue might be? The actual login button itself isn’t doing anything really, no sound, nothing. Is there anything that I should put in my manifest? I have an updated key and secret. Any insights would be greatly appreciated.

Thanks
-T

Edit: Rookie move, I forgot to add

Twitter.initialize(this);

#2

Hi,

Please, where do you need to add “Twitter.initialize(this)”?

I have the same issue,

Thanks in advance,
Pietro