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


Java Log.i方法代码示例

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


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

示例1: initializeLogging

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/** Create a chain of targets that will receive log data */
@Override
public void initializeLogging() {
    // Wraps Android's native log framework.
    LogWrapper logWrapper = new LogWrapper();
    // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
    Log.setLogNode(logWrapper);

    // Filter strips out everything except the message text.
    MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
    logWrapper.setNext(msgFilter);

    // On screen logging via a fragment with a TextView.
    LogFragment logFragment = (LogFragment) getSupportFragmentManager()
            .findFragmentById(R.id.log_fragment);
    msgFilter.setNext(logFragment.getLogView());

    Log.i(TAG, "Ready");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:MainActivity.java

示例2: onOptionsItemSelected

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * Respond to the user's selection of the Refresh action item. Start the SwipeRefreshLayout
 * progress bar, then initiate the background task that refreshes the content.
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_clear:
            Log.i(LOG_TAG, "Clear menu item selected");
            mListAdapter.clear();
            return true;

        case R.id.menu_refresh:
            Log.i(LOG_TAG, "Refresh menu item selected");

            // We make sure that the SwipeRefreshLayout is displaying it's refreshing indicator
            if (!mSwipeRefreshLayout.isRefreshing()) {
                mSwipeRefreshLayout.setRefreshing(true);
            }

            // Start our refresh background task
            initiateRefresh();

            return true;
    }

    return super.onOptionsItemSelected(item);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:SwipeRefreshMultipleViewsFragment.java

示例3: initializeLogging

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/** Create a chain of targets that will receive log data */
@Override
public void initializeLogging() {
    // Wraps Android's native log framework.
    LogWrapper logWrapper = new LogWrapper();
    // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
    Log.setLogNode(logWrapper);

    // Filter strips out everything except the message text.
    MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
    logWrapper.setNext(msgFilter);

    // On screen logging via a fragment with a TextView.
   LogFragment logFragment = (LogFragment) getSupportFragmentManager().findFragmentById(R.id.log_fragment);
    //msgFilter.setNext(logFragment.getLogView());
    Log.i(TAG, "Ready");
}
 
开发者ID:tkmarsh,项目名称:SmartRC,代码行数:18,代码来源:MainActivity.java

示例4: run

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
public void run() {
    Log.i(TAG, "BEGIN mConnectedThread");
    byte[] buffer = new byte[1024];
    int bytes;

    // Keep listening to the InputStream while connected
    while (true) {
        try {
            // Read from the InputStream
            bytes = mmInStream.read(buffer);

            // Send the obtained bytes to the UI Activity
            mHandler.obtainMessage(Constants.MESSAGE_READ, bytes, -1, buffer)
                    .sendToTarget();

        } catch (IOException e) {
            Log.e(TAG, "disconnected", e);
            connectionLost();
            // Start the service over to restart listening mode
            BluetoothChatService.this.start();
            break;
        }
    }
}
 
开发者ID:tkmarsh,项目名称:SmartRC,代码行数:25,代码来源:BluetoothChatService.java

示例5: initiateRefresh

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * By abstracting the refresh process to a single method, the app allows both the
 * SwipeGestureLayout onRefresh() method and the Refresh action item to refresh the content.
 */
