0

I want to set Webview as fallback of chrome custom tab. If user don't have chrome installed on their mobile I want Webview to open url in the app.

public class Main3Activity extends AppCompatActivity {
    static final String SITE_URL = "http://secure.shopershop.in/amazon-mobile-accessories";
    static final String SITE_URL1 = "http://secure.shopershop.in/flipkart-mobile-accessories";
    CustomTabsIntent customTabsIntent;
    CustomTabsIntent.Builder intentBuilder;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);
        AdView mAdView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);
        setTitle("Mobile Accessories");
        intentBuilder = new CustomTabsIntent.Builder();
        intentBuilder.setToolbarColor(ContextCompat.getColor(this, R.color.colorPrimary));
        intentBuilder.setExitAnimations(this, R.anim.right_to_left_end, R.anim.left_to_right_end);
        intentBuilder.setStartAnimations(this, R.anim.left_to_right_start, R.anim.right_to_left_start);
        intentBuilder.setSecondaryToolbarColor(ContextCompat.getColor(this, R.color.colorPrimary));

        customTabsIntent = intentBuilder.build();
        intentBuilder.addDefaultShareMenuItem();
        intentBuilder.setCloseButtonIcon(BitmapFactory.decodeResource(
                getResources(), R.drawable.ic_arrow_back_black_24dp));
    }

    public void performAction(View arg0) {
        customTabsIntent.launchUrl(this, Uri.parse(SITE_URL));
    }

    public void performAction1 (View arg0) {
        customTabsIntent.launchUrl(this, Uri.parse(SITE_URL1));
    }
}
anticafe
  • 6,816
  • 9
  • 43
  • 74
  • No one wants to review or debug your code. What is your specific question? –  Aug 16 '17 at 18:07
  • I am sorry I want to set Webview as fall back of chrome custom tab. If user don;' have chrome install on their mobile I want webview to open url in the app... – Amit Barua Aug 16 '17 at 18:25
  • Details like this should not be comments, but rather edited directly into the body of the question. See https://stackoverflow.com/help/how-to-ask –  Aug 16 '17 at 18:26

0 Answers0