当前位置: 首页>>代码示例>>Java>>正文


Java Log.d方法代码示例

本文整理汇总了Java中android.util.Log.d方法的典型用法代码示例。如果您正苦于以下问题:Java Log.d方法的具体用法?Java Log.d怎么用?Java Log.d使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.util.Log的用法示例。


在下文中一共展示了Log.d方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectTrack

import android.util.Log; //导入方法依赖的package包/类
private MediaFormat selectTrack(MediaExtractor extractor) {
    int trackCount = extractor.getTrackCount();
    Log.d(TAG, "trackCount :" + trackCount);

    MediaFormat format;
    for (int i = 0; i < trackCount; i++) {
        extractor.selectTrack(i);
        format = extractor.getTrackFormat(i);
        Log.d(TAG, "Track media format :" + format.toString());

        String mime = format.getString(MediaFormat.KEY_MIME);
        if (mime.startsWith("video/")) {
            return format;
        }
    }

    return null;
}
 
开发者ID:ficklerobot,项目名称:grid-video-viewer,代码行数:19,代码来源:DecodeThread.java

示例2: getWeather

import android.util.Log; //导入方法依赖的package包/类
private void getWeather() {
    Log.d("weather", "getWeather");
    weatherHolder.setVisibility(View.VISIBLE);

    String lat = sharedPref.getString("Latitude", "");
    String lng = sharedPref.getString("Longitude", "");

    if (!lat.equals("") && !lng.equals("")) {
        String apiStr = "https://api.thinkpage.cn/v3/weather/daily.json?key=txyws41isbyqnma5&" +
                "location=" + lat + ":" + lng + "&language=zh-Hans&unit=c";
        getWeatherTask = new GetWeather().execute(apiStr);
        Log.d("weather", "Location already know");
    } else {
        Log.d("weather", "startLocation");
        mLocationClient.startLocation();
    }
}
 
开发者ID:SEALiu,项目名称:Calendouer,代码行数:18,代码来源:MainActivity.java

示例3: onOptionsItemSelected

import android.util.Log; //导入方法依赖的package包/类
/**
 * Handler when menu item is selected
 * @param item
 * @return
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Log.d(TAG, "item:" + item.getItemId());
    switch (item.getItemId()) {
        // Respond to the action bar's Up/Home button
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;
        case SAVE_BUTTON_ID:
            saveEvent();
            Toast.makeText(this, "Habit event saved!", Toast.LENGTH_SHORT).show();
            NavUtils.navigateUpFromSameTask(this);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:CMPUT301F17T13,项目名称:cat-is-a-dog,代码行数:22,代码来源:AddHabitEventActivity.java

示例4: write

import android.util.Log; //导入方法依赖的package包/类
/**
 * Write text to the display.
 *
 * @param text text to write. Make sure that max line length is 16 and you provide maximum 2 lines.
 */
@Override
public void write(@NonNull String text) {
    try {

        Log.d(TAG, "write: Printing - " + text);
        mLcd.clear();

        //Split by new lines.
        String[] lines = text.split("\n");
        if (lines.length > 2) throw new RuntimeException("Cannot print more than 2 lines.");

        //Print the line 1
        for (String line : lines) {
            mLcd.print(line);
            //Move the cursor to line 2
            mLcd.setCursor(0, 1);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:kevalpatel2106,项目名称:robo-car,代码行数:27,代码来源:LcdDisplay.java

示例5: onCreate

import android.util.Log; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second);
    findViewById(R.id.button1).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setClass(SecondActivity.this, ThirdActivity.class);
            intent.putExtra("time", System.currentTimeMillis());
            startActivity(intent);
        }
    });
    Log.d(TAG, "onCreate");
}
 
开发者ID:didi,项目名称:VirtualAPK,代码行数:17,代码来源:SecondActivity.java

示例6: test_0_reflect

import android.util.Log; //导入方法依赖的package包/类
@Test
public void test_0_reflect() {
    Class<TestController> testController = TestController.class;

    Controller con = testController.getAnnotation(Controller.class);
    Log.d("gws:", con.value());
    Field[] fields = testController.getFields();
    for (Field field : fields) {
        Log.i("yyd", "field.getName()--->" + field.getName());
    }

    try {
        Class[] classes = new Class[]{int.class, String.class};
        Method method = testController.getMethod("testJson", classes);//若有参数,则参数类的填写是必须的,不然会找不到
        RequestMapping requestMapping = method.getAnnotation(RequestMapping.class);
        Log.d("gws:", requestMapping.value().toString());
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }

}
 
