jeudi 5 novembre 2015

PerformClick does not work correctly

Vote count: 0

I am trying to make a dialog like a tooltip using EasyDialog.

When I show this dialog open with clicking button, everything works fine.

But the problem is when I want to show this dialog at start of the activity.

I tried to show dialog by using button.performClick(). I put toast to make sure that the onClickListener is calling. The result was that, The toast are shoeing normally but the dialog does not.

When I debug the program, I see that these lines of code are executing but I can't understand why the dialog does not display.

Note that the library I use to show the dialog is Here.

Here is the code :

    btnBottomLeft = (Button) findViewById(R.id.btnBottomLeft);
    btnBottomLeft.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(this, "HERE", Toast.LENGTH_LONG).show();
            new EasyDialog(MainActivity.this)
                    .setLayoutResourceId(R.layout.layout_tip_image_text)
                    .setBackgroundColor(MainActivity.this.getResources().getColor(R.color.background_color_yellow))
                    .setLocationByAttachedView(btnBottomRight)
                    .setGravity(EasyDialog.GRAVITY_TOP)
                    .setAnimationTranslationShow(EasyDialog.DIRECTION_X, 300, 400, 0)
                    .setAnimationTranslationShow(EasyDialog.DIRECTION_Y, 300, 400, 0)
                    .setAnimationTranslationDismiss(EasyDialog.DIRECTION_X, 300, 0, 400)
                    .setAnimationTranslationDismiss(EasyDialog.DIRECTION_Y, 300, 0, 400)
                    .setTouchOutsideDismiss(true)
                    .setMatchParent(true)
                    .setMarginLeftAndRight(24, 24)
                    .setOutsideColor(MainActivity.this.getResources().getColor(R.color.outside_color_trans))
                    .show();
        }
    });
    btnBottomLeft.performClick();

So, problem is that, the dialog opens correctly by clicking button.

but btnBottomLeft.performClick() just show the toast, not the dialog.

What should I do to make dialog open??

Can anyoe please help me?? Thanks in advance

asked 3 mins ago
TTS
6

This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at http://ift.tt/jcXqJW.



PerformClick does not work correctly

Aucun commentaire:

Enregistrer un commentaire