A : 전환할 Activity Class
Intent B = new Intent(this, A.class);
startActivity(B);
Intent B = new Intent(this, A.class);
startActivity(B);
vertical과 다른 점은 slidingdrawer의 속성중에 android:orientation 를 "horizontal"로 바꾸어 주면 됩니다.
물론 handle도 거기에 맞게 해줘야 합니다.
handle에 넣을 이미지가 없어서 대충 글자로 해보았습니다.
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class Test extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView text = (TextView)findViewById(R.id.htmlText); URL url = null; try { url = new URL("http://family7914.cafe24.com"); HttpURLConnection http = (HttpURLConnection)url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream())); StringBuffer buffer = new StringBuffer(); int c; while((c=in.read()) != -1){ buffer.append((char)c); } text.setText(buffer); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
코드를 실행해보면 위와 같은 결과가 나옵니다.
만약 결과가 나오지 않거나 오류가 발생한다면...
처음으로 생각해 볼수 있는 것이 Manifest의 Permission 입니다.
이건 우리가 어떤 기능을 사용할 것이다 라고 미리 알려주는 것입니다.
그래야만 사용할 수 있거든요~
두번째는 제가 어리석어서 생긴 경우인데...
실행을 할 경우 문서의 용량이 크면 로딩이 길게 되어있습니다.
그리고 그전에 디버깅을 위한 메세지가 뜨는데 그것을 그냥 오류로 생각해 버리는겁니다.
그러므로 메세지를 잘 확인하세요~ ^^;