当前位置:  编程技术>移动开发
本页文章导读:
    ▪Ubuntu容易地设置环境变量        Ubuntu简单地设置环境变量Android环境配置完了之后,需要把adb这个方法所在目录加入到环境变量中: 可选的三种方法如下: 1.通过export: export PATH=$PATH:/home/xiaoyaomeng/software/android-sdk-linux/platfo.........
    ▪ logcat 下令小结        logcat 命令小结logcat是android系统中的一个命令,是一个可执行的bin文件,放置在/system/bin目录下。 root@android:/system/bin # ls -l logcat -rwxr-xr-x root shell 13680 2008-.........
    ▪ objective-c中获取时间的步骤       objective-c中获取时间的方法------头文件 #import <Foundation/Foundation.h> #include <mach/mach_time.h> @interface TimeStampHelper : NSObject + (NSTimeInterval)timestamp; @end ----实现文件 .........

[1]Ubuntu容易地设置环境变量
    来源: 互联网  发布时间: 2014-02-18
Ubuntu简单地设置环境变量

Android环境配置完了之后,需要把adb这个方法所在目录加入到环境变量中:

可选的三种方法如下:


1.通过export:

export PATH=$PATH:/home/xiaoyaomeng/software/android-sdk-linux/platform-tools


2.修改profile文件:

sudo gedit /etc/profile
加入:  export PATH="$PATH:/home/xiaoyaomeng/software/android-sdk-linux/platform-tools"

3. 修改.bashrc文件:
sudo gedit /root/.bashrc
加入:export PATH="$PATH:/home/xiaoyaomeng/software/android-sdk-linux/platform-tools"


三种写法看起来都是保存原来的PATH,然后往后加新的路径进来,之间用    :(冒号)  隔开


    
[2] logcat 下令小结
    来源: 互联网  发布时间: 2014-02-18
logcat 命令小结

logcat是android系统中的一个命令,是一个可执行的bin文件,放置在/system/bin目录下。

root@android:/system/bin # ls -l logcat                                        
-rwxr-xr-x root     shell       13680 2008-08-01 12:00 logcat


logcat的源代码在/system/core下面,根据Android.mk:

# Copyright 2006 The Android Open Source Project

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES:= logcat.cpp event.logtags

LOCAL_SHARED_LIBRARIES := liblog

LOCAL_MODULE:= logcat

include $(BUILD_EXECUTABLE 

可以看出编译出来是可执行文件。

要是感兴趣可以研究一下。

 

看一下logcat的注释:

Usage: logcat [options] [filterspecs]
options include:
  -s              Set default filter to silent.
                  Like specifying filterspec '*:s'
  -f <filename>   Log to file. Default to stdout
  -r [<kbytes>]   Rotate log every kbytes. (16 if unspecified). Requires -f
  -n <count>      Sets max number of rotated logs to <count>, default 4
  -v <format>     Sets the log print format, where <format> is one of:

                  brief process tag thread raw time threadtime long

  -c              clear (flush) the entire log and exit
  -d              dump the log and then exit (don't block)
  -t <count>      print only the most recent <count> lines (implies -d)
  -g              get the size of the log's ring buffer and exit
  -b <buffer>     Request alternate ring buffer, 'main', 'system', 'radio'
                  or 'events'. Multiple -b parameters are allowed and the
                  results are interleaved. The default is -b main -b system.
  -B              output the log in binary
filterspecs are a series of 
  <tag>[:priority]

where <tag> is a log component tag (or * for all) and priority is:
  V    Verbose
  D    Debug
  I    Info
  W    Warn
  E    Error
  F    Fatal
  S    Silent (supress all output)

'*' means '*:d' and <tag> by itself means <tag>:v

If not specified on the commandline, filterspec is set from ANDROID_LOG_TAGS.
If no filterspec is found, filter defaults to '*:I'

If not specified with -v, format is set from ANDROID_PRINTF_LOG
or defaults to "brief"


解释一下options:

-s 相当于一个过滤器

-f <filename> 输出到文件,默认情况是标准输出.

-r [<kbytes>] 循环log的字节数(默认为16),需要-f.

-n <count> 设置循环log的最大数目,默认是4

-v <format> 设置log的打印格式, <format> 是下面的一种: brief process tag thread raw time threadtime long.

-c 清除所有log并退出.

-d 得到所有log并退出 (不阻塞).

-g 得到环形缓冲区的大小并退出.

-b <buffer> 请求不同的环形缓冲区('main' (默认), 'radio', 'events').

-B 输出log到二进制中.

 

解释一下优先级:

filterspecs are a series of  <tag>[:priority]

where <tag> is a log component tag (or * for all) and priority is: //这个tag可以是用户定义的,或者是用*代表所有tag,而优先级是V D I W E F S,等级越来越高
  V    Verbose
  D    Debug
  I    Info
  W    Warn
  E    Error
  F    Fatal
  S    Silent (supress all output)

例如:adb logcat ActivityManager:I MyApp:D *:S 或者 adb logcat -s ActivityManager:I MyApp:D
上面表达式的最后的元素 *:S ,,是设置所有的标签为”silent”,所有日志只显示有”ActivityManager”和“MyApp”的,用 *:S 的另一个用处是能够确保日志输出的时候是按照过滤器的说明限制的,也让过滤器也作为一项输出写到日志中。

 

具体的logcat详解,可以查看点击这里。


    
[3] objective-c中获取时间的步骤
    来源: 互联网  发布时间: 2014-02-18
objective-c中获取时间的方法

------头文件

#import <Foundation/Foundation.h>

#include <mach/mach_time.h>


@interface TimeStampHelper : NSObject

+ (NSTimeInterval)timestamp;

@end


----实现文件



#import "TimeStamp.h"


@implementation TimeStampHelper


+ (NSTimeInterval)timestamp

{

    // get the timebase info -- different on phone and OSX

    mach_timebase_info_data_t info;

    mach_timebase_info(&info);

    

    // get the time

    uint64_t absTime = mach_absolute_time();

    

    // apply the timebase info

    absTime *= info.numer;

    absTime /= info.denom;

    

    // convert nanoseconds into seconds and return

    return (NSTimeInterval) ((double) absTime / 1000000000.0);

}


@end



    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
互联网 iis7站长之家
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3