intent open chrome in a url - not in lollipop -


public void onclickapp(view view){     intent intent = new intent("android.intent.action.main");     intent.setcomponent(componentname.unflattenfromstring("com.android.chrome/com.android.chrome.main"));     intent.addcategory("android.intent.category.launcher");     intent.setdata(uri.parse("http://www.google.com"));     startactivity(intent); } 

this code open google chrome , open web www.google.com.

on android 5, open google chrome not load www.google.com.

why?

sorry bad english.

thanks

i think thats beacuse activity doesn't exist in android lollipop. try this:

 public void onclickapp(view view){     intent intent = new intent(intent.action_view);     intent.setdata(uri.parse("http://www.google.com"));     intent.setpackage("com.android.chrome");     startactivity(intent); } 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -