-
-
Save codeforfun-jp/2d890c013b90ccb6731fc8f94bf54ef7 to your computer and use it in GitHub Desktop.
Android Studio Prevent Dialog From Closing 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
findViewById(R.id.btn).setOnClickListener(view -> { | |
DialogFragment dialogFragment = new MyDialogFragment(); | |
dialogFragment.setCancelable(false); | |
dialogFragment.show(getSupportFragmentManager(), "my_dialog"); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment