tags:

views:

38

answers:

2

when we click the widget at that time i need to open a activity screen(or application).How to do this? Thanks in advance !!

+2  A: 

You need to set an onClickpendingIntent on your widget

Intent intent = new Intent(context, ExampleActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
// Get the layout for the App Widget and attach an on-click listener to the button
RemoteViews views = new RemoteViews(context.getPackageName(),R.layout.appwidget_provider_layout);
views.setOnClickPendingIntent(R.id.button, pendingIntent);

Check this out

http://advback.com/android/working-with-app-widgets-android/

http://stackoverflow.com/questions/2471875/processing-more-than-one-button-click-at-android-widget

Rahul
A: 

The Android developer pages for App Widgets has information and a full example doing exactly this: http://developer.android.com/guide/topics/appwidgets/index.html

totramon