Cannot cast from View to Text Switcher 报错

public class TextSwitcher extends Activity implements ViewSwitcher.ViewFactory

{

@Override

    protected void onCreate(Bundle savedInstanceState)

    {

        // TODO Auto-generated method stub

        super.onCreate(savedInstanceState);

        this.setContentView(R.layout.textswitcher);

        setTitle("TextSwitcher");

        TextSwitcher switcher = (TextSwitcher) findViewById(R.id.textswitcher);

    }

       public View makeView()

    {

        // TODO Auto-generated method stub

        return null;

    }

}

 

红色字体部分报错提示Cannot cast from View to Text Switcher,是自己的命名类跟调用函数起冲突,public class Text Switcher 中Text Switcher更改下命名,即可解决。

posted @ 2012-08-08 11:26  少爷太皮  阅读(294)  评论(0)    收藏  举报