How to open browser from android cocos2D Application?

By | February 7, 2012

This code snippet helps you to open browser in android cocos2D application

public void openBrowser(){
		CCDirector.sharedDirector().getActivity().runOnUiThread(new Runnable() {
		    public void run() {
				Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
				CCDirector.sharedDirector().getActivity().startActivity(browserIntent);
		}});
	}

Call this function anywhere inside your cocos2D project to open the browser with the corresponding URL.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Reply

Your email address will not be published. Required fields are marked *