Page 253 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 253
import java.io.OutputStream;
import java.net.Socket;
public class HomeCctv_MainActivity extends AppCompatActivity {
Socket socket;
OutputStream oos;
Handler handler = new Handler();
TextView textView;
WebView webView;
// String STREAMING_SERVER_URL = "http://192.168.0.11:8081/";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_cctv__main);
//Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
// setSupportActionBar(toolbar);
textView = (TextView) findViewById(R.id.textView);
webView = (WebView) findViewById(R.id.webView);
WebView webView = (WebView)findViewById(R.id.webView);
webView.setWebViewClient(new WebViewClient()); //안 해주면 새 창이 뜸
webView.loadUrl("http://192.168.0.11:8081/");
try{
DataInputStream ois = new DataInputStream(socket.getInputStream());
String data = ois.readUTF();
alertText(data);
}catch (Exception e){
e.printStackTrace();
}
}
public void alertText(String msg) {
- 246 -