Apps How to import the necessary components


Hello and thanks always for the help.

Right now I am following a tutorial (om android programming)
So for example, say I type something like this

private Button mybutton;

it can happen that the class "Button" is not imported so Android Studio marks it with red.
the tutorial says that to correct this I can point there with my cursor and type ALT+ENTER

well, I have a mac, so I tried basically Option +Enter...

it works sometimes..... and sometimes it doesnt. (Once it gave me some new element (GoogleApiClient) added by google or something)

Anyway. First question: How can you correct this so that the necessary import appears above in my code ?
import android.widget.Button;

Also Second Question and actually very basic and important one!

How do you "undo" things on Android studio. I mean there seems to be a "normal" undo and redo button on the menu but they don't undo things on my code!!! They actually -for example if I am in the java code switch to the XML screen or something like that. I can never "undo" if I say deleted a whole function by accident ot things like that. Any help greatly appreciated


Thread starter
I think I already solved the first question.

Put your cursor in the word (for example Button) then type Option+ enter. the key being put the cursor in the word.

But still puzzled by the second question: there is no undo in android studio! I have tried the undo button and it does not work