androiddialogpopupquickaction

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(slideDialog.getSize());
 }
      });    }   });

Solution

  • 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?