public class MyWidgetProvider extends AppWidgetProvider {
.....
}
public void onEnabled (Context contex){
Intent myIntent = new Intent(context, ReadName.class);
context.startActivity(myIntent);
}
well, I tried just system.out.println(” “) it works, means it is showing on LogCat, but is it possible to open a new activity from this method onEnabled (Context contex) Thanks
I am trying this way but it is not showing :s me a new activity onload widget,
public void onEnabled (Context contex){
System.out.println("new task flag");
Intent i = new Intent(contex, ReadName.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
contex.startActivity(i);
}
It should work. Also give a try by setting the flag to FLAG_ACTIVITY_NEW_TASK.
Link to this documentation is here.