Open browser with a url with extra headers for Android

后端 未结 2 976
难免孤独
难免孤独 2021-02-20 15:11

I have a specific requirement where I have to fire a url on the browser from my activity. I am able to do this with the following code :

Intent browserIntent = n         


        
2条回答
  •  独厮守ぢ
    2021-02-20 15:47

    I featured out how to add a header. Here is my code:

            Intent browserIntent = new Intent(
                    Intent.ACTION_VIEW, Uri.parse(url));
            Bundle bundle = new Bundle(); 
            bundle.putString("iv-user", username); 
            browserIntent.putExtra(Browser.EXTRA_HEADERS, bundle);
            activity.startActivity(browserIntent);
            activity.finish();
    

提交回复
热议问题