다른 클래스의 클래스에 액세스해야한다면 해당 클래스의 객체를 만듭니다. 그러나 괄호 안에 this
키워드를 사용하는 이유는 무엇입니까?
누군가 도와 드릴 수 있습니까?android에서 다른 클래스의 클래스에 액세스
public class SQLView extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.sqlview);
TextView tv=(TextView) findViewById(R.id.tvSQLinfo);
HotOrNot info=new HotOrNot(this);
info.open(); String data=info.getData();
info.close(); tv.setText(data);
}
}
질문에 대한 설명을 추가하십시오. – Simulant
공용 클래스 SQLView 활동 연장 { @Override 보호 공극에서 onCreate (번들 savedInstanceState) {// TODO \t 방법 스텁 \t super.onCreate (savedInstanceState) 자동 생성; \t setContentView (R.layout.sqlview); \t TextView tv = (TextView) findViewById (R.id.tvSQLinfo); \t HotOrNot 정보 = 새로운 HotOrNot (this); \t info.open(); \t 문자열 데이터 = info.getData(); \t info.close(); \t tv.setText (data); } – user3222270
여기 HotOrNot은 액세 스할 객체이고 그 객체가 만들어진 클래스입니다. – user3222270