Re: [android-developers] handing event of two button in widget

2010-11-29 Thread andy zhao
Can you send your detailed error log for analysis?  Cause it's difficult to
track the issue.


Br
Andy


2010/11/29 Honest honestsucc...@gmail.com

 hello,

 i have developed simple widget which display images from sd card. I
 have two button(for setting and open)  on center frame. Now i am
 calling Activity Class to display User Interface for setting and
 display Image in big view. But i am getting RunTimeException if i try
 to use PendingIntent for both button. if i set pendingIntent for one
 Button then it is working fine.  The following is my code snippet.
  hope to hear soon from you.


  Intent configIntent  = new Intent(context,
 ImagesWidgetConfiguration.class);
  configIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
 appWidgetId);
  //To specify open image action
  configIntent.putExtra(action, open);
  // gotta make this unique for this appwidgetid

 configIntent.setData(Uri.withAppendedPath(Uri.parse(URI_SCHEME + ://
 widget/id/), String.valueOf(appWidgetId)));

  PendingIntent pendingIntent1 =
 PendingIntent.getActivity(context, 0, configIntent,
 PendingIntent.FLAG_UPDATE_CURRENT);
  remoteView.setOnClickPendingIntent(R.id.play_pause,
 pendingIntent1);



 // For SecondButton
  //remoteView = new RemoteViews(context.getPackageName(),
 R.layout.main);
  Intent updateIntent=new
 Intent(context,ImagesWidgetConfiguration.class);
  updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
 appWidgetId);

  updateIntent.putExtra(action, setting);


 updateIntent.setData(Uri.withAppendedPath(Uri.parse(URI_SCHEME + ://
 widget/id/), String.valueOf(appWidgetId)));

   PendingIntent pendingIntent =
 PendingIntent.getActivity(context, 0, updateIntent,
 PendingIntent.FLAG_UPDATE_CURRENT);
  remoteView.setOnClickPendingIntent(R.id.next,
 pendingIntent);






 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] handing event of two button in widget

2010-11-28 Thread Honest
hello,

i have developed simple widget which display images from sd card. I
have two button(for setting and open)  on center frame. Now i am
calling Activity Class to display User Interface for setting and
display Image in big view. But i am getting RunTimeException if i try
to use PendingIntent for both button. if i set pendingIntent for one
Button then it is working fine.  The following is my code snippet.
 hope to hear soon from you.


  Intent configIntent  = new Intent(context,
ImagesWidgetConfiguration.class);
  configIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
appWidgetId);
  //To specify open image action
  configIntent.putExtra(action, open);
  // gotta make this unique for this appwidgetid
 
configIntent.setData(Uri.withAppendedPath(Uri.parse(URI_SCHEME + ://
widget/id/), String.valueOf(appWidgetId)));

  PendingIntent pendingIntent1 =
PendingIntent.getActivity(context, 0, configIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
  remoteView.setOnClickPendingIntent(R.id.play_pause,
pendingIntent1);



// For SecondButton
  //remoteView = new RemoteViews(context.getPackageName(),
R.layout.main);
  Intent updateIntent=new
Intent(context,ImagesWidgetConfiguration.class);
  updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
appWidgetId);

  updateIntent.putExtra(action, setting);

 
updateIntent.setData(Uri.withAppendedPath(Uri.parse(URI_SCHEME + ://
widget/id/), String.valueOf(appWidgetId)));

   PendingIntent pendingIntent =
PendingIntent.getActivity(context, 0, updateIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
  remoteView.setOnClickPendingIntent(R.id.next,
pendingIntent);






-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en