Hello,
As I understand, you want something like an editable read-only label
(TextView). Therefor, "TextView textview=new TextView(this);" is surely not
good, because you create here a new TextVew. Instead you should reference
the one you have already in your activity.
And an other thing, whom do you add the KeyListener to ?
regards,
Raul
On Wed, Feb 27, 2008 at 11:27 AM, Analdin Judy <j....@i-waves.com> wrote:
Hi all,
Below is my code ,Actualy i want to display numbers in my textview ,When
user pressing number keys in the emulator.
But i Cant get the expect result ,by using the below code.
What is the wrong in the code and what is the solution for that?
*Text.java*
if( keycode == KeyEvent.KEYCODE_1)//Whwn key 1 ispressed Textview
value set as 1
{
areacode="1";
TextView textview=new TextView(this);
textview.setText(areacode);
}
*Text.xml*
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="11111" //Default ,i set textview value
as 11111.
android:layout_x="80.0sp"
android:layout_y="60.0sp"
android:maxHeight="10.5sp"
android:maxWidth="10.5sp"
/>
Thanks
judy