Hi ,
I wrote a custom view where i use "onDraw()" to apply a color and call
a method "insert()" to do some modification and call invalidate in
"insert()" method to redraw ,so onDraw and insert method will be
calling recursively .I wrote a onKeyDown method but this is never
called as i press the relevant key ,i could not figure out the resons
please help me out.
boolean flag = true;
public void onDraw(Canvas c)
{
Paint p=new Paint();
p.setColor(Color.RED);
p.setTextSize(50.0f);
p.setAntiAlias(true);
c.drawARGB(23, 44, 145, 78);
if(flag)
{
c.drawColor(Color.BLUE);
}
else
{
c.drawColor(Color.RED);
}
Log.v(TAG,"In onDraw");
c.drawText("hello ", 100, 100, p);
insert();
}
public void insert()
{
if(flag)
{
flag=false;
}
else
{
flag=true;
}
Log.v(TAG,"In hello method");
try {
Thread.sleep(250);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
invalidate();
}
public boolean onKeyDown(int keycode ,KeyEvent ke)
{
if(keycode==KeyEvent.KEYCODE_DPAD_CENTER)
{
Log.v(TAG,"In KEY PRESS EVENT");
}
return false;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---