Demo entry 6350177

da

   

Submitted by anonymous on Mar 07, 2017 at 09:31
Language: Java. Code size: 2.8 kB.

    private void ClearRecordNum(){
        ContentValues valuesNum = new ContentValues();
        valuesNum.put("totalNum", 0);
		getContentResolver().update(Uri.parse("content://"+"com.mykjk12.service.datamanagement.provide.apprecord"), valuesNum, "_id =?", new String[]{1+""});
		 Log.e("ISD_APP","ClearRecordNum  ");
    }
    
    private void queryAppNameAndTime(){
    	int num = queryNum();
  
        Log.e("ISD_APP","queryAppNameAndTime   num  = "+num);
        if(num >  200){
            num =  num % 200;
            for(int j = num; j < 200 ;j ++){
                Cursor c = getContentResolver().query(Uri.parse("content://"+ "com.mykjk12.service.datamanagement.provide.apprecord" ), null , "_id" + "=?", new String[] {j+1+""}, null);
                Log.e("ISD_APP","queryAppNameAndTime c = "+c);
                if (c != null) {
        		    if (c.moveToFirst()){
        			     String name = c.getString(c.getColumnIndexOrThrow("name"));
        			     String startTime = c.getString(c.getColumnIndexOrThrow("startTime"));
        			     String endTime = c.getString(c.getColumnIndexOrThrow("endTime"));
        			     Log.e("ISD_APP","queryAppNameAndTime num"+j+" name = "+name+" ; startTime =  "+startTime+" ; endTime = "+endTime);
        			}
                    c.close();
                }
        	}
        }
    	for(int i = 0; i < num ;i ++){
            Cursor c = getContentResolver().query(Uri.parse("content://"+ "com.mykjk12.service.datamanagement.provide.apprecord" ), null , "_id" + "=?", new String[] {i+1+""}, null);
            Log.e("ISD_APP","queryAppNameAndTime c = "+c);
            if (c != null) {
    			if (c.moveToFirst()){
    				 String name = c.getString(c.getColumnIndexOrThrow("name"));
    				 String startTime = c.getString(c.getColumnIndexOrThrow("startTime"));
    				 String endTime = c.getString(c.getColumnIndexOrThrow("endTime"));
    				 Log.e("ISD_APP","queryAppNameAndTime num"+i+" name = "+name+" ; startTime =  "+startTime+" ; endTime = "+endTime);
    			}
                c.close();
            }
    	}
    }
    
    private int queryNum() {
        int result = 0;
        Cursor c =  getContentResolver().query(Uri.parse("content://"+ "com.mykjk12.service.datamanagement.provide.apprecord" ), null , "_id" + "=?", new String[] {"1"}, null);
        if (c != null) {
			if (c.moveToFirst()){
                result = c.getInt(c.getColumnIndexOrThrow("totalNum"));
                Log.e("ISD_APP","queryNum result  = "+result);
            }else{
                Log.e("ISD_APP","queryNum c  = null ");
            }
            c.close();
        }
        Log.e("ISD_APP","queryNum 2222222222  result  = "+result);
		return result;
   	

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).