I'm developing an Android app and I'm a little bit confused why my Toast is not shown in my app.
The toast is not located in an Activity. Therefore, this is my solution. In the MainActivity:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_startup);
    // Init context
    InstanceHandler.setContextOfMainActivity(this);
}
In the class InstanceHandler:
private Activity mActivity;
public Context mContext;
public void setContextOfMainActivity(Activity activity) {
    mActivity = activity;
    mContext = activity.getApplicationContext();
}
and in the affected class Connection.java (NOT extends Activity) I'm calling the toast:
public class Connection{
    public void test(){
        Toast.makeText(InstanceHandler.mContext, "This is a test", Toast.LENGTH_SHORT).show();
    }
}
But nothing happens. The app aborts the following code after the Toast.
                        
Use Just This Over There
Use That Class Like This