Skip to content

Instantly share code, notes, and snippets.

@goodmorningcody
Created August 5, 2019 05:59
Show Gist options
  • Save goodmorningcody/4da74a3372029d170cbf4596613f999a to your computer and use it in GitHub Desktop.
Save goodmorningcody/4da74a3372029d170cbf4596613f999a to your computer and use it in GitHub Desktop.
Inherited from UnityPlayerActivity to extend Android Platform.
package com.kakaogames.android;
import android.os.Bundle;
import android.app.AlertDialog;
import android.content.DialogInterface;
import com.unity3d.player.UnityPlayerActivity;
public class MyUnityPlayerActivity extends UnityPlayerActivity
{
@Override protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
@Override protected void onStart()
{
super.onStart();
showTestDialog();
}
//test code
private void showTestDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("This is a test")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment