2011-10-28 2 views

答えて

0
public void onCreate(Bundle savedInstanceState) 
{ 
    super.onCreate(savedInstanceState); 


    setContentView(R.layout.main); 
    objWebview = (WebView)findViewById(R.id.webView_engine); 
    //enable javaScript overall 
    WebSettings objWebsetting =objWebview.getSettings(); 
    objWebsetting.setJavaScriptEnabled(true); 

// Enable JavaScript Alerts 
    objWebview.setWebChromeClient(new WebChromeClient()); 
    // Button btnSelect = (Button)findViewById(R.id.btnCopy); 

    objWebview.loadUrl("http://www.google.com"); 
    selectAndCopyText(objWebview); 
} 
void selectAndCopyText(WebView view) 
{ 
    try 
    { 
     KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, 
               KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); 
     shiftPressEvent.dispatch(view); 
    } 
    catch (Exception e) 
    { 
     Log.e("dd", "Exception in emulateShiftHeld()", e); 
    } 
} 
関連する問題