使用包含继承的动画



如果我想在程序中添加包含继承。它显示了例外,并要求武力杀害。有人能解释为什么吗?如果我没有正确使用,那么建议我使用一段代码。

public  class SongsActivity extends Activity{
    DemoView demoview ;
    FinalView finalview;
    LayoutAnimationController  c;
   /// containment inherttance using above
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        boolean first=true;
        boolean sec=false;
        demoview = new DemoView(this);
        finalview = new FinalView(this);
        for(int i=1;i>0;i++)
        {
            if (first==true||sec==false)
            {
                setContentView(finalview);
                c.setDelay(1000);//containment inheritance using .
                first=false;
                sec=true;
                break;
            }else if(first==false||sec==true)
            {
                c.setDelay(1000);
                first=true;
                sec=true;
            }else if(first==true||sec==true)
            {
                setContentView(demoview);
                first=false;
                sec=false;
            }else
            {   
                setContentView(demoview);
                first=false;
                sec=false;
            }
        }
    }

不确定您到底在寻找什么,但强制关闭的原因是您声明了一个LayoutAnimationController c;,但从未为c赋值,您只是尝试使用它(c.setDelay()),这会引发一个空指针异常并导致应用程序崩溃。

最新更新