2010-02-10 48 views

回答

16

點擊可以啓動「視圖」的活動,這將是瀏覽器獲得一個網址:

public class HelloWorld extends Activity { 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

    // Assuming you are using xml layout 
    Button button = (Button)findViewById(R.id.Button01); 

    button.setOnClickListener(new OnClickListener() { 
     public void onClick(View arg0) { 
     Intent viewIntent = 
      new Intent("android.intent.action.VIEW", 
      Uri.parse("http://www.stackoverflow.com/")); 
      startActivity(viewIntent); 
     } 
    }); 

    } 

} 
+0

非常感謝你的工作 – deepthi 2010-02-10 11:59:10

相關問題