[android-beginners] Re: EditText

2009-06-15 Thread Tseng

http://developer.android.com/reference/android/view/View.OnLongClickListener.html

Implement an View.OnLongClickListener and set it to your EditText
via
EditText txt = (EditText)findViewById(R.id.your_edittext_id);
...
txt.setOnLongClickListener(...)

Check out
http://tseng-blog.nge-web.net/blog/2009/02/14/implementing-listeners-in-your-android-java-application/
and
http://tseng-blog.nge-web.net/blog/2009/02/17/how-implement-your-own-listener-android-java/

If you want to know more about listeners and how to implement them.


On Jun 14, 6:36 pm, Synapse  wrote:
> How can I change choise from contextual menu of EditText ( Menu that
> includes copy/paste funcionality ) ?
> Anyone has some piece of code?
>
> Synapse
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText

2009-09-23 Thread Balwinder Kaur (T-Mobile USA)

Can you post the code you used to programmatically create an
EditText ?

The following code snippet in an activity does what you want it to do.

EditText e = new EditText(this);
ViewGroup.LayoutParams vw = new ViewGroup.LayoutParams
(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
addContentView(e, vw);

Hope this helps,
Balwinder Kaur
Open Source Development Center
·T· · ·Mobile· stick together

The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.


On Sep 23, 3:58 am, "Sven Mutscher"  wrote:
> Hello,
>
> I have a problem using EditText. What I do is creating an instance using 
> "new" (no xml configuration) and then draw it to my Canvas.
>
> What I do not understand is that nothing happens when clicking into the
> text box. Normally the focus is on the text box, I get a cursor and the 
> virtual keyboard appears, I can make text input etc... !
>
> Creating the EditText element in a layout xml everything works fine. But this 
> is not what I want in that case.
>
> Any ideas ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText

2010-02-21 Thread André
Thanks Mark,

that worked perfectly!
Maybe you could answer another easy question.
In the same EditText window I am loading in some text to at the
startup and I have set the horizontal scroll to true because one of
the lines is quite long. And then it start scrolled to the right but I
would prefer if it was to the left. Suggestions?

André

On Feb 21, 2:13 pm, Mark Murphy  wrote:
> Andr wrote:
> > Hello,
>
> > I have a EditText window that fills up most of the screen. But when I
> > start typing in it always starts on the left side in the middle. I
> > want it to start top left corner. How do I do this?
>
> Set the gravity of the EditText widget to left|top.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Training in US: 14-18 June 2010:http://bignerdranch.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: EditText multiline

2008-09-25 Thread Mark Murphy

> how i can use EditText with multiline???

Put android:singleLine="false" in your layout XML, or use the equivalent
method on the EditText object.

--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.2 Published!



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText appearance

2009-03-11 Thread Tseng

You could create a colorstate list (xml file in res/drawable), for
example
http://developer.android.com/reference/android/content/res/ColorStateList.html

Here is an example i used for textcolors. Should work for HintColors
too!

res/drawabale/myedittextcolors.xml:


http://schemas.android.com/apk/res/android";>






Now you only have to assign it to your EditText widget.

Edit the XML and change

android:textColorHint="#FF"

to

android:textColorHint="@drawable/myedittextcolors"

and it should work. This is usefull if you want to have different
colors depending on the state of the edittext (i.e. if its focused,
clicked, etc).

For one color,
use android:textColorHint="#FF" or android:textColorHint="@color/
mycustomcolor" if you have defined your color in /res/values/
colors.xml







On Mar 10, 11:30 am, "Mr.No"  wrote:
> Hello,
> how do i change the size, style, typeface of a hint?
> If the EditText gains the focus the border-color changes to orange,
> how do i set a other color?
>
> rgds
>        Mr.No
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText appearance

2009-03-12 Thread Mr.No

Can i assigne a colorstate list to the background?
And how do i change the bordercolor when the edittext gains the focus,
without placing a backgroundimage?

Tseng schrieb:
> You could create a colorstate list (xml file in res/drawable), for
> example
> http://developer.android.com/reference/android/content/res/ColorStateList.html
>
> Here is an example i used for textcolors. Should work for HintColors
> too!
>
> res/drawabale/myedittextcolors.xml:
>
> 
> http://schemas.android.com/apk/res/android";>
>android:state_focused="true"
>   android:state_pressed="false"
>   android:color="@android:color/secondary_text_dark" />
>android:state_focused="true"
>   android:state_pressed="true"
>   android:color="@android:color/secondary_text_dark" />
>android:state_focused="false"
>   android:state_pressed="true"
>   android:color="@android:color/secondary_text_dark" />
>android:color="@android:color/secondary_text_dark" />
> 
>
> Now you only have to assign it to your EditText widget.
>
> Edit the XML and change
>
> android:textColorHint="#FF"
>
> to
>
> android:textColorHint="@drawable/myedittextcolors"
>
> and it should work. This is usefull if you want to have different
> colors depending on the state of the edittext (i.e. if its focused,
> clicked, etc).
>
> For one color,
> use android:textColorHint="#FF" or android:textColorHint="@color/
> mycustomcolor" if you have defined your color in /res/values/
> colors.xml
>
>
>
>
>
>
>
> On Mar 10, 11:30 am, "Mr.No"  wrote:
> > Hello,
> > how do i change the size, style, typeface of a hint?
> > If the EditText gains the focus the border-color changes to orange,
> > how do i set a other color?
> >
> > rgds
> >        Mr.No
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText appearance

2009-03-12 Thread Mr.No

thx a lot :)

