赞
踩
- try {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/jaredrummler/MaterialSpinner")));
- } catch (ActivityNotFoundException ignored) {
- }
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:"+phone));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Intent intent=new Intent(); //设置打电话行为 // intent.setAction(Intent.ACTION_CALL); intent.setAction(Intent.ACTION_DIAL); //设置数据,此处为电话号码 // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse("tel:12345678901")); startActivity(intent);
- //发送短信
- private void sendSMSS() {
- Log.e("lgqq","....fa");
- String content = nret.getText().toString().trim();//短信内容
- String phone = telet.getText().toString().trim();//电话号码
- if (!content.isEmpty() && !phone.isEmpty()) {
- SmsManager manager = SmsManager.getDefault();
- ArrayList<String> strings = manager.divideMessage(content);
- for (int i = 0; i < strings.size(); i++) {
- manager.sendTextMessage(phone, null, content, null, null);
- }
- Toast.makeText(DiweiActivity.this, "发送成功", Toast.LENGTH_SHORT).show();
- } else {
- Toast.makeText(this, "手机号或内容不能为空", Toast.LENGTH_SHORT).show();
- return;
- }
- }
private static final int SEND_SMS = 100; private void requestPermission() { //判断Android版本是否大于23 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { int checkCallPhonePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.SEND_SMS); if (checkCallPhonePermission != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.SEND_SMS}, SEND_SMS); Log.e("lgqq","...222.fa=="+checkCallPhonePermission); return; } else { Log.e("lgqq","..222244444..fa"); sendSMSS(); //已有权限 } } else { //API 版本在23以下 sendSMSS(); } }
1、权限
<uses-permission android:name="android.permission.VIBRATE"/>
2、初始化
private Vibrator vibrator;
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
3、开始震动
(1)一次性震动
vibrator.vibrate(10);//10震动时长
(2)波浪性震动
开启
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
vibrator.vibrate(VibrationEffect.createWaveform(new long[]{100L, 2000L, 1000L, 1000L, 3000L}, -1));
} else {
vibrator.vibrate(new long[]{100L, 2000L, 1000L, 1000L, 3000L}, 0);
}
关闭
vibrator.cancel();
预览淘宝
- public void toshop(String tbPath){
-
-
- Intent intent = new Intent();
- intent.setAction("Android.intent.action.VIEW");
- Uri uri = Uri.parse(tbPath); // 商品地址
- intent.setData(uri);
- //详情页
- // intent.setClassName("com.taobao.taobao", "com.taobao.tao.detail.activity.DetailActivity");
- //店铺
- intent.setClassName("com.taobao.taobao", "com.taobao.android.shop.activity.ShopHomePageActivity");
- startActivity(intent);
- }
- NotificationManagerCompat manager = NotificationManagerCompat.from(App.getTotalContext());
- boolean isOpened = manager.areNotificationsEnabled();
- if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- Intent intent = new Intent();
- intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
- intent.putExtra("app_package", getActivity().getPackageName());
- intent.putExtra("app_uid", getActivity().getApplicationInfo().uid);
- startActivity(intent);
- } else if (android.os.Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
- Intent intent = new Intent();
- intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
- intent.addCategory(Intent.CATEGORY_DEFAULT);
- intent.setData(Uri.parse("package:" + getActivity().getPackageName()));
- startActivity(intent);
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。