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


Java Log.d方法代码示例

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


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

示例1: doDiscovery

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * Start device discover with the BluetoothAdapter
 */
private void doDiscovery() {
    Log.d(TAG, "doDiscovery()");

    // Indicate scanning in the title
    setProgressBarIndeterminateVisibility(true);
    setTitle(R.string.scanning);

    // Turn on sub-title for new devices
    findViewById(R.id.title_new_devices).setVisibility(View.VISIBLE);

    // If we're already discovering, stop it
    if (mBtAdapter.isDiscovering()) {
        mBtAdapter.cancelDiscovery();
    }

    // Request discover from BluetoothAdapter
    mBtAdapter.startDiscovery();
}
 
开发者ID:hardik-dadhich,项目名称:bluetooth-chat-appliction,代码行数:22,代码来源:DeviceListActivity.java

示例2: connect

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * Start the ConnectThread to initiate a connection to a remote device.
 *
 * @param device The BluetoothDevice to connect
 * @param secure Socket Security type - Secure (true) , Insecure (false)
 */
public synchronized void connect(BluetoothDevice device, boolean secure) {
    Log.d(TAG, "connect to: " + device);

    // Cancel any thread attempting to make a connection
    if (mState == STATE_CONNECTING) {
        if (mConnectThread != null) {
            mConnectThread.cancel();
            mConnectThread = null;
        }
    }

    // Cancel any thread currently running a connection
    if (mConnectedThread != null) {
        mConnectedThread.cancel();
        mConnectedThread = null;
    }

    // Start the thread to connect with the given device
    mConnectThread = new ConnectThread(device, secure);
    mConnectThread.start();
    // Update UI title
    updateUserInterfaceTitle();
}
 
开发者ID:hardik-dadhich,项目名称:bluetooth-chat-appliction,代码行数:30,代码来源:BluetoothChatService.java

示例3: close

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * Closes the disk cache associated with this ImageCache object. Note that this includes
 * disk access so this should not be executed on the main/UI thread.
 */
public void close() {
    synchronized (mDiskCacheLock) {
        if (mDiskLruCache != null) {
            try {
                if (!mDiskLruCache.isClosed()) {
                    mDiskLruCache.close();
                    mDiskLruCache = null;
                    if (BuildConfig.DEBUG) {
                        Log.d(TAG, "Disk cache closed");
                    }
                }
            } catch (IOException e) {
                Log.e(TAG, "close - " + e);
            }
        }
    }
}
 
开发者ID:gavinking,项目名称:DisplayingBitmaps,代码行数:22,代码来源:ImageCache.java

示例4: flushCacheInternal

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
@Override
protected void flushCacheInternal() {
    super.flushCacheInternal();
    synchronized (mHttpDiskCacheLock) {
        if (mHttpDiskCache != null) {
            try {
                mHttpDiskCache.flush();
                if (BuildConfig.DEBUG) {
                    Log.d(TAG, "HTTP cache flushed");
                }
            } catch (IOException e) {
                Log.e(TAG, "flush - " + e);
            }
        }
    }
}
 
开发者ID:gavinking,项目名称:DisplayingBitmaps,代码行数:17,代码来源:ImageFetcher.java

示例5: onPostExecute

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * Once the image is processed, associates it to the imageView
 */
@Override
protected void onPostExecute(BitmapDrawable value) {
    //BEGIN_INCLUDE(complete_background_work)
    boolean success = false;
    // if cancel was called on this task or the "exit early" flag is set then we're done
    if (isCancelled() || mExitTasksEarly) {
        value = null;
    }

    final ImageView imageView = getAttachedImageView();
    if (value != null && imageView != null) {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "onPostExecute - setting bitmap");
        }
        success = true;
        setImageDrawable(imageView, value);
    }
    if (mOnImageLoadedListener != null) {
        mOnImageLoadedListener.onImageLoaded(success);
    }
    //END_INCLUDE(complete_background_work)
}
 
开发者ID:jjuiddong,项目名称:Android-Practice,代码行数:26,代码来源:ImageWorker.java

示例6: onActivityResult

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
        case REQUEST_CONNECT_DEVICE_SECURE:
            // When DeviceListActivity returns with a device to connect
            if (resultCode == Activity.RESULT_OK) {
                connectDevice(data, true); //deleting this prevents crash
            }
            break;

        case REQUEST_ENABLE_BT:
            // When the request to enable Bluetooth returns
            if (resultCode == Activity.RESULT_OK) {
                // Bluetooth is now enabled, so set up a chat session
                setupChat();
            } else {
                // User did not enable Bluetooth or an error occurred
                Log.d(TAG, "BT not enabled");
                Toast.makeText(getActivity(), R.string.bt_not_enabled_leaving,
                        Toast.LENGTH_SHORT).show();
                getActivity().finish();
            }
    }
}
 
