February 7, 2012

How to open browser from android cocos2D Application?

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(""));CCDirector.sharedDirector().getActivity().startActivity(browserIntent);}});}

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

Leave a Reply Cancel reply

2 Comments to “How to open browser from android cocos2D Application?”