So im trying to start an activity by pressing a widget. I keep running into the error \"The method startActivity(Intent) is undefined for the type Photos\" any help is much
You need to implement the onUpdate() and onReceive() methods in your AppWidgetProvider class, something like this:
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
final int N = appWidgetIds.length;
for (int i=0; i
Then write your onReceive() method to receive the pending intent and start the relevant activity:
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
if (intent.getAction().equals("PhotosAction") {
//Received photos action action, start your target activity
Intent i = new Intent(android.provider.Settings.ACTION_SETTINGS);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}