Reputation: 570
I am new to Droid and am trying something which should be so simple that it's driving me insane.
I have a FragmentActivity:
public class ScanView extends FragmentActivity
... and on here I have a button which opens a dialog/alert window to allow the user to enter a value. Then I want that value back in the calling code. Does anyone have an example which (a) compiles and (b) actually works? So many examples online, but none of which work...
The closest example I found involves making an AlertDialog, but it won't compile at (ViewGroup)getView() below:
View viewInflated = LayoutInflater.from(this).inflate(R.layout.popup_bc, (ViewGroup)getView(), false);
Any ideas??
Upvotes: 0
Views: 130
Reputation: 77
The android dev guide provides an example for that here: http://developer.android.com/guide/topics/ui/dialogs.html#PassingEvents
When you handle the positive/negative button events in the dialog, you could save whatever value you want to pass back in a instance var and then pass the event (along w/ the instance of the dialog) to your FragmentActivity.
Upvotes: 1