2011-03-17 15 views
0
public class Test extends Activity { 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     Button b = new Button(this); 
     String id = Integer.toString(b.getId()); 
     Toast.makeText(getApplicationContext(), id, 1).show(); 
    } 
} 

なぜ-1を返しますか?ボタンのgetIDは-1を返します。

答えて

関連する問題