アンドロイドの勉強をしています。以下のようなコードが出てきました。
package yurihasuike.forcct; import android.app.Activity; import android.os.Bundle; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; public class Sample2 extends Activity { public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); LinearLayout tt = new LinearLayout(this); tt.setOrientation(LinearLayout.VERTICAL); setContentView(tt); TextView tv = new TextView(this); tv.setText("いらっしゃいませ。"); Button bt = new Button(this); bt.setText("購入"); tt.addView(tv); tt.addView(bt); } }
LinearLayout tt = new LinearLayout(this);
と
TextView tv = new TextView(this);
と
Button bt = new Button(this);
のthisはSample2オブジェクトとonCreateオブジェクト、
どちらのオブジェクトを指しているのでしょうか?
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/08/13 14:41
2017/08/13 14:42