기본적으로 내가하려는 것은 TextView의 일부 웹 페이지에서 웹 페이지 콘텐츠를 표시하는 것입니다. 이 앱을 실행하면 충돌이 발생하지 않지만 아무 것도 표시되지 않습니다. 내가 도대체 뭘 잘못하고있는 겁니까?웹 페이지 콘텐츠 표시
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void main(String[] args) throws Exception
{
URL oracle = new URL("http://www.pocketnow.com");
BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream()));
String inputLine;
TextView prikazTeksta = (TextView) findViewById(R.id.textView);
while ((inputLine = in.readLine()) != null)
{
prikazTeksta.setText(inputLine.toString());
}
in.close();
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings)
{
return true;
}
return super.onOptionsItemSelected(item);
}
}
합니다. 나는 당신이하고있는 것처럼 보이는 안드로이드 태그를 추가했습니다. 유용한 태그를 설정하지 않으면 질문에 대답 할 수있는 사람들이 아마 그것을 볼 수 없습니다. –