Reputation: 1751
I want to do some calculating after touch-Event on my widget. Is there a possibility to do this without starting an activity? My problem is that i have to register an onClickPendingIntent to the touch-action....
There is an annoying visual response with my solution: screen flashes to black and reappears to homescreen.
this is in the widget-provider:
Intent doit_intent = new Intent(context, DoItActivity.class);
PendingIntent pendingIntent =
PendingIntent.getActivity(context,0, doit_intent, 0);
remoteView.setOnClickPendingIntent(R.id.main_widget, pendingIntent);
DoItActivity.class
public class DoItActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//do some static function calls
finish();
}
}
Upvotes: 0
Views: 803
Reputation: 1007266
Use a PendingIntent
that does not start an activity, then. Use getService()
or getBroadcast()
instead of getActivity()
.
Upvotes: 2