I'm building a simple Android application from scratch where I'm trying to show a grid view on my landing page. For that I imported a package in my MainActivity.java file as shown below:
import android.widget; When I perform Build -> Make project action I get following error:
Error:(15, 15) error: cannot find symbol class widget
Not sure why compiler is treating android.widget as a class name when it is effectively a namespace/package. I'm from a C# background completely new to java and android. I searched a bit and I get that I should be adding a reference to a jar file which is equivalent to adding a reference to a .Net assembly in C#. I'm not sure about which jar file I'm missing and how to add its reference in Android Studio. Kindly help.
import android.widget.*;?import android.widget;to do?import android.widget;statement should import all the classes present insideimport android.widgetpackage. I wanted to useGridViewclass (which is found insideandroid.widgetpackage) in myMainActivity.javafile. If I don't use the import statement then possibly I'll have to use fully qualified type names which will look verbose.