开发者ID:dwdyoung,项目名称:AndroidWeb,代码行数:22,代码来源:ReflectTest.java

示例7: createRepeaterConfig

import android.util.Log; //导入方法依赖的package包/类
private DatagramSocketConfig createRepeaterConfig(){
    final String tag="createRepeaterConfig - ";
    DatagramSocketConfig result=null;

    final String repeatHost = SettingsUtils.getInstance().parseFromPreferencesAisMessagesDestinationHost();
    final int repeatPort = SettingsUtils.getInstance().parseFromPreferencesAisMessagesDestinationPort();

    String informText="Not repeating NMEA messages.";
    if (repeatHost!=null && !(repeatHost.equals(NMEA_UDP_HOST) && repeatPort==NMEA_UDP_PORT)) {
        result = new DatagramSocketConfig(repeatHost,repeatPort);
        if (validateDatagramSocketConfig(result)) {
            informText="Repeating NMEA messages to UDP: " + result;
Toast.makeText(this,informText,Toast.LENGTH_LONG).show();
            Analytics.getInstance().logEvent(TAG,"NMEA Repeater","repeatHost: "+repeatHost+", repeatPort: "+repeatPort);
        } else {
            result=null;
        }
    } else {
        informText="IGNORE NMEA repeat setting: Asked to repeat to build in address:port or invalid settings.";
    }

    Log.d(TAG,tag+informText);

    return result;
}
 
开发者ID:videgro,项目名称:Ships,代码行数:26,代码来源:NmeaClientService.java

示例8: handleMessage