private void initiateRefresh() {
    Log.i(LOG_TAG, "initiateRefresh");

    /**
     * Execute the background task, which uses {@link android.os.AsyncTask} to load the data.
     */
    new DummyBackgroundTask().execute();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:SwipeRefreshListFragmentFragment.java

示例6: onRefreshComplete

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * When the AsyncTask finishes, it calls onRefreshComplete(), which updates the data in the
 * ListAdapter and turns off the progress bar.
 */
private void onRefreshComplete(List<String> result) {
    Log.i(LOG_TAG, "onRefreshComplete");

    // Remove all items from the ListAdapter, and then replace them with the new items
    ArrayAdapter<String> adapter = (ArrayAdapter<String>) getListAdapter();
    adapter.clear();
    for (String cheese : result) {
        adapter.add(cheese);
    }

    // Stop the refreshing indicator
    setRefreshing(false);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:SwipeRefreshListFragmentFragment.java

示例7: initializeLogging

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/** Set up targets to receive log data */
public void initializeLogging() {
    // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
    // Wraps Android's native log framework
    LogWrapper logWrapper = new LogWrapper();
    Log.setLogNode(logWrapper);

    Log.i(TAG, "Ready");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:SampleActivityBase.java

示例8: onRefreshComplete

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * When the AsyncTask finishes, it calls onRefreshComplete(), which updates the data in the
 * ListAdapter and turns off the progress bar.
 */
private void onRefreshComplete(List<String> result) {
    Log.i(LOG_TAG, "onRefreshComplete");

    // Remove all items from the ListAdapter, and then replace them with the new items
    mListAdapter.clear();
    for (String cheese : result) {
        mListAdapter.add(cheese);
    }

    // Stop the refreshing indicator
    mSwipeRefreshLayout.setRefreshing(false);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:SwipeRefreshMultipleViewsFragment.java

示例9: run

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
public void run() {
    Log.i(TAG, "BEGIN mConnectThread SocketType:" + mSocketType);
    setName("ConnectThread" + mSocketType);

    // Always cancel discovery because it will slow down a connection
    mAdapter.cancelDiscovery();

    // Make a connection to the BluetoothSocket
    try {
        // This is a blocking call and will only return on a
        // successful connection or an exception
        mmSocket.connect();
    } catch (IOException e) {
        // Close the socket
        try {
            mmSocket.close();
        } catch (IOException e2) {
            Log.e(TAG, "unable to close() " + mSocketType +
                    " socket during connection failure", e2);
        }
        connectionFailed();
        return;
    }

    // Reset the ConnectThread because we're done
    synchronized (BluetoothChatService.this) {
        mConnectThread = null;
    }

    // Start the connected thread
    connected(mmSocket, mmDevice, mSocketType);
}
 
开发者ID:hardik-dadhich,项目名称:bluetooth-chat-appliction,代码行数:33,代码来源:BluetoothChatService.java

示例10: onOptionsItemSelected

import com.example.android.common.logger.Log; //导入方法依赖的package包/类
/**
 * Respond to the user's selection of the Refresh action item. Start the SwipeRefreshLayout
 * progress bar, then initiate the background task that refreshes the content.
 *
 * <p>A color scheme menu item used for demonstrating the use of SwipeRefreshLayout's color
 * scheme functionality. This kind of menu item should not be incorporated into your app,
 * it just to demonstrate the use of color. Instead you should choose a color scheme based
 * off of your application's branding.
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_refresh:
            Log.i(LOG_TAG, "Refresh menu item selected");

            // We make sure that the SwipeRefreshLayout is displaying it's refreshing indicator
            if (!isRefreshing()) {
                setRefreshing(true);
            }

            // Start our refresh background task
            initiateRefresh();
            return true;

        case R.id.menu_color_scheme_1:
            Log.i(LOG_TAG, "setColorScheme #1");
            item.setChecked(true);

            // Change the colors displayed by the SwipeRefreshLayout by providing it with 4
            // color resource ids
            setColorScheme(R.color.color_scheme_1_1, R.color.color_scheme_1_2,
                    R.color.color_scheme_1_3, R.color.color_scheme_1_4);
            return true;

        case R.id.menu_color_scheme_2:
            Log.i(LOG_TAG, "setColorScheme #2");
            item.setChecked(true);

            // Change the colors displayed by the SwipeRefreshLayout by providing it with 4
            // color resource ids
            setColorScheme(R.color.color_scheme_2_1, R.color.color_scheme_2_2,
                    R.color.color_scheme_2_3, R.color.color_scheme_2_4);
            return true;

        case R.id.menu_color_scheme_3:
            Log.i(LOG_TAG, "setColorScheme #3");
            item.setChecked(true);

            // Change the colors displayed by the SwipeRefreshLayout by providing it with 4
            // color resource ids
            setColorScheme(R.color.color_scheme_3_1, R.color.color_scheme_3_2,
                    R.color.color_scheme_3_3, R.color.color_scheme_3_4);
            return true;
    }

    return super.onOptionsItemSelected(item);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:58,代码来源:SwipeRefreshListFragmentFragment.java


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