开发者ID:tkmarsh,项目名称:SmartRC,代码行数:24,代码来源:BluetoothChatFragment.java

示例7: doDiscovery

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
private void doDiscovery() {
    Log.d(TAG, "doDiscovery()");

    // Indicate scanning in the title
    setProgressBarIndeterminateVisibility(true);
    setTitle(R.string.scanning);

    // Turn on sub-title for new devices
    findViewById(R.id.title_new_devices).setVisibility(View.VISIBLE);

    // If we're already discovering, stop it
    if (mBtAdapter.isDiscovering()) {
        mBtAdapter.cancelDiscovery();
    }

    // Request discover from BluetoothAdapter
    mBtAdapter.startDiscovery();
}
 
开发者ID:tkmarsh,项目名称:SmartRC,代码行数:19,代码来源:DeviceListActivity.java

示例8: initHttpDiskCache

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
private void initHttpDiskCache() {
    if (!mHttpCacheDir.exists()) {
        mHttpCacheDir.mkdirs();
    }
    synchronized (mHttpDiskCacheLock) {
        if (ImageCache.getUsableSpace(mHttpCacheDir) > HTTP_CACHE_SIZE) {
            try {
                mHttpDiskCache = DiskLruCache.open(mHttpCacheDir, 1, 1, HTTP_CACHE_SIZE);
                if (BuildConfig.DEBUG) {
                    Log.d(TAG, "HTTP cache initialized");
                }
            } catch (IOException e) {
                mHttpDiskCache = null;
            }
        }
        mHttpDiskCacheStarting = false;
        mHttpDiskCacheLock.notifyAll();
    }
}
 
开发者ID:gavinking,项目名称:DisplayingBitmaps,代码行数:20,代码来源:ImageFetcher.java

示例9: cancelPotentialWork

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * Returns true if the current work has been canceled or if there was no work in
 * progress on this image view.
 * Returns false if the work in progress deals with the same data. The work is not
 * stopped in that case.
 */
public static boolean cancelPotentialWork(Object data, ImageView imageView) {
    //BEGIN_INCLUDE(cancel_potential_work)
    final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);

    if (bitmapWorkerTask != null) {
        final Object bitmapData = bitmapWorkerTask.mData;
        if (bitmapData == null || !bitmapData.equals(data)) {
            bitmapWorkerTask.cancel(true);
            if (BuildConfig.DEBUG) {
                Log.d(TAG, "cancelPotentialWork - cancelled work for " + data);
            }
        } else {
            // The same work is already in progress.
            return false;
        }
    }
    return true;
    //END_INCLUDE(cancel_potential_work)
}
 
开发者ID:jjuiddong,项目名称:Android-Practice,代码行数:26,代码来源:ImageWorker.java

示例10: setupChat

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * Set up the UI and background operations for chat.
 */
private void setupChat() {
    Log.d(TAG, "setupChat()");

    // Initialize the array adapter for the conversation thread
    mConversationArrayAdapter = new ArrayAdapter<String>(getActivity(), R.layout.message);

    mConversationView.setAdapter(mConversationArrayAdapter);

    // Initialize the compose field with a listener for the return key
    mOutEditText.setOnEditorActionListener(mWriteListener);

    // Initialize the send button with a listener that for click events
    mSendButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Send a message using content of the edit text widget
            View view = getView();
            if (null != view) {
                TextView textView = (TextView) view.findViewById(R.id.edit_text_out);
                String message = textView.getText().toString();
                sendMessage(message);
            }
        }
    });

    // Initialize the BluetoothChatService to perform bluetooth connections
    mChatService = new BluetoothChatService(getActivity(), mHandler);

    // Initialize the buffer for outgoing messages
    mOutStringBuffer = new StringBuffer("");
}
 
开发者ID:hardik-dadhich,项目名称:bluetooth-chat-appliction,代码行数:34,代码来源:BluetoothChatFragment.java

