I think you are looking at this the wrong way round.
You are thinking [My Project] - starts -> [Activity] and [My Project] handles everything the activity does.
In fact because the OS (Android) can only run Activities (not your project classes independently) it should be [Activity] - starts -> [My Project Service] which handles messages from activity.
When the project is set up like this, you can display the layout normally (as with any Activity). Your existing project classes can still be the ones making all the decisions, it's just started in the opposite order.
This is the same concept used for any cross-platform apps (eg libgdx): The app is a native wrapper (Activity) that runs your common code.
Edit:
When you just want to trigger something in the Activity when a method is called in your own class, you can use a callback interface:
public interface OnConnectionMadeListener {
void onConnectionMade();
}
Your activity can implement it
public class MainActivity extends Activity implements OnConnectionMadeListener {
private View mOverlay;
public void onCreate() {
...
mOverlay = findViewById(R.id.overlay);
mOverlay.setVisibility(View.GONE);
new MyConnectionObject(this); //this will be your class that has the madeConnection() method
}
...
public void onConnectionMade() {
//show the overlay
mOverlay.setVisibility(View.VISIBLE);
}
}
Then inside your object
public class MyConnectionObject {
private OnConnectionMadeListener mCallback;
public MyConnectionObject(OnConnectionMadeListener callback) {
...
mCallback = callback;
}
public void madeConnection() {
...
if (mCallback != null) {
mCallback.onConnectionMade();
}
}
}