本文整理汇总了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");
}
示例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);
}
示例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");
}
示例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;
}
}
}
示例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();
}
示例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);
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}