I have an onClick event in my android app that triggers the following code but it keeps crashing my app. I put it in a thread only because i read that that's supposed to prevent crashing. Also ctx refers to the Activity's context (it's a variable I created in the activity set equal to this. I've read and tried several things. Any help would be awesome. Thanks!
Thread toastThread = new Thread() {
public void run() {
Toast alertFailure = Toast.makeText(ctx, "Login Failed", Toast.LENGTH_LONG);
alertFailure.show();
}
};
toastThread.start();