新的应用程序崩溃在启动,调试没有帮助 [英] New app crashing on start-up, debug not helping

查看:158
本文介绍了新的应用程序崩溃在启动,调试没有帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我试图调试我的code,使用DDMS,我不能qutie得到它的窍门,只是还没有。我想这是因为我的程序在启动崩溃。不管怎么说,我发现这哥们,他想不通我做错了什么。可有人请指出为什么我的应用程序在启动时崩溃?

Alright I tried debugging my code, using DDMS and I can't qutie get the hang of it just yet. I think it's because my program crashes on launch. Anyways, I showed this to a buddy and he can't figure out what I'm doing wrong. Can someone please point out why my app is crashing on start up?

感谢:

http://pastebin.com/ZXxHPzng

推荐答案

您是要创建在全球区域的UI元素的问题。你可以有声明他们,如果你希望它是一个全局对象,但你不能实例化,直到你已经设置的内容视图后。例如:

The problem you have is you are creating your UI elements in the global area. You can declare them there if you want it to be a global object, but you can not instantiate them until after you have set the content view. For example:

    private RadioButton rockRB;
    private RadioButton paperRB;
    private RadioButton scissorsRB;
    private TextView result;



    @Override
    public void onCreate(Bundle savedInstanceState) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main); 
        // Content View Must be set before making UI Elements
        rockRB = (RadioButton)findViewById(R.id.radioRock);
        paperRB = (RadioButton)findViewById(R.id.radioPaper);
        scissorsRB = (RadioButton)findViewById(R.id.radioScissors);
        result =  (TextView)findViewById(R.id.result);

这篇关于新的应用程序崩溃在启动,调试没有帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