$cleansearch = strtoupper(filter_var($_POST['search']['value'],FILTER_SANITIZE_STRING));
$searchid = $searchyear ="";
if ($cleansearch==="p" || $cleansearch==="pk"){
$searchid = " pk LIKE '%' ";
} else if (strlen($cleansearch) === 3) {
for($i = 0; $i<10; $i++ ) {
$test = "IR".$i;
if($test===$cleansearch){
$searchid= "pk LIKE '%' ";
$searchyear= " AND LEFT(DATE_FORMAT(year,'%y'), 1) =$i ";
}
}
} elseif ((strlen($cleansearch) === 4) || (
((strlen($cleansearch)=== 5 && "-"===substr($cleansearch,4,1)) ||
(strlen($cleansearch)=== 6 && "-D"===substr($cleansearch,4,2))))){
$cleansearch=substr($cleansearch,0,4);
for($i = 10; $i<100; $i++ ) {
$test = "IR".$i;
if($test===$cleansearch){
$searchid= "pk LIKE '%' ";
$searchyear= " AND DATE_FORMAT(year,'%y') =$i ";
}
}
} elseif (strlen($cleansearch) > 6 && "-D"===substr($cleansearch,4,2) ) {
for($i = 10; $i<100; $i++ ) {
$test = "IR".$i;
if($test===substr($cleansearch,0,4) ){
$searchyear= " AND DATE_FORMAT(year,'%y') =$i ";
}
}
$searchid= " LPAD(pk,4,'0') LIKE '".substr($cleansearch,6)."%' ";
}
if(!empty($searchid)){
$wheresearchterm = " OR (".$searchid . $searchyear.") ";
} else {
$wheresearchterm = "";
}
$query = "SELECT pk, year FROM myTable WHERE 1 $wheresearchterm;";//The search query
如图所示,相应版本文件夹中只有两个布局文件。我正在测试API 22设备,所以它应该从layout-v14中选择布局,而不是让layout-v10文件膨胀。
如果我点击视图上的控制,那么android studio会在工作室中打开v14布局,如下图所示。
v10布局文件夹没有该视图。
当我的设备在API22上运行时,为什么我的设备选择v10布局而不是v14。
当我点击TextView时,它应该变成一个闪亮的文本,这已经工作了几个星期。但今天它正在抛弃NPE。
if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
ShimmerTextView mShimmerTextView = (ShimmerTextView) findViewById(R.id.shimmerMotion);
new Shimmer().start(mShimmerTextView);
}