Intent.使用小结

Intent.使用小结,第1张

概述打电话 Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(“tel:12345678”)); startActivity(callIntent);权限拒绝后就不能再拨打电话了,6.0后可以加一个权限管理对于这种危险权限通过一个url跳转到一个网页 @Override pub 打电话


Intent callintent = new Intent(Intent.ACTION_CALL,Uri.parse(“tel:12345678”));
startActivity(callintent);

权限拒绝后就不能再拨打电话了,6.0后可以加一个权限管理对于这种危险权限

通过一个url跳转到一个网页
    @OverrIDe      public voID onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);          setContentVIEw(R.layout.activity_main);          button = (button)findVIEwByID(R.ID.button1);             button.setonClickListener(new MyListener());            final Uri uri = Uri.parse("http://weibo.cn/qlyh");          intent = new Intent(Intent.ACTION_VIEW,uri);            timer = new Timer();      }      class MyTimerTask extends TimerTask {          @OverrIDe          public voID run() {              startActivity(intent);          }         }          class MyListener implements OnClickListener {          public voID onClick(VIEw v) {              if(task != null)                  task.cancel();              task = new MyTimerTask();              timer.schedule(task,1000);          }      } 
使用Intent在onReceive中跳转
package com.jack.buttonkeytest;import androID.content.broadcastReceiver;import androID.content.Context;import androID.content.Intent;public class MyReceiver extends broadcastReceiver{    @OverrIDe    public voID onReceive( Context context,Intent intent) {        final Context c = context;        new Thread(){            @OverrIDe            public voID run() {                super.run();                Intent intent = new Intent(c,ShowActivity.class);                c.startActivity(intent);            }        }.start();    }}

推荐阅读:

Intent或持久化存储处理复杂对象

总结

以上是内存溢出为你收集整理的Intent.使用小结全部内容,希望文章能够帮你解决Intent.使用小结所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1089411.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存