On 10 Mrz., 11:30, "Mr.No"  wrote:
> Hello,
> how do i change the size, style, typeface of a hint?
> If the EditText gains the focus the border-color changes to orange,
> how do i set a other color?
>
> rgds
>        Mr.No
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText Right Align

2008-10-01 Thread Romain Guy

android:gravity="right"

On Wed, Oct 1, 2008 at 12:03 PM, Zachary Becker <[EMAIL PROTECTED]> wrote:
> I couldn't find the xml attribute to align a EditText box to the right side.
> I am using it for numbers so I would prefer it be aligned right.
>
> Is there a way to do this, through xml or a function call?
>
> Thanks,
>
> Zach
>
> >
>



-- 
Romain Guy
www.curious-creature.org

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText Right Align

2008-10-01 Thread Zachary Becker
Thanks, worked perfectly =D

On Wed, Oct 1, 2008 at 12:41 PM, Romain Guy <[EMAIL PROTECTED]> wrote:

>
> android:gravity="right"
>
> On Wed, Oct 1, 2008 at 12:03 PM, Zachary Becker <[EMAIL PROTECTED]> wrote:
> > I couldn't find the xml attribute to align a EditText box to the right
> side.
> > I am using it for numbers so I would prefer it be aligned right.
> >
> > Is there a way to do this, through xml or a function call?
> >
> > Thanks,
> >
> > Zach
> >
> > >
> >
>
>
>
> --
> Romain Guy
> www.curious-creature.org
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText not honoring width attribute

2009-05-24 Thread Romain Guy

> Unfortunately The layout is
> honored such that all of the EditText fields expand so that all of
> them are as big as the largest 1.

That is exactly the purpose of TableLayout. If you do not want this
behavior, do not use TableLayout.

-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText to String to int

2008-04-24 Thread Dan U.

The message seems a bit different from what I'd expect, but I think
it's a matter of using final. Final for a primitive means you can't
change it (and if it were an object, it means you can't reassign to a
different object, but you can change the internal state of it). So,
probably define totalCost as a member variable of your class and drop
the final keyword.

On Apr 24, 5:24 pm, Kyle <[EMAIL PROTECTED]> wrote:
> Hi, I've been looking for a way of doing this, maybe it's just my lack
> of thought, or maybe I'm just too noob at Java, but I'm trying to get
> EditText text (can do this), send to a string (can also do this)
> convert to int, add to a global int, and then write the global int to
> a TextView. Here is my code:
>
> final int totalCost=0;
> btnAddCost.setOnClickListener(new Button.OnClickListener() {
> public void onClick(View v) {
> final String value = btnAddCost.getText().toString();
> totalCost = Integer.parseInt(value);
> txtTotalCost.setText("$"+totalCost);
> }
> });
>
> Eclipse returns an error saying:
> The final local variable totalCost cannot be assigned, since it is
> defined in an enclosing type
>
> Any ideas? Basically what it is, is a price updater, adds the amount
> of money you typed in, to the TextView (txtTotalCost)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@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-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText to String to int

