Why is does this Toast(Android Studio) works only at the second click

ANDDEV

I have made a EditText clickable, and I in the Java class I made this private void:

private void incaseofclick() {
            EditText Ct=(EditText) findViewById(R.id.CODIGOnumero);//The EditText
            Ct.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(getApplicationContext(),R.string.INDICA3, Toast.LENGTH_LONG).show();//
                }
            });
    }

... The problem is that, in the emulator, I have to press twice(EditText) for the toast to work, I want to know why, and how to fix it... Summarized: What I want is to press it once and the toast and the keyboard(Not a problem) to appear .

Bene

Why don't you do it just like this?

private void incaseofclick() {

       Toast.makeText(getApplicationContext(),R.string.INDICA3, Toast.LENGTH_LONG).show();
}

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

ajax jquery + bootstrap modal only works on second click

분류에서Dev

Why does synchronized(this) works?

분류에서Dev

Why does the first assert work, but not the second?

분류에서Dev

img onclick fire js function only second click

분류에서Dev

Why jsoup works differently between android studio and java netbeans?

분류에서Dev

Why does the following code only work with GridLayout?

분류에서Dev

Javascript does't work at first but works on second, third, etc. times

분류에서Dev

Javascript does't work at first but works on second, third, etc. times

분류에서Dev

Reverse animation on a second click

분류에서Dev

Why does this jQuery .change event stop working after .click event

분류에서Dev

AVPlayerItemDidPlayToEndTimeNotification only works if forced

분류에서Dev

Does a 1 second datastore transaction limit applies only on a while group entity?

분류에서Dev

on second click remove text from button click

분류에서Dev

C++ probability calculating program works when bookmarked in Visual Studio but does not work when run without a bookmark

분류에서Dev

Why does Ubuntu only show 3GB of RAM?

분류에서Dev

Why does std::min only support initializer_list?

분류에서Dev

Why does my MFMailComposeViewController instance only dismiss one time?

분류에서Dev

Why does Ubuntu 12.10 only see 8 cores?

분류에서Dev

Why does sub replace only one character with a regex?

분류에서Dev

Why does Tk().after only execute once and how to fix it?

분류에서Dev

Why does Python logging only hide stdout if the handler is added first?

분류에서Dev

Why does initramfs mount the root filesystem read-only

분류에서Dev

Why does a certain if statement only trigger once in a while loop?

분류에서Dev

Why does sed only work on direct output from echo?

분류에서Dev

Why does didUpdateLocations: only have one location after locationManagerDidResumeLocationUpdates:

분류에서Dev

Why does the cat command only read from the first file descriptor?

분류에서Dev

Why does Visual Studio ask for cs-files when debugging?

분류에서Dev

Why does the first one work and the second one not work? Global and Private variable declaration

분류에서Dev

Why does my import statement have a syntax error in Deno but works ok in Nodejs?

Related 관련 기사

  1. 1

    ajax jquery + bootstrap modal only works on second click

  2. 2

    Why does synchronized(this) works?

  3. 3

    Why does the first assert work, but not the second?

  4. 4

    img onclick fire js function only second click

  5. 5

    Why jsoup works differently between android studio and java netbeans?

  6. 6

    Why does the following code only work with GridLayout?

  7. 7

    Javascript does't work at first but works on second, third, etc. times

  8. 8

    Javascript does't work at first but works on second, third, etc. times

  9. 9

    Reverse animation on a second click

  10. 10

    Why does this jQuery .change event stop working after .click event

  11. 11

    AVPlayerItemDidPlayToEndTimeNotification only works if forced

  12. 12

    Does a 1 second datastore transaction limit applies only on a while group entity?

  13. 13

    on second click remove text from button click

  14. 14

    C++ probability calculating program works when bookmarked in Visual Studio but does not work when run without a bookmark

  15. 15

    Why does Ubuntu only show 3GB of RAM?

  16. 16

    Why does std::min only support initializer_list?

  17. 17

    Why does my MFMailComposeViewController instance only dismiss one time?

  18. 18

    Why does Ubuntu 12.10 only see 8 cores?

  19. 19

    Why does sub replace only one character with a regex?

  20. 20

    Why does Tk().after only execute once and how to fix it?

  21. 21

    Why does Python logging only hide stdout if the handler is added first?

  22. 22

    Why does initramfs mount the root filesystem read-only

  23. 23

    Why does a certain if statement only trigger once in a while loop?

  24. 24

    Why does sed only work on direct output from echo?

  25. 25

    Why does didUpdateLocations: only have one location after locationManagerDidResumeLocationUpdates:

  26. 26

    Why does the cat command only read from the first file descriptor?

  27. 27

    Why does Visual Studio ask for cs-files when debugging?

  28. 28

    Why does the first one work and the second one not work? Global and Private variable declaration

  29. 29

    Why does my import statement have a syntax error in Deno but works ok in Nodejs?

뜨겁다태그

보관