I figured it out, the problem wasn't coming from this piece of code,
my bad..
On 1 oct, 15:53, Gopal Biyani gopalbiy...@gmail.com wrote:
If you can send the exact exception from log cat, then it will be easy to
find error.
On Thu, Oct 1, 2009 at 8:42 AM, andr0id sgrang...@gmail.com wrote:
Hi everyone,
I've made a simple countdown timer and I would like to use it as a
custom view in my xml layout.
The view works perfectly well if i add it manually like this:
this.myTimerView = new TimerView(this);
layout.addView(myTimerView);
However when I use it in the xml file, the program crashes. This is
what i've done:
XML:
RelativeLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:id=@+id/layout
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent
ImageView
android:id=@+id/imgv /
TextView
android:id=@+id/txtv /
com.myproject.TimerView
android:id=@+id/timer
android:layout_width=wrap_content
android:layout_height=wrap_content /
/RelativeLayout
TimerView class:
public class TimerView extends View
{
// Constructors
public TimerView(Context context)
{
super(context);
init();
}
public TimerView(Context context, AttributeSet attrs)
{
super(context, attrs);
init();
}
@Override
protected void onDraw(Canvas canvas)
{
//code
}
}
What am I doing wrong ?
Thanks.
--~--~-~--~~~---~--~~
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---