zoukankan      html  css  js  c++  java
  • Android开发-实现第三方APP跳转

    自己创建一个按钮:

    <Button
    android:id="@+id/btn_button"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="******"/>

    实现方法:
    btn_button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
    PackageManager packageManager = ContextHolder.getContext().getPackageManager();
    Intent intent = packageManager.getLaunchIntentForPackage("******"); //“******”里面填写项目的包名
    ContextHolder.getContext().startActivity(intent);
    }
    });

    创建一个类:

    //实现Application的Context引用
    class ContextHolder {
    static Context ApplicationContext;
    public static void initial(Context context) {
    ApplicationContext = context;
    }
    public static Context getContext() {
    return ApplicationContext;
    }
    }
  • 相关阅读:
    【HDOJ】1224 Free DIY Tour
    【HDOJ】1494 跑跑卡丁车
    【HDOJ】1495 非常可乐
    ACMer
    find the nth digit
    A C
    已知六条边的边长,求四面体体积
    快速排序
    {A} + {B}
    素数回文
  • 原文地址:https://www.cnblogs.com/yunting/p/11007898.html
Copyright © 2011-2022 走看看