2008-04-24 Thread Kyle

Ok I rearranged my code a bit and put the triggered code into public
voids. Here is the code that fires my function:

final String value = btnAddCost.getText().toString();
addCost(Integer.parseInt(value));

and here is the addCost() function:

public int totalCost=0;

public void addCost(int cost)
{
final TextView txtTotalCost;

txtTotalCost = (TextView) findViewById(R.id.txtTotalCost);

totalCost = totalCost + cost;
txtTotalCost.setText("$"+totalCost);
}

this all compiles fine, has no errors, and no warnings; yet when I
enter a valid integer, (edittext is numeric only) it crashes the app.
Any ideas? I don't really know how to use the debugger yet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@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-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText to String to int

2008-04-24 Thread Dan U.

You said "edittext", but what is edittext? It sounds like the name
you've given to an EditText, but I see btnAddCost.getText().toString()
which kinda makes me wonder if it's really a button you are trying to
get the text from. Are you sure that value is a number?

On Apr 24, 6:21 pm, Kyle <[EMAIL PROTECTED]> wrote:
> Ok I rearranged my code a bit and put the triggered code into public
> voids. Here is the code that fires my function:
>
> final String value = btnAddCost.getText().toString();
> addCost(Integer.parseInt(value));
>
> and here is the addCost() function:
>
> public int totalCost=0;
>
> public void addCost(int cost)
> {
> final TextView txtTotalCost;
>
> txtTotalCost = (TextView) findViewById(R.id.txtTotalCost);
>
> totalCost = totalCost + cost;
> txtTotalCost.setText("$"+totalCost);
>
> }
>
> this all compiles fine, has no errors, and no warnings; yet when I
> enter a valid integer, (edittext is numeric only) it crashes the app.
> Any ideas? I don't really know how to use the debugger yet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@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-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText to String to int

2008-04-24 Thread Kyle

Oh my god... You know Dan, you've been a great sport to me, I can't
thank you enough, I should really open my eyes a little more, I'm so
very sorry for wasting your time, haha, I feel incredibly stupid...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@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-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText to String to int

2008-04-24 Thread Dan U.

Don't worry about it. It's like writing a resume or some other
document. You sometimes need someone to proofread what you write and
sometimes you miss the most obvious things.

On Apr 24, 6:50 pm, Kyle <[EMAIL PROTECTED]> wrote:
> Oh my god... You know Dan, you've been a great sport to me, I can't
> thank you enough, I should really open my eyes a little more, I'm so
> very sorry for wasting your time, haha, I feel incredibly stupid...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@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-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText getText() to string for notification

2008-04-22 Thread Dan U.

Because "message" is whatever text is in the EditText whenever this
bit of code runs. I assume this is ran in onCreate? Probably this is
blank unless you gave it a default value. What you might try is to
remove the message variable and then call text.getText().toString() in
the Toast.makeText method.

On Apr 22, 2:28 pm, Kyle <[EMAIL PROTECTED]> wrote:
> Hi, I have my application set to grab the text from an EditText field,
> but for some reason even if I convert it "toString", the returned
> string always comes back blank. Here is my code:
>
> Button button;
> EditText text;
>
> button = (Button) findViewById(R.id.btnOK);
> text = (EditText) findViewById(R.id.txtCustomerName);
> final String message = text.getText().toString();
> button.setOnClickListener(new Button.OnClickListener() {
>   public void onClick(View v) {
> Toast.makeText(HelloWorld.this, message,
> Toast.LENGTH_SHORT).show();
>   }
>
> });
>
> Sorry for the bad code organization, but copy and paste didn't really
> work out the way I imagined, Haha. Any help would be great. Also, I
> tried searching, but for some reason I just can't find a solution.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@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-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: EditText getText() to string for notification

2008-04-22 Thread Kyle

Oh boy, so simple, why didn't I think of it, trying to get something
that doesn't exist... Thanks a ton Dan, I'll try to stay within
reality next time, haha.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@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-beginners?hl=en
-~--~~~~--~~--~--~---