How to cast TextView with my custom TextView?
I take text view instance from here:

		TextView date = null;
		
			try {
				date = (TextView) getLayoutInflater().inflate(
						R.layout.some_textview, null);
			} catch (Exception e) {
				// TODO: handle exception
				e.printStackTrace();

			} 

I created my custom textview:

    public class MyTextView extends TextView{
    	
        public MyTextView(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
        }
    
        public MyTextView(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        public MyTextView(Context context) {
            super(context);
        }
        
    
    }

Now i want to cast those:

    MyTextView my = (MyTextView)date;

I get exeption for this one:

     java.lang.ClassCastException: android.widget.TextView cannot be cast to com.myapp.name.MyTextView

So how it should be done ?

Thanks.
How to cast TextView with my custom TextView?
===

I take text view instance from here:

		TextView date = null;
		
			try {
				date = (TextView) getLayoutInflater().inflate(
						R.layout.some_textview, null);
			} catch (Exception e) {
				// TODO: handle exception
				e.printStackTrace();

			} 

I created my custom textview:

    public class MyTextView extends TextView{
    	
        public MyTextView(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
        }
    
        public MyTextView(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        public MyTextView(Context context) {
            super(context);
        }
        
    
    }

Now i want to cast those:

    MyTextView my = (MyTextView)date;

I get exeption for this one:

     java.lang.ClassCastException: android.widget.TextView cannot be cast to com.myapp.name.MyTextView

So how it should be done ?

Thanks.