- Adroid Studio 2.2.2
- API 23
import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Toast; public class MainActivity extends AppCompatActivity { WebView webView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); webView = (WebView) findViewById(R.id.webView); webView.setWebViewClient(new WebViewClient()); WebSettings settings = webView.getSettings(); settings.setJavaScriptEnabled(true); settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); } public void onButton1Clicked(View v){ Toast.makeText(getApplicationContext(), "페이지 오픈", Toast.LENGTH_LONG ).show(); webView.loadUrl("http://m.naver.com"); // webView.loadUrl("file:///android_asset/sample.html"); } }
반응형
'ide > androidstudio' 카테고리의 다른 글
Android Studio Remove (0) | 2016.11.08 |
---|---|
Build 속도 (0) | 2016.11.06 |
Android Bluetooth (0) | 2016.01.20 |
ADT 스레드, AsyncTask (0) | 2016.01.06 |
studio.vmoptions (0) | 2015.12.15 |