Solved

OnClick Pop up new window to enter data

Posted on 2011-09-18
4
503 Views
Last Modified: 2012-05-12
Hello,

I currently have a Edit Text on my Android app that I need to be able to click on and another pop up comes up so the user can enter data.

I have a toast box popup, but I would like a  popup so the user can enter the data and then the data gets sent back to the edit text.

The one I have below send the user to another activity. Please help

Thank you
myStockPrice.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				// Click Text Box to Move to Next Activity
                Intent myIntent = new Intent(getApplicationContext(), StockQuoteLkup.class);
                startActivity(myIntent);
			}
		});

Open in new window

0
Comment
Question by:lulubell-b
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 1

Expert Comment

by:Gyufa
ID: 36559399
Hi!

I created a sample app for you, i hope it helps!
dialog-test.zip
0
 

Author Comment

by:lulubell-b
ID: 36564589
Thank you, Perfect functionality, now I just have to implement into my application :)

I see the openDialogButton.setOnClickListener(new View.OnClickListener() which opens the dialog activity when clicked.

How do I do this when I click the edit text box?

myStockPrice = (EditText)findViewById(R.id.txtStockPrice);

        myStockPrice.setOnClickListener(new OnClickListener() {
                  @Override
            public void onClick(View view) {
                showDialog(DIALOG);
            }
            });



0
 

Accepted Solution

by:
lulubell-b earned 0 total points
ID: 36571314
I chose to imbed this code instead.

        // Click on Stock Price to bring up dialog box
        myStockPrice.setOnClickListener(new View.OnClickListener() {
                  
                  @Override
                  public void onClick(View v) {
                        // Click button to Move to Next Activity
                //Intent myIntent = new Intent(getApplicationContext(), StockQuoteLkup.class);
                //startActivity(myIntent);
               
                final AlertDialog.Builder alert = new AlertDialog.Builder(OptionsPricingCalculatorActivity.this);
                    final EditText input = new EditText(OptionsPricingCalculatorActivity.this);
                    alert.setView(input);
                    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface dialog, int whichButton) {
                                String value = input.getText().toString().trim();
                                
                                //Toast.makeText(getApplicationContext(), value,
                                            //Toast.LENGTH_SHORT).show();
                          }
                    });

                    alert.setNegativeButton("Cancel",
                                new DialogInterface.OnClickListener() {
                                      public void onClick(DialogInterface dialog, int whichButton) {
                                            dialog.cancel();
                                      }
                                });
                    alert.show();
               
                  }
            });
0
 

Author Closing Comment

by:lulubell-b
ID: 36594802
This is more of what I was looking for.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Here, we have shared an easy step by step tutorial on how to download instagram images and videos on PC, Android Mobile and iOS mobile.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question