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. Monkeyrunner error for device

I am trying to use monkeyrunner to automate a few tests on the device
but keep running into the following error on a touch() or press()
call.

110401 11:47:40.034:S [main]
[com.android.monkeyrunner.adb.AdbMonkeyDevice] Erro
r sending touch event: 240 720 DOWN_AND_UP
110401 11:47:40.034:S [main]
[com.android.monkeyrunner.adb.AdbMonkeyDevice]java.
net.SocketException: Software caused connection abort: socket write
error
110401 11:47:40.034:S [main]
[com.android.monkeyrunner.adb.AdbMonkeyDevice]
at java.net.SocketOutputStream.socketWrite0(Native Method)
110401 11:47:40.034:S [main]
[com.android.monkeyrunner.adb.AdbMonkeyDevice]
at java.net.SocketOutputStream.socketWrite(Unknown Source)
110401 11:47:40.034:S [main]
[com.android.monkeyrunner.adb.AdbMonkeyDevice]
at java.net.SocketOutputStream.write(Unknown Source)
110401 11:47:40.034:S [main]
[com.android.monkeyrunner.adb.AdbMonkeyDevice]
at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
.............
.............
.............
110401 11:47:40.034:S [main]
[com.android.monkeyrunner.adb.AdbMonkeyDevice]
at com.android.monkeyrunner.ScriptRunner.console(ScriptRunner.java:
193)
110401 11:47:40.034:S [main]
[com.android.monkeyrunner.adb.AdbMonkeyDevice]
at
com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:
89)

110401 11:47:40.034:S [main]
[com.android.monkeyrunner.adb.AdbMonkeyDevice]
at
com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:
20
3)


However the calls for shell() method works fine. What might I be doing
wrong?
The same code works well on the eumlator.

-- 

2. ImageView setColorFilter, what to do for a bitmap?

You can create a new scratch bitmap with a copy of the data and then blt it 
back onto the target bitmap like so:

Paint p = new Paint();

 p.setColorFilter(<customColorFilter>);
 Canvas c = new Canvas(target);
c.drawColor(Color.BLACK);
c.drawBitmap(scratchBitmap, 0, 0, p);

-- 

3. Disable a particular row in list view onCreate

4. How to access the list of services which are currently running in background?

5. Flytouch Etablet + android browser

6. Anyone tried Drupal Services Module with Android???

7. OOT, sorry test