0

I just built the apk of my first application. It works in the AVD emulator but when I install it on my Desire HD the screen turns black as soon as I start the app. It's a really simple application, it just changes the blackground as I type the color in an EditText and press a Button. What can cause the black screen problem? Thanks!

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final EditText colore = (EditText)this.findViewById(R.id.newcolor);
    Button conferma = (Button)this.findViewById(R.id.confirm);
    final RelativeLayout rl = (RelativeLayout)this.findViewById(R.id.lay);
    final TextView error = (TextView)this.findViewById(R.id.errore);

    OnClickListener l = new OnClickListener(){
        @Override
        public void onClick(View arg0){
            String s = colore.getText().toString();
            if (s.equals("Blu")){
                rl.setBackgroundColor(getResources().getColor(R.color.LightBlue));
                error.setText("");
            }else if(s.equals("Rosso")){
                rl.setBackgroundColor(getResources().getColor(R.color.IndianRed));
                error.setText("");
            }else if(s.equals("Verde")){
                rl.setBackgroundColor(getResources().getColor(R.color.LightGreen));
                error.setText("");
            }else if (s.equals("Bianco")){
                rl.setBackgroundColor(getResources().getColor(R.color.White));
                error.setText("");
            }else if (s.equals("Cacca")){
                rl.setBackground(getResources().getDrawable(R.drawable.cacca_rosa));
                error.setText("");
            }else{
                error.setText("Colore non disponibile, scegline uno dalla lista.");
            }
        }
    };
    conferma.setOnClickListener(l);
}
4

0 回答 0