示例11: onActivityResult

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
        case REQUEST_CONNECT_DEVICE_SECURE:
            // When DeviceListActivity returns with a device to connect
            if (resultCode == Activity.RESULT_OK) {
                connectDevice(data, true);
            }
            break;
        case REQUEST_CONNECT_DEVICE_INSECURE:
            // When DeviceListActivity returns with a device to connect
            if (resultCode == Activity.RESULT_OK) {
                connectDevice(data, false);
            }
            break;
        case REQUEST_ENABLE_BT:
            // When the request to enable Bluetooth returns
            if (resultCode == Activity.RESULT_OK) {
                // Bluetooth is now enabled, so set up a chat session
                setupChat();
            } else {
                // User did not enable Bluetooth or an error occurred
                Log.d(TAG, "BT not enabled");
                Toast.makeText(getActivity(), R.string.bt_not_enabled_leaving,
                        Toast.LENGTH_SHORT).show();
                getActivity().finish();
            }
    }
}
 
开发者ID:hardik-dadhich,项目名称:bluetooth-chat-appliction,代码行数:29,代码来源:BluetoothChatFragment.java

示例12: processBitmap

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * The main processing method. This happens in a background task. In this case we are just
 * sampling down the bitmap and returning it from a resource.
 *
 * @param resId
 * @return
 */
private Bitmap processBitmap(int resId) {
    if (BuildConfig.DEBUG) {
        Log.d(TAG, "processBitmap - " + resId);
    }
    return decodeSampledBitmapFromResource(mResources, resId, mImageWidth,
            mImageHeight, getImageCache());
}
 
开发者ID:jjuiddong,项目名称:Android-Practice,代码行数:15,代码来源:ImageResizer.java

示例13: start

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * Start the chat service. Specifically start AcceptThread to begin a
 * session in listening (server) mode. Called by the Activity onResume()
 */
public synchronized void start() {
    Log.d(TAG, "start");

    // Cancel any thread attempting to make a connection
    if (mConnectThread != null) {
        mConnectThread.cancel();
        mConnectThread = null;
    }

    // Cancel any thread currently running a connection
    if (mConnectedThread != null) {
        mConnectedThread.cancel();
        mConnectedThread = null;
    }

    // Start the thread to listen on a BluetoothServerSocket
    if (mSecureAcceptThread == null) {
        mSecureAcceptThread = new AcceptThread(true);
        mSecureAcceptThread.start();
    }
    if (mInsecureAcceptThread == null) {
        mInsecureAcceptThread = new AcceptThread(false);
        mInsecureAcceptThread.start();
    }
    // Update UI title
    updateUserInterfaceTitle();
}
 
开发者ID:hardik-dadhich,项目名称:bluetooth-chat-appliction,代码行数:32,代码来源:BluetoothChatService.java

示例14: checkState

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
private synchronized void checkState() {
    //BEGIN_INCLUDE(check_state)
    // If the drawable cache and display ref counts = 0, and this drawable
    // has been displayed, then recycle
    if (mCacheRefCount <= 0 && mDisplayRefCount <= 0 && mHasBeenDisplayed
            && hasValidBitmap()) {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "No longer being used or cached so recycling. "
                    + toString());
        }

        getBitmap().recycle();
    }
    //END_INCLUDE(check_state)
}
 
开发者ID:gavinking,项目名称:DisplayingBitmaps,代码行数:16,代码来源:RecyclingBitmapDrawable.java

示例15: initDiskCache

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * Initializes the disk cache.  Note that this includes disk access so this should not be
 * executed on the main/UI thread. By default an ImageCache does not initialize the disk
 * cache when it is created, instead you should call initDiskCache() to initialize it on a
 * background thread.
 */
public void initDiskCache() {
    // Set up disk cache
    synchronized (mDiskCacheLock) {
        if (mDiskLruCache == null || mDiskLruCache.isClosed()) {
            File diskCacheDir = mCacheParams.diskCacheDir;
            if (mCacheParams.diskCacheEnabled && diskCacheDir != null) {
                if (!diskCacheDir.exists()) {
                    diskCacheDir.mkdirs();
                }
                if (getUsableSpace(diskCacheDir) > mCacheParams.diskCacheSize) {
                    try {
                        mDiskLruCache = DiskLruCache.open(
                                diskCacheDir, 1, 1, mCacheParams.diskCacheSize);
                        if (BuildConfig.DEBUG) {
                            Log.d(TAG, "Disk cache initialized");
                        }
                    } catch (final IOException e) {
                        mCacheParams.diskCacheDir = null;
                        Log.e(TAG, "initDiskCache - " + e);
                    }
                }
            }
        }
        mDiskCacheStarting = false;
        mDiskCacheLock.notifyAll();
    }
}
 
开发者ID:jjuiddong,项目名称:Android-Practice,代码行数:34,代码来源:ImageCache.java


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