PackageManager manager = getContext().getPackageManager(); if (manager.queryIntentActivities(intent, 0).size() > 0) { startActivity(intent); } // Verify that the intent will resolve to an activity if (sendIntent.resolveActivity(getPackageManager()) !
在一个Activity环境中用该方法启动一个一个activity不会出任何问题,但在activity之外的其他组件中使用该方法就会出现以下错误: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Context 中有一个startActivity方法,Activity继承自Context,重载了startActivity方法.如果使用Acti
//判断时间是否过期 function judgeTime(time){ var strtime = time.replace("/-/g", "/");//时间转换 //时间 var date1=new Date(strtime); //现在时间 var date2=new Date(); //判断时间是否过期 return date1<date2?true:false; }