第一种方法:最简单实用的
Intent intent = new Intent(MainActivity.this,SecondActivity.class);
startActivity(intent);
方法二:一般不会用这个吧
Intent intent=new Intent();
ComponentName componentName = new ComponentName(MainActivity.this,SecondActivity.class);
intent.setComponent(componentName);
startActivity(intent);
跳转系统浏览器
Intent intent=new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri url = Uri.parse("https://baidu.com");
intent.setData(url);
startActivity(intent);
打开图库
Intent intent=new Intent();
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivity(intent);
发短信
Intent intent=new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT,"I am boy");
startActivity(intent);
打电话
Intent intent=new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri url = Uri.parse("tel:10086");
intent.setData(url);
startActivity(intent);
热门评论
收藏了ヾ(^▽^*)))