Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - [SOLVED] Calling a dialog from an onTouchEvent

[SOLVED] Calling a dialog from an onTouchEvent

Put your problem here if it does not fit any of the other categories.

[SOLVED] Calling a dialog from an onTouchEvent

Postby ekimia » Sat May 29, 2010 6:59 pm

Im writing a scrollable image app that when the user clicks on a certain part of the screen, a corresponding dialog box pops up. How exactly could i call the dialogbox from an onTouchEvent? Im new to dialog boxes, ive looked through some tutorials for them but just couldnt find out to get them to pop up once the user clicks on the screen. Thanks.
Last edited by ekimia on Mon May 31, 2010 2:47 am, edited 1 time in total.
ekimia
Junior Developer
Junior Developer
 
Posts: 19
Joined: Sun May 23, 2010 10:13 pm

Top

Re: Calling a dialog from an onTouchEvent

Postby phix » Sun May 30, 2010 7:27 am

Something along this line:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class DialogTest extends Activity {
  2.     @Override
  3.     public void onCreate(Bundle savedInstanceState) {
  4.         super.onCreate(savedInstanceState);
  5.         setContentView(R.layout.main);
  6.  
  7.         TextView bat = (TextView) findViewById(R.id.temp);
  8.         bat.setText("Click Me");
  9.         final Activity self = this;
  10.         bat.setOnTouchListener(new OnTouchListener() {
  11.             @Override
  12.             public boolean onTouch(View v, MotionEvent event) {
  13.                 if (event.getAction() == MotionEvent.ACTION_DOWN) {
  14.                     Builder builder = new AlertDialog.Builder(self);
  15.                     builder.setTitle("You Touched!");
  16.                     builder.setIcon(R.drawable.icon);
  17.                     builder.setMessage("EventX: " + event.getX() + ". Event Y: " + event.getY());
  18.                                        
  19.                     builder.show();
  20.                 }
  21.                 return true;
  22.             }
  23.         });
  24.     }
  25. }
  26.  
Parsed in 0.014 seconds, using GeSHi 1.0.8.4
Posting questions without code is like going to the doctor and saying "it hurts, fix it."
phix
Master Developer
Master Developer
 
Posts: 230
Joined: Mon Mar 15, 2010 10:37 am

Re: Calling a dialog from an onTouchEvent

Postby ekimia » Sun May 30, 2010 11:31 pm

Thank you sooo much.
ekimia
Junior Developer
Junior Developer
 
Posts: 19
Joined: Sun May 23, 2010 10:13 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], MSNbot Media and 9 guests