Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the android studio instantly remove my copy & paste import statement

i've a project (blank activity) set up by android studio 0.8x, but when i paste (ctrl + v) some import statement like the following

import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.TransitionDrawable;
import android.os.Bundle;
import android.widget.ImageView;

the android studio will automatically rollback (ctrl + z) and only default import statement will stay, so i can't use any custom import statement now, what the matter is going on?

like image 629
hkguile Avatar asked Oct 01 '14 07:10

hkguile


Video Answer


1 Answers

You can control the behaviour in Settings, Editor, Auto-Import. It is the "optimize imports on the fly" setting

However, I would recommend to start writing your code, Android Studio will highlight the classes you have not yet imported and then you can add the necessary imports by simply typing Alt+Enter

like image 119
Anti Veeranna Avatar answered Oct 16 '22 18:10

Anti Veeranna