Confirmation routine

by john brown » Fri, 30 Jul 2010 10:52:01 GMT


Sponsored Links
 Hello,

What is the recommended best practice for a "confirm routine"? A toast
object is something like a visual basic MsgBox() routine but I have
not found any variations for a toast that returns a "yes" or "no".

An example might be:

*********************************************************************
"you have entered a bid amount of $0.01. Select YES to permanently
place the bid or NO to discard this entry"

        YES                   NO

**********************************************************************

I searched for "confirm" and found that the notepad example does have
a "confirm" button. I did the exercise and found that this particular
confirm button does not exactly match what I am wanting. I did learn a
way of using an intent to create a confirm routine but I thought there
might be another (shorter) method that I have missed.

Thanks for your help. John Brown

(I posted this on beginners about 6 hours ago but it never appeared in
the list. ?)

--



Confirmation routine

by Frank Weiss » Fri, 30 Jul 2010 11:06:02 GMT


 I assume you want a blocking alert dialog like the MsgBox() function.
This has been brought up before and basically "no can do" the way the
Android UI thread works, AFAIK. The two "natural" android approaches:

1) An other activity that you start with startActivityForResult(),
which can be themed as an alert dialog
2) An in-activity alert dialog whose callback changes the activity's
state or completes the action you were hoping that the alert dilaog
would block for.

--


Sponsored Links


Confirmation routine

by nexbug » Fri, 30 Jul 2010 15:07:46 GMT


 a simple approach is to use the AlertDialog as

AlertDialog.Builder bldr = new AlertDialog.Builder(this);
bldr.setTitle("confirm") ;
bldr.setMessage("place bid ?") ;
bldr.setPositiveButton(R.string.yes, new
DialogInterface.OnClickListener(){
        @Override
        public void onClick(DialogInterface dialog, int which) {
///code for YES
        }
});

bldr.setNegativeButton(R.string.no, new
DialogInterface.OnClickListener(){
        @Override
        public void onClick(DialogInterface dialog, int which) {
// code for NO
        }
});

bldr.show();

what was the reason you didnt like that approach ?
-g




--



confirmation routine

by john brown » Sun, 01 Aug 2010 13:13:23 GMT


 Hello,

What is the recommended best practice for a "confirm routine"? A toast
object is something like a visual basic MsgBox() routine but I have
not found any variations for a toast that returns a "yes" or "no".

An example might be:

*********************************************************************
"you have entered a bid amount of $0.01. Select YES to permanently
place the bid or NO to discard this entry"

         YES                   NO

**********************************************************************

I searched for "confirm" and found that the notepad example does have
a "confirm" button. I did the exercise and found that this particular
confirm button does not exactly match what I am wanting. I did learn a
way of using an intent to create a confirm routine but I thought there
might be another (shorter) method that I have missed.

Thanks for your help. John Brown

--



Other Threads

1. Simple ProgressBar with background and bar from a drawable resource?

Thanks Mark!  I guess I should start peeking around the android sdk
for this stuff... ^.^

I will try this out... but I'm not too sure how to reference a
drawable png to the clip tag...  Well I will try might be easy I just
need to give it a try :P

Thanks again!

Moto!
--~--~---------~--~----~------------~-------~--~----~

2. Exception Stacktrace

Getting a bunch of these errors logged on one of our apps... Not sure
exactly whats causing it (doesn't show our app anywhere in the stacktrace)

java.lang.IllegalArgumentException: parameter must be a descendant of this
view
    at
android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:2454)
    at
android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:2391)
    at android.view.ViewRoot.scrollToRectOrFocus(ViewRoot.java:1301)
    at android.view.ViewRoot.draw(ViewRoot.java:1107)
    at android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
    at android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:3948)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
    at dalvik.system.NativeStart.main(Native Method)


Anyone know where to start looking?

- Dan

--~--~---------~--~----~------------~-------~--~----~

3. SD Card file name.

4. Network connection from my development machine to the emulator - How To?

5. dlopen, pls HELP!!!

6. How to keep Android music background service running?

7. linger debug sessions...