Simplest way to open browser using CustomTabsIntent.Builder

Simplest way to open browser using CustomTabsIntent.Builder - Hello Friend GENERAL INFO FOR ANDROID DEVELOPMENT, In the article you read this time with the title Simplest way to open browser using CustomTabsIntent.Builder, We have prepared this article for you to read and retrieve information there in. Hopefully the contents of postings Artikel Support Library, We write this you can understand. Alright, good read.

The Title : Simplest way to open browser using CustomTabsIntent.Builder
link : Simplest way to open browser using CustomTabsIntent.Builder

Read also


Simplest way to open browser using CustomTabsIntent.Builder


This post show the simplest way to open browser using CustomTabsIntent.Builder.


To use CustomTabsIntent.Builder, edit app/build.gradle to add dependencies of compile 'com.android.support:customtabs:23.0.0'.


MainActivity.java
package com.blogspot.android_er.androidcustomtabsintent;

import android.net.Uri;
import android.os.Bundle;
import android.support.customtabs.CustomTabsIntent;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

Button btnLaunch;
Uri uriMyBlog = Uri.parse("http://android-er.blogspot.com");

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnLaunch = (Button)findViewById(R.id.launch);
btnLaunch.setOnClickListener(btnLaunchOnClickListener);
}

View.OnClickListener btnLaunchOnClickListener = new View.OnClickListener(){

@Override
public void onClick(View v) {
new CustomTabsIntent.Builder()
.build()
.launchUrl(MainActivity.this, uriMyBlog);

}
};
}


activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:orientation="vertical"
tools:context="com.blogspot.android_er.androidcustomtabsintent.MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:text="http://android-er.blogspot.com/"
android:textStyle="bold" />

<Button
android:id="@+id/launch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Launch"/>
</LinearLayout>




Thus Article Simplest way to open browser using CustomTabsIntent.Builder

The End Article Simplest way to open browser using CustomTabsIntent.Builder This time, hopefully can give benefits to all of you. well, see you in posting other articles.

You are now reading the article Simplest way to open browser using CustomTabsIntent.Builder with the link address http://xorislogo.blogspot.com/2016/05/simplest-way-to-open-browser-using.html

0 Response to "Simplest way to open browser using CustomTabsIntent.Builder"

Post a Comment