Created
August 2, 2017 14:48
-
-
Save thaiall/9551cc6b1f7508663f372f760518b59f to your computer and use it in GitHub Desktop.
Android Studio : openweb2 by customtabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.thaiall.www.openweb2; | |
import android.support.v7.app.AppCompatActivity; | |
//import android.app.Activity; | |
import android.net.Uri; | |
import android.os.Bundle; | |
//import android.support.customtabs.CustomTabsClient; | |
import android.support.customtabs.CustomTabsIntent; | |
//import android.support.customtabs.CustomTabsServiceConnection; | |
//import android.support.customtabs.CustomTabsSession; | |
import android.support.v4.content.ContextCompat; | |
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
// Use a CustomTabsIntent.Builder to configure CustomTabsIntent. | |
String url = "http://www.thaiall.com/actress/missgrand2017"; | |
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); | |
// set toolbar color and/or setting custom actions before invoking build() | |
// Once ready, call CustomTabsIntent.Builder.build() to create a CustomTabsIntent | |
CustomTabsIntent customTabsIntent = builder.build(); | |
// and launch the desired Url with CustomTabsIntent.launchUrl() | |
customTabsIntent.launchUrl(this, Uri.parse(url)); | |
// set toolbar color | |
builder.setToolbarColor(ContextCompat.getColor(this, R.color.colorAccent)); | |
// add share action to menu list | |
builder.addDefaultShareMenuItem(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment