开发者

how to make this appear on the screen class it is called from and not on a new screen

I have this code and would like it to appear on the page of the class it's called from and not always creates a new empty black page.

public class AlertAndCallUtility extends Activity{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AlertDialog alertDialog = new AlertDialog.Builder(AlertAndCallUtility.this).create();
        alertDialog.setTitle("Reset...");
        alertDialog.setMessage("R u sure?");
        alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {

                Intent intent = new Intent();
                intent.setAction(Intent.ACTION_CALL);
                String phoneNumber = "0123456";

                intent.setData(Uri.parse("tel:" + Uri.encode(phoneNumber)));

     开发者_C百科           startActivity(intent);

          } }); 
        alertDialog.setIcon(R.drawable.icon);
        alertDialog.show();


    }

What do I need to change?

Many thanks


I checked your code and your dialog is showing with black screen in the background. I guess you want to remove this black screen in the background if I am wrong let me know.

To remove the black screen from the background of the alert dialog, in your activity tag in the manifest file add this:

android:theme="@android:style/Theme.NoDisplay"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