import android.util.Log; //导入方法依赖的package包/类
@Override  // runs on UI thread
public void handleMessage(Message inputMessage) {
    int what = inputMessage.what;
    Log.d(TAG, "CameraHandler [" + this + "]: what=" + what);

    CameraCaptureActivity activity = mWeakActivity.get();
    if (activity == null) {
        Log.w(TAG, "CameraHandler.handleMessage: activity is null");
        return;
    }

    switch (what) {
        case MSG_SET_SURFACE_TEXTURE:
            activity.handleSetSurfaceTexture((SurfaceTexture) inputMessage.obj);
            break;
        default:
            throw new RuntimeException("unknown msg " + what);
    }
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:20,代码来源:CameraCaptureActivity.java

示例9: printJson

import android.util.Log; //导入方法依赖的package包/类
public static void printJson(int type, String tag, String msg, String headString) {

        String message;

        try {
            if (msg.startsWith("{")) {
                JSONObject jsonObject = new JSONObject(msg);
                message = jsonObject.toString(KLog.JSON_INDENT);
            } else if (msg.startsWith("[")) {
                JSONArray jsonArray = new JSONArray(msg);
                message = jsonArray.toString(KLog.JSON_INDENT);
            } else {
                message = msg;
            }
        } catch (JSONException e) {
            message = msg;
        }

        KLogUtil.printLine(type, tag, true);
        message = headString + KLog.LINE_SEPARATOR + message;
        String[] lines = message.split(KLog.LINE_SEPARATOR);
        for (String line : lines) {
            switch (type) {
                case D:
                    Log.d(tag, "║ " + line);
                    break;
                case E:
                    Log.e(tag, "║ " + line);
                    break;
                case W:
                    Log.w(tag, "║ " + line);
                    break;
                case I:
                    Log.i(tag, "║ " + line);
                    break;
            }
        }
        KLogUtil.printLine(type, tag, false);
    }
 
开发者ID:weileng11,项目名称:KUtils-master,代码行数:40,代码来源:JsonLog.java

示例10: surfaceCreated

import android.util.Log; //导入方法依赖的package包/类
public void surfaceCreated(SurfaceHolder holder)
   {
Log.d(TAG, "VideoCaptureAndroid::surfaceCreated");
try {
    if(camera != null) {
	camera.setPreviewDisplay(holder);
    }
} catch (IOException e) {
    Log.e(TAG, "Failed to set preview surface!", e);
}
   }
 
开发者ID:d0pam1n,项目名称:pjsip-android,代码行数:12,代码来源:PjCamera.java

示例11: sendConnectStats

import android.util.Log; //导入方法依赖的package包/类
public void sendConnectStats(final String screenName, final Constants.ConnectionState connectionState, final String firmware, final String duration) {
    try {
        if (mShareStatistic) {
            HashMap<Integer, String> eventLabels = new HashMap<>();
            Log.d(TAG, "sendConnectStats, firmware " + firmware + " duration " + duration + " connectionState " + connectionState);

            eventLabels.put(FIRMWARE, TextUtils.isEmpty(firmware) ? "-" : firmware);
            eventLabels.put(DURATION, TextUtils.isEmpty(duration) ? "-" : duration );
            switch (connectionState) {
                case SUCCESS:
                    Log.d(TAG, "Sending Connection stats - MSG(SUCCESS) - Firmware = " + firmware);
                    eventLabels.put(CONNECT_STATUS, "success");
                    break;
                case FAIL:
                    Log.d(TAG, "Sending Connection stats - MSG(Failed)");
                    eventLabels.put(CONNECT_STATUS, "fail");

                    break;
                case DISCONNECT:
                    Log.d(TAG, "Sending Connection stats - MSG(DISCONNECT) - Firmware = " + firmware + " Duration =" + duration);
                    eventLabels.put(CONNECT_STATUS, "disconnect");
                    break;
                default:
                    break;
            }

            sendEvent(screenName, "Connection", "Connect", eventLabels);
        } else {
            Log.d(TAG, "Sharing of stats is disabled by user");
        }
    } catch (RuntimeException e) {
        Log.e(TAG, "Sending stats exception " + e.getMessage());
    }
}
 
开发者ID:Samsung,项目名称:microbit,代码行数:35,代码来源:GoogleAnalyticsManager.java

示例12: updateSize

import android.util.Log; //导入方法依赖的package包/类
private void updateSize() {
  LogUtils.d(TAG, "updateSize");

  if (getWidth() <= 0) {
    Log.d(TAG, "width is still 0, postponing updateSize()");
    postponedResize = true;
    return;
  }

  measureTweet();
  requestLayout();


  fireSizeChange(getWidth(), tweetView.getMeasuredHeight());
}
 
开发者ID:netceteragroup,项目名称:react-native-twitterkit,代码行数:16,代码来源:TweetView.java

示例13: addView

import android.util.Log; //导入方法依赖的package包/类
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
	if (DEBUG) {
		Log.d(LOG_TAG, "addView: " + child.getClass().getSimpleName());
	}

	final T refreshableView = getRefreshableView();

	if (refreshableView instanceof ViewGroup) {
		((ViewGroup) refreshableView).addView(child, index, params);
	} else {
		throw new UnsupportedOperationException("Refreshable View is not a ViewGroup so can't addView");
	}
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:15,代码来源:PullToRefreshBase.java

示例14: andrUpdate

import android.util.Log; //导入方法依赖的package包/类
/**
 * 用于更新XML文件的网络请求
 */
public void andrUpdate(String returnedFileName,String returnedFileId){
    RequestQueue requestQueue = MyApplication.getRequestQueue();
    sharedPreferences = MyApplication.getSharedPreferences();
    userId = sharedPreferences.getString("email","");
    token = sharedPreferences.getString("token","");
    JSONObject jsonObject = new JSONObject();
    String fileName = dialogMsg+"_"+getWorkspaceSavePath();
    try{
        jsonObject.put("fileName",returnedFileName);
        jsonObject.put("fileString",AbstractBlocklyActivity.xmltostring);//AbstractBlocklyActivity.xmltostring
        jsonObject.put("fileId",returnedFileId);//这里应该通过一个方法来判断id的值,先暂时写成这样
        jsonObject.put("userId",userId);
        jsonObject.put("token",token);

    }catch (JSONException e){
        e.printStackTrace();
    }
    Log.d("AndrUpdate_JsonObj",jsonObject.toString());

    JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url_upload, jsonObject, new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {
            uploadReceive uploadReceive = new uploadReceive();
            uploadReceive.setStatus(response.optString("status"));
            uploadReceive.setErrMsg(response.optString("errMsg"));
            Log.d("AndrUpdate_Response",response.toString());

            judge_upload(uploadReceive.getStatus(),uploadReceive.getErrMsg());
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            Log.e("AndrUpdate_Error",error.toString(),error);
        }
    });

    requestQueue.add(jsonObjectRequest);

}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:43,代码来源:LuaActivity.java

示例15: debugLog

import android.util.Log; //导入方法依赖的package包/类
private void debugLog(String message) {
    if (debug) Log.d(TAG, MODULE + ": " + message);
}
 
开发者ID:drtwisted,项目名称:godot-google-play-game-services,代码行数:4,代码来源:GodotPlayGameServices.java


注:本文中的android.util.Log.d方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。