I am trying to develop in android-studio on MAC and I am coming across a weird problem. Within the activity code I can not refer to an image which lies in the mipmap folder. In particular I am have created a notification as:
...
Notification notify = new NotificationCompat.Builder(this)
.setContentTitle(title)
.setContentText(body)
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(startPendingIntent)
.build();
...
and I receive the error "cannot resolve symbol ic_launcher". Strange is also the problem, that I can not copy-paste the icons into the drawable folder which is empty. Where and how should I place the icons in order to visible within the code in android studio?
Drag and drop your images directly onto the Resource Manager window in Android Studio. Alternatively, you can click the plus icon (+), choose Import Drawables, as shown in figure 3, and then select the files and folders that you want to import. Figure 3: Select Import Drawables from the dropdown menu.
A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with APIs such as getDrawable(int) or apply to another XML resource with attributes such as android:drawable and android:icon . There are several different types of drawables: Bitmap File.
You need to access the drawable using R.mipmap.ic_launcher
Close Android Studio, then open up finder. Go to the project directory. Go navigate to your project's mipmap folder. Copy the images, then go to the drawable folder and paste the images in their respective resolution folders. Open up android studio again and they should be in the drawable folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With