Reputation: 567
I am trying to create a pending inteent for NotificationManager. However I am getting below error "cannot resolve symbol PendingIntent"
My code is this
Intent mdi = new Intent(this, MonthlyDetailsActivity.class);
mdi.putExtra("month", Integer.parseInt(monthsIdVector.get(position)));
mdi.putExtra("year", Integer.parseInt(YearVector.get(position)));
PendingIntent viewPendingIntent =
PendingIntent.getActivity(this, 0, viewIntent, 0);
Upvotes: 0
Views: 4036
Reputation: 567
Yeah, somehow my Android studio didnt import it automatically ... I found a solution for that.
Go to File -> Settings -> Editor -> Auto Import -> Java
make the following changes:
change Insert imports on paste value to All from Drop Down menu
Add unambigious imports on the fly option as checked
Now, click on APPLY and OK to save changes.
This will auto import all the classes when you PASTE any code in editor.
Upvotes: 0
Reputation: 47817
import android.app.PendingIntent;
in your Activity
For more information go to PendingIntent
Upvotes: 9
Reputation: 4698
You have to import android.app.PendingIntent class in your code. If you are using Eclipse IDE then just use Ctrl+Shift+O shortcut to manage all imports.
Upvotes: 0