Hi magouyaware,
Thanks for replay,
Thanks for time,
yes i am sure
CustomView class is in the "net.pocketmagic.customangletext" package

Thanks
Naveen.

---------- Forwarded message ----------
From: Justin Anderson <magouyaw...@gmail.com>
Date: Wed, Mar 7, 2012 at 12:26 AM
Subject: Re: [android-developers] using custom views in xml layouts
To: android-developers@googlegroups.com


http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/LabelView.html
http://developer.android.com/resources/samples/ApiDemos/res/layout/custom_view_1.html

The first link is a sample of a custom class and the second is a sample of
how to use that custom class in XML.

The question I asked in your other (almost duplicate) post still stands
though... Are you SURE that the CustomView class is in the "net.pocketmagic.
customangletext" package?

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware



On Tue, Mar 6, 2012 at 4:01 AM, Todd Grigsby <tgrigsby...@gmail.com> wrote:

> Not specific enough.  Have you stepped through this code in debug to see
> what line is giving you the problem?
> On Mar 6, 2012 1:07 AM, "chowdary nani" <naveenneeli...@gmail.com> wrote:
>
>> Hi All,
>>
>>  i am working  with custom views using in xml layouts
>> Following is my custom view code:
>>
>> public class CustomTextView extends View {
>>
>>     private int m_nColor;
>>     private Typeface m_tTypeface;
>>     private int m_nSize;
>>     private int m_nRotationAngle, m_nRotationW, m_nRotationH;
>>     private String m_szText;
>>
>>     public CustomTextView(Context context) {
>>         super(context);
>>         // set default parameters
>>         Log.d("dghgfhf", "dfghgfh");
>>         m_nColor = Color.WHITE;
>>         m_nSize = 14;
>>         m_nRotationAngle = 0;
>>         m_nRotationW = 0;
>>         m_nRotationH = 0;
>>         m_tTypeface = Typeface.create("arial", Typeface.NORMAL);
>>     }
>>
>>     public CustomTextView(Context context, AttributeSet attrs) {
>>         super(context, attrs);
>>     }
>>     public void SetColor(int newcolor) {
>>         m_nColor = newcolor;
>>         this.invalidate();
>>     }
>>
>>     public void SetTextSize(int newsize) {
>>         m_nSize = newsize;
>>         this.invalidate();
>>     }
>>
>>     // style: normal-0,bold-1,italic-2,bold-italic-3,
>>     public void SetFont(String newfontface, int style) {
>>         m_tTypeface = Typeface.create(newfontface, style);
>>         this.invalidate();
>>     }
>>
>>     public void SetRotation(int newangle, int neww, int newh) {
>>         m_nRotationAngle = newangle;
>>         m_nRotationW = neww;
>>         m_nRotationH = newh;
>>         this.invalidate();
>>     }
>>
>>     public void SetText(String newtext) {
>>         m_szText = newtext;
>>         this.invalidate();
>>     }
>>
>>     @Override
>>     protected void onDraw(Canvas canvas) {
>>         super.onDraw(canvas);
>>         Paint paint = new Paint();
>>         paint.setTypeface(m_tTypeface);
>>         paint.setStyle(Paint.Style.FILL);
>>         paint.setColor(m_nColor);
>>         // paint.setShadowLayer(1, 0, 1, Color.parseColor("#000000"));
>>         paint.setTextSize(m_nSize);
>>         canvas.rotate(m_nRotationAngle, m_nRotationW, m_nRotationH);
>>         canvas.drawText(m_szText, 0, 0, paint);
>>
>>     }
>> }
>>
>> Following is my layout:
>> <?xml version="1.0" encoding="utf-8"?>
>> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
>>     xmlns:GUI="
>> http://schemas.android.com/apk/res/net.pocketmagic.customangletext";
>>     android:layout_width="fill_parent"
>>     android:layout_height="fill_parent"
>>     android:orientation="vertical" >
>>
>>     <view
>>         android:id="@+id/yourID"
>>         android:layout_width="wrap_content"
>>         android:layout_height="wrap_content"
>>         android:layout_margin="10dp"
>>         class="net.pocketmagic.customangletext.CustomTextView" />
>>
>> </LinearLayout>
>>
>>
>> i am  getting null pointer exception i am unable find where i am going
>> wrong please help me
>>
>>
>> Thanks
>> Naveen.
>>
>> --
>> 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
>
>  --
> 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
>

 --
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

-- 
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

Reply via email to