开发者

Starting Dialog from QuickAction Button

I have an app with a quickaction shown once a button is pressed. The quickaction shows a popup like in the Gallery 3D application for android, and when an action is clicked, I try to show a dialog, but I recieve a force close. Debug in Eclipse points to the slideDialog.show(); line, but I need that to show the dialog, right? Here's an example of one of those quickaction/dialogs.

final ActionItem third = new ActionItem();

third.setTitle("Adjust Brush Width");

third.setIcon(getResources().getDrawable(R.drawable.arrow_up));

 third.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

slideDialog = new slideDialog(getApplicationContext());

   slideDialog.show();

slideDialog.setOnDismissListener(new OnDismissListener() {

 @Override

 public void onDismiss(DialogInterface dialog) {

  mPaint.setStrokeWidth(slideD开发者_高级运维ialog.getSize());
 }
      });    }   });


I have a sneaky suspicion that getApplicationContext() is not returning the right Context for your need.... have you tried passing in Classname.this into slideDialog... i.e. sildeDialog = new slideDialog(Classname.this) where Classname is the name of the class that you're currently writing in?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