> thanks. But wouldn't that make all items in a vertical layout? What if
> I want to have two buttons side-by-side rather than above-and-below?

Well, you'll have to nest layouts to do that, or use a RelativeLayout.

I'm not sure I totally understand your other instructions issue. I
guess you want to process usr and pwd? The onClick is probably where
you'd either do that or you could make a call to some other method.

On Apr 28, 4:33 pm, scimitar <[EMAIL PROTECTED]> wrote:
> thanks. But wouldn't that make all items in a vertical layout? What if
> I want to have two buttons side-by-side rather than above-and-below?
> Also, I have code like this:
>
> showDialog();
> // other instructions
>
> I want //other instructions  not be carried out until the user has
> clicked on a button in the dialog box. Currently //other instructions
> are carried out before the user has had a chance to enter text in the
> editboxes and click a button. My showDialog() code is:
>
> dl = new Dialog(this);
>     dl.setTitle("Information Prompt");
>     dl.setContentView(R.layout.infodlg);
>     EditText inputBox1 = (EditText)dl.findViewById(R.id.user);
>     inputBox1.setText("");
>     EditText inputBox2 = (EditText)dl.findViewById(R.id.pwd);
>     inputBox2.setText("");
>
>     Button bOk = (Button) dl.findViewById(R.id.ok);
>     bOk.setOnClickListener(new OnClickListener() {
>             public void onClick(View v) {
>                 EditText inputBox1 =
> (EditText)dl.findViewById(R.id.user);
>                 usr = inputBox1.getText().toString();
>                 inputBox1.setText("");
>
>                 EditText inputBox2 = (EditText)dl.findViewById(R.id.pwd);
>                 pwd = inputBox2.getText().toString();
>                 inputBox2.setText("");
>
>                 dl.dismiss();
>             }
>     });
>
> On Apr 28, 11:30 am, "Dan U." <[EMAIL PROTECTED]> wrote:
>
> > No, you aren't subclassing (extending), but that's not the problem
> > with why you don't see the editbox. You are using a horizontal
> > LinearLayout. That means the EditText will try to be rendered to the
> > right side of the TextView. But, you have set a width of fill_parent
> > on the TextView which will push the EditText out of the layout. Either
> > change it to wrap_layout or (more appropriate for you) change the
> > LinearLayout to vertical.
>
> > Now as to subclassingDialog, I think you should still do that instead
> > of what you are doing.
>
> > On Apr 28, 3:54 am, scimitar <[EMAIL PROTECTED]> wrote:
>
> > > isn't that what i'm doing?
>
> > > On Apr 28, 6:02 am, Hielko <[EMAIL PROTECTED]> wrote:
>
> > > > Do what Dan already suggested: extend thedialogclass.
>
> > > > On Apr 28, 11:46 am, scimitar <[EMAIL PROTECTED]> wrote:
>
> > > > > Ok. I have the following code:
>
> > > > >                    Dialogdl = newDialog(this);
> > > > >                     dl.setTitle("Information Prompt");
> > > > >                     dl.setContentView(R.layout.infodlg);
> > > > >                     EditText inputBox1 =
> > > > > (EditText)dl.findViewById(R.id.user);
> > > > >                     inputBox1.setText("");
> > > > >                     dl.show();
>
> > > > > And my infodlg.xml file is:
>
> > > > > <?xml version="1.0" encoding="utf-8"?>
> > > > > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> > > > > android"
> > > > >     android:orientation="horizontal"
> > > > >     android:layout_width="fill_parent"
> > > > >     android:layout_height="200px"
>
> > > > >    <TextView
> > > > >    android:layout_width="fill_parent"
> > > > >    android:layout_height="wrap_content"
> > > > >    android:text="Please Enter your username and password"
> > > > >    android:textStyle="bold"
> > > > >    />
> > > > >    <EditText android:id="@+id/user"
> > > > >    android:layout_width="fill_parent"
> > > > >    android:layout_height="wrap_content"
> > > > >    android:layout_weight="1">
> > > > >    <requestFocus/>
> > > > >    </EditText>
> > > > >  </LinearLayout>
>
> > > > > However, thedialogboxshows just the text:"Please Enter your
> > > > > username and password", and doesn't show the editbox below it. Why is
> > > > > this:
>
> > > > > Ideally I would want something like this:
>
> > > > > ---------------------------------------------------------------------------­------------
> > > > > Information Prompt
> > > > > ---------------------------------------------------------------------------­-------------
> > > > > Please enter your username and password
> > > > > ---------------------------------------------------------------------------­-----------
> > > > > username: [\editbox]
> > > > > password: [\editbox]
>
> > > > >                     \button["OK"]
> > > > > ---------------------------------------------------------------------------­-------------
>
> > > > > Please give me suggestions on how to achieve this.
>
> > > > > thanks,
>
> > > > > On Apr 27, 9:46 pm, "Dan U." <[EMAIL PROTECTED]> wrote:
>
> > > > > > Probably you should look into extending theDialogclass. Just specify
> > > > > > your layout and whatever event handling you need in that class, then
> > > > > > use it like aDialog. In your case, I'd have some kind of setter
> > > > > > method in yourDialogsubclass to set an OnClickListener for whichever
> > > > > > buttons you might have in theDialog. That way, you can specify the
> > > > > > functionality for a button click outside of yourDialog
> > > > > > implementation.
>
> > > > > > On Apr 27, 5:52 pm, scimitar <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Hi,
>
> > > > > > > I want my application to pop up adialogbox that asks for someuser
> > > > > > >input. Theuserenters theinputand clicks a button. Based on the
> > > > > > > text that theuserhas entered, the application then continues it's
> > > > > > > operations. How should I implement this?
>
> > > > > > > thanks
>
> > > > > On Apr 27, 9:46 pm, "Dan U." <[EMAIL PROTECTED]> wrote:
>
> > > > > > Probably you should look into extending theDialogclass. Just specify
> > > > > > your layout and whatever event handling you need in that class, then
> > > > > > use it like aDialog. In your case, I'd have some kind of setter
> > > > > > method in yourDialogsubclass to set an OnClickListener for whichever
> > > > > > buttons you might have in theDialog. That way, you can specify the
> > > > > > functionality for a button click outside of yourDialog
> > > > > > implementation.
>
> > > > > > On Apr 27, 5:52 pm, scimitar <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Hi,
>
> > > > > > > I want my application to pop up adialogbox that asks for someuser
> > > > > > >input. Theuserenters theinputand clicks a button. Based on the
> > > > > > > text that theuserhas entered, the application then continues it's
> > > > > > > operations. How should I implement this?
>
> > > > > > > thanks- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > > > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to