I'm trying to code a simple android app for something and I was wondering if there was an alternative to importing each class manually, or why it shows up as red since anytime I write something in a similar way it won't run. android studio screenshot
CodePudding user response:
To answer the first part: Yes there is a way to import classes manually. You could look through the code of the dependency and manually create the import statement. This is highly discouraged since it is tedious, time consuming and your IDE (IntelliJ IDEA in your case) is fully able to do this. But if you want to do it this way you can learn something about it here.
To your second part: It shows red because the classes don't exist or are not imported. As you know. To help more we will need the a screenshot of the error when you hover over the red text BUT if you think/know it is an import error you can try this:
Hover over the red text and click Import Class
if it shows up.
If it does not show up, it means it does not exist or an other error is present. Then we will need a screenshot of the error to help further.
Small hint (if you did not know already): When typing press ctrl
space
a windows will pop up with suggestions for autocompletion. Select your options with Enter
(or keep typing to get better suggestions). Move with arrows in the window. IntelliJ will then auto import the class.