本文整理汇总了Java中android.util.Log类的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Log类属于android.util包,在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTouch
import android.util.Log; //导入依赖的package包/类
@Override
public boolean onTouch(View v, MotionEvent event) {
if (Utils.doLog())
Log.d(CLASSNAME,
"mImageIconOnTouchListener.onTouch() >> ACTION = "
+ event.getAction());
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
v.setBackgroundResource(R.drawable.afc_image_button_dark_pressed);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
v.setBackgroundResource(0);
break;
}
return false;
}
示例2: measure
import android.util.Log; //导入依赖的package包/类
public void measure() {
if (!mIsInitialized) {
init();
mIsInitialized = true;
} else {
mFramesCouner++;
if (mFramesCouner % STEP == 0) {
long time = Core.getTickCount();
double fps = STEP * mFrequency / (time - mprevFrameTime);
mprevFrameTime = time;
if (mWidth != 0 && mHeight != 0)
mStrfps = FPS_FORMAT.format(fps) + " [email protected]" + Integer.valueOf(mWidth) + "x" + Integer.valueOf(mHeight);
else
mStrfps = FPS_FORMAT.format(fps) + " FPS";
Log.i(TAG, mStrfps);
}
}
}
示例3: onCreate
import android.util.Log; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
rippleChoiceView = (RoundChoiceView) findViewById(R.id.choicview);
rippleChoiceView.setEnabled(false);
RoundChoiceView rippleChoiceView2 = (RoundChoiceView) findViewById(R.id.choicview2);
rippleChoiceView2.setOnCheckedChangeListener(new RoundChoiceView.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RoundChoiceView view, boolean isChecked) {
Log.i("onCheckedChanged", "onCheckedChanged:" + isChecked);
Toast.makeText(getApplicationContext(), "isChecked:"+isChecked, Toast.LENGTH_SHORT).show();
}
});
handler.postDelayed(runnable, 2000);
}
示例4: chooseOptimalSize
import android.util.Log; //导入依赖的package包/类
private static Size chooseOptimalSize(
final Size[] choices, final int width, final int height, final Size aspectRatio) {
// Collect the supported resolutions that are at least as big as the preview Surface
final List<Size> bigEnough = new ArrayList<>();
for (final Size option : choices) {
if (option.getHeight() >= MINIMUM_PREVIEW_SIZE && option.getWidth() >= MINIMUM_PREVIEW_SIZE) {
Log.i(TAG, "Adding size: " + option.getWidth() + "x" + option.getHeight());
bigEnough.add(option);
} else {
Log.i(TAG, "Not adding size: " + option.getWidth() + "x" + option.getHeight());
}
}
// Pick the smallest of those, assuming we found any
if (bigEnough.size() > 0) {
final Size chosenSize = Collections.min(bigEnough, new CompareSizesByArea());
Log.i(TAG, "Chosen size: " + chosenSize.getWidth() + "x" + chosenSize.getHeight());
return chosenSize;
} else {
Log.e(TAG, "Couldn't find any suitable preview size");
return choices[0];
}
}
示例5: connect
import android.util.Log; //导入依赖的package包/类
/**
* Starts a new Thread and connects to server
*
* @throws IOException
*/
public Thread connect() throws IOException {
this.running = true;
this.readyState = WEBSOCKET_STATE_CONNECTING;
// open socket
socketChannel = SocketChannel.open();
socketChannel.configureBlocking(false);
// set address
socketChannel.connect(new InetSocketAddress(uri.getHost(), port));
// start a thread to make connection
// More info:
// http://groups.google.com/group/android-developers/browse_thread/thread/45a8b53e9bf60d82
// http://stackoverflow.com/questions/2879455/android-2-2-and-bad-address-family-on-socket-connect
System.setProperty("java.net.preferIPv4Stack", "true");
System.setProperty("java.net.preferIPv6Addresses", "false");
selector = Selector.open();
socketChannel.register(selector, SelectionKey.OP_CONNECT);
Log.v("websocket", "Starting a new thread to manage data reading/writing");
Thread th = new Thread(this);
th.start();
// return thread object for explicit closing, if needed
return th;
}
示例6: getAllHongBao
import android.util.Log; //导入依赖的package包/类
private void getAllHongBao(AccessibilityNodeInfo info){
runState=true;
Log.i(TAG,"获取所有红包");
time=System.currentTimeMillis();
List<AccessibilityNodeInfo> list=new ArrayList<AccessibilityNodeInfo>();
//查找出当前页面所有的红包,包括手气红包和口令红包
for(String word:QQ_KEYWORD_HONGBAO){
List<AccessibilityNodeInfo> infolist = info.findAccessibilityNodeInfosByText(word);
if(!infolist.isEmpty()){
for(AccessibilityNodeInfo node:infolist){
//这里进行过滤可点击的红包,放到后面去过滤的话感觉非常操蛋
if(node.getText()==null||
//过滤出包含关键字的节点,只取和关键字相同的
!node.getText().toString().equals(word)||
/**
* 下面这个条件是过滤已拆开的红包
* 如果口令红包的口令设置成"口令红包"
* 会让插件陷入死循环,所以必须加个新的判断条件
* 不过这样会耗费更多的时间,所以口令尽量不要设置成关键字
*/
node.getParent().getChildCount()!=3||
!node.getParent().findAccessibilityNodeInfosByText(CAIKAI).isEmpty()||
!node.getParent().findAccessibilityNodeInfosByText(CHAKANXIANGQING).isEmpty())
continue;
list.add(node);
}
}
}
if(list.size()==0) {
runState=false;
return ;
}
Toast.makeText(this,"连续抢到红包数量:"+list.size(),1000).show();
clickAction(list);
}
示例7: updateData
import android.util.Log; //导入依赖的package包/类
@Override
public void updateData() {
mIsConnecting = true;
BluetoothDevice device = BLEManager.instance.getBleAdapter().getRemoteDevice(getMacAddress());
mGatt = device.connectGatt(BLEManager.instance.getContext(), false, mGattCallback);
if(mGatt == null){
Log.d(mTAG, "Can't connect to " + getMacAddress());
mIsConnecting = false;
}
else{
while(mIsConnecting){
try{
Thread.sleep(500);
}catch (Exception e){
}
}
}
}
示例8: onServiceConnected
import android.util.Log; //导入依赖的package包/类
public void onServiceConnected(ComponentName className, IBinder service) {
Log.i(TAG, "Bound to VehicleManager");
// When the VehicleManager starts up, we store a reference to it
// here in "mVehicleManager" so we can call functions on it
// elsewhere in our code.
mVehicleManager = ((VehicleManager.VehicleBinder) service)
.getService();
// We want to receive updates whenever the EngineSpeed changes. We
// have an EngineSpeed.Listener (see above, mSpeedListener) and here
// we request that the VehicleManager call its receive() method
// whenever the EngineSpeed changes
mVehicleManager.addListener(EngineSpeed.class, mSpeedListener);
mVehicleManager.addListener(VehicleSpeed.class, mVehicleSpeedListener);
//mVehicleManager.addListener(Longitude.class,longitudeListener);
//mVehicleManager.addListener(Latitude.class,latitudeListener);
setConnectionState(openXcState, true);
}
示例9: handleTag
import android.util.Log; //导入依赖的package包/类
@Override
public void handleTag(final boolean opening, final String tag, Editable output, final XMLReader xmlReader) {
if (tag.equals("ul") || tag.equals("ol") || tag.equals("dd")) {
if (opening) {
mListParents.add(tag);
} else mListParents.remove(tag);
mListItemCount = 0;
} else if (tag.equals("li") && !opening) {
handleListTag(output);
}
else if(tag.equalsIgnoreCase("code")) {
if(opening) {
output.setSpan(new TypefaceSpan("monospace"), output.length(), output.length(), Spannable.SPAN_MARK_MARK);
} else {
Log.d("COde Tag","Code tag encountered");
Object obj = getLast(output, TypefaceSpan.class);
int where = output.getSpanStart(obj);
output.setSpan(new TypefaceSpan("monospace"), where, output.length(), 0);
}
}
}
示例10: createMediaCodec
import android.util.Log; //导入依赖的package包/类
private MediaCodec createMediaCodec(int bufferSize) throws IOException {
MediaCodec mediaCodec = MediaCodec.createEncoderByType("audio/mp4a-latm");
MediaFormat mediaFormat = new MediaFormat();
mediaFormat.setString(MediaFormat.KEY_MIME, "audio/mp4a-latm");
mediaFormat.setInteger(MediaFormat.KEY_SAMPLE_RATE, SAMPLE_RATE);
mediaFormat.setInteger(MediaFormat.KEY_CHANNEL_COUNT, CHANNELS);
mediaFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, bufferSize);
mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, BIT_RATE);
mediaFormat.setInteger(MediaFormat.KEY_AAC_PROFILE, MediaCodecInfo.CodecProfileLevel.AACObjectLC);
try {
mediaCodec.configure(mediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
} catch (Exception e) {
Log.w(TAG, e);
mediaCodec.release();
throw new IOException(e);
}
return mediaCodec;
}
示例11: onCreate
import android.util.Log; //导入依赖的package包/类
@Override
public void onCreate() {
Log.i(TAG, "Service created");
super.onCreate();
steamClient = new SteamClient();
steamUser = steamClient.getHandler(SteamUser.class);
steamFriends = steamClient.getHandler(SteamFriends.class);
steamClient.addHandler(new FreeLicense());
freeLicense = steamClient.getHandler(FreeLicense.class);
// Detect Huawei devices running Lollipop which have a bug with MediaStyle notifications
isHuawei = (android.os.Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1 ||
android.os.Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) &&
Build.MANUFACTURER.toLowerCase(Locale.getDefault()).contains("huawei");
if (PrefsManager.stayAwake()) {
acquireWakeLock();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Create notification channel
createChannel();
}
if (BuildConfig.DEBUG) {
DebugLog.addListener(new LogcatDebugListener());
}
startForeground(NOTIF_ID, buildNotification("Steam service started"));
}
示例12: testRetrieveContentDirectoryContent
import android.util.Log; //导入依赖的package包/类
public void testRetrieveContentDirectoryContent() throws Exception {
UpnpClient upnpClient = new UpnpClient();
final List<Device<?, ?, ?>> devices = searchDevices(upnpClient);
ContentDirectoryBrowser browse = null;
for (Device<?, ?, ?> device : devices) {
Log.d(getClass().getName(),
"#####Device: " + device.getDisplayString());
Service service = device.findService(new UDAServiceId(
"ContentDirectory"));
if (service != null) {
browse = new ContentDirectoryBrowser(service, "0",
BrowseFlag.DIRECT_CHILDREN);
upnpClient.getUpnpService().getControlPoint().execute(browse);
while (browse != null && browse.getStatus() != Status.OK)
;
browseContainer(upnpClient, browse.getContainers(), service, 0);
}
}
}
示例13: loadDate
import android.util.Log; //导入依赖的package包/类
private void loadDate() {
showProgress();
String reserveOrderId = getArguments().getString(KEY_RESERVE_ORDER_ID);
RetrofitFactory.getInstance()
.create(BService.ReserveOrderService.class)
.queryReserveDetail(reserveOrderId)
.enqueue(new RMCallback<RMResponse<ReserveOrderModel>>(activity) {
@Override
protected void onSuccess(RMResponse<ReserveOrderModel> result) {
Log.d("RetrofitFactory----", "onSuccess: ");
dismissProgress();
reserveOrderModel = result.content;
binding.setReserveOrderModel(reserveOrderModel);
updateDate();
}
@Override
protected void onFail(String errorCode, String errorInfo) {
Log.d("RetrofitFactory----", "onFail: " + errorCode + " " + errorInfo);
dismissProgress();
showToast(errorInfo);
activity.popFragment();
}
});
}
示例14: getBaseInfo
import android.util.Log; //导入依赖的package包/类
public void getBaseInfo(PtrFrameLayout ptrFrame) {
if (!NetworkUtils.isNetworkAvaliable(getActivity())) {
ToastUtil.showToast(getActivity(), R.string.net_error);
//TODO
List<Rows> devices = (List<Rows>) SharedPreferencesUtils.getObject(getActivity(), SharedPreferencesUtils.KEY_DEVICE_LIST, null);
if (null != devices && devices.size() > 0) {
deviceList.clear();
deviceList.addAll(devices);
}
if (devicesListAdapter != null) {
//更新数据
Log.d("XLight", "update device list");
codeChange = true;
devicesListAdapter.notifyDataSetChanged();
codeChange = false;
}
addDeviceMapsSDK(deviceList);
return;
}
// if (!UserUtils.isLogin(getActivity())) {
// return;
// }
refreshDeviceInfo(ptrFrame);
}
示例15: isStoragePermissionGranted
import android.util.Log; //导入依赖的package包/类
/**
* Permissions checker
*/
private boolean isStoragePermissionGranted() {
if (Build.VERSION.SDK_INT >= 23) {
if (checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
Log.v(TAG,"Permission is granted");
return true;
} else {
Log.v(TAG,"Permission is revoked");
requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
return false;
}
} else {
// Permission is automatically granted on sdk<23 upon installation
Log.v(TAG,"Permission is granted");
return true;
}
}