Android Studio: Text cursor disappears/gone after open some other class or pasting text in different classes

12,653

Solution 1

command + O
type some words
esc

cursor appear, works for me

Solution 2

Just update the date time to proper date time.

Permanent workaround: 1

After studying a lot, I found that my system time was incorrect. (On my pc, it was because of windows time service error and not because of CMOS battery. while in some cases CMOS battery may cause this.).

  1. Just update correct the date/time and the cursor will be visible.
  2. If it is still not, close android studio, update correct and start android studio again.

Permanent workaround: 2

Reinstall windows and immediately install antivirus before installing any other software. (Mome malware can affect the working of time service in PC.). (Those who keep antivirus setup file/s on PC itself or USB device, they must check out whether the setup is clear in itself.).

Workaround: 3

On the left pane in android studio, strangely, all my classes were shown as singleton while they weren't.

  1. I pressed multiple combinations multiple times of alter / shift / ctrl / mouse clicks to to check whether any key is stuck (which seldom happens).

  2. I put Android Studio into power save mode: android studio -> file -> power save mode and tried to work again.

  3. I corrected my system date (it was 2 days behind than current.)

  4. Restarted the PC. The issue is resolved.

  5. Disabled power save mode.

Temporary solution:

No need to close project or android studio.

Click on the scroll button on the right of the editing pane or on suggestions yellow lines somewhere else on the same vertical scroll bar line.

enter image description here

Solution 3

I have same problem too but I solved with this trick..

Go to File-> Invalidate Caches / Restart

Now cursor should appear..

Solution 4

Go back and check again.. You might find cursor there..

I am using 3.1.2 of AS on Mac. I faced the same problem after pasting multiple classes in AS. While cursor was gone I was able to make text selection. I checked StackOverflow for the solution and reached this question. After reading a couple of answers I went back to AS workspace and cursor was there...

Solution 5

In Android Studio 4.2 this issue still exists. I've deleted the settings file of the android studio folder by folder to find out which file is causing the error. In windows If you navigate to

C:\Users\{User}\AppData\Roaming\Google\AndroidStudio4.2\options

enter image description here

you will see an other.xml file. You can delete this file. This might fix the issue (at least it fixes it in my case). You can also comment out or delete this line in the other.xml file to fix the issue

<property name="Source Code Editor With PreviewLayout" value="Preview only" />

enter image description here

Share:
12,653
Amandeep Rohila
Author by

Amandeep Rohila

An engineer by education and developer by professional. Always passionate to learn new things..:). I love to write simplified code and I believe to write code as reusable as possible. It might be possible that sometimes I don't know something technical but trust me, I known how to find the solution and then use it.

Updated on June 24, 2022

Comments

  • Amandeep Rohila
    Amandeep Rohila almost 2 years

    Android Studio: Text cursor disappears/gone after open some other class or pasting text in different classes. Cursor is randomly disappear while coding in Android Studio. Currently using version 1.5.1 Some time cursor is only visible in one file either in java or xml Right click is working but cursor is not visible in java/ or xml file so I am not able to type the code.

    Observed scenario The text cursor is not visible or the cursor is gone when I open a different file (e.g. ApplicationTest.java instead of activity_main.xml) the cursor appears again.

    Expected scenario: The text cursor should be located after the insertion point.

    Action taken to solved I used synchronize, restart Android Studio….. but not able to get solution. I am using window 7 and I have cleared temp

    R&D https://code.google.com/p/android/issues/detail?id=78384

    I stuck to this problem so please help me. Appreciate, if anyone can help to troubleshoot.