获取CPU内核个数

作者:追风剑情 发布于:2016-6-29 12:52 分类:Android

通过分析文件获取   代码 //获取CPU内核数 public int getCPUCoreCount() { class CpuFilter implements FileFilter { @Override public boolean accept(File pathname) ...

阅读全文>>

标签: Android

评论(0) 浏览(4932)

异步委托

作者:追风剑情 发布于:2016-6-29 11:05 分类:C#

委托异步执行 示例一 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DelegateTest { public delegate string MyDelegate(object data); cl...

阅读全文>>

标签: C#

评论(0) 浏览(2443)

<merge>标签

作者:追风剑情 发布于:2016-6-21 18:07 分类:Android

      如果你经常使用<include>标签,布局可能会变得嵌套过多从而导致UI绘图变慢。<merge>标签可以用来解决这个问题。<merge>标签指导系统移除子布局的顶层容器。当你包含一个子布局时,里面包含的视图会被合并到主布局中去,但没有额外的容器视图。例如给定这个布局: layout_merge.xml ...

阅读全文>>

标签: Android

评论(0) 浏览(2694)

2.5D地图坐标转换

作者:追风剑情 发布于:2016-6-21 11:53 分类:Algorithms

语言:C# using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace MapEditor.Map { /// <summary> /// 2.5D地图坐标转换工具类...

阅读全文>>

标签: Algorithms

评论(0) 浏览(4346)

泛型

作者:追风剑情 发布于:2016-6-20 15:56 分类:C#

示例一 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GenericityTest { class Program { static void Main(string[] args) ...

阅读全文>>

标签: C#

评论(0) 浏览(3588)

堆排序(二)

作者:追风剑情 发布于:2016-6-20 13:17 分类:Algorithms

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace HeapSortTest { class Program { static void Main(string[] args) { ...

阅读全文>>

标签: Algorithms

评论(0) 浏览(2787)

创建视图动画

作者:追风剑情 发布于:2016-6-18 12:54 分类:Android

      在Android3.0之前创建动画的首要方法是视图动画系统。视图动画提供了一系列内置的动画操作,能够在视图之间生成动画。你提供起始值和终止值,动画框架将会改变显示的视图。这个系统很容易实现,但是它也有一些缺点。首先,这只限于在视图对象上操作。如果你想要做成不是视图的动画,你将需要自己完成。第二,它仅在一个默认的属性集上运作,它不会影响其他的属性。最后,视图...

阅读全文>>

标签: Android

评论(0) 浏览(2695)

命令模式(Command)

作者:追风剑情 发布于:2016-6-17 18:05 分类:设计模式

应用场景:将行为请求者与行为执行者解耦。 using System; using System.Collections.Generic; using System.Text; namespace CommandTest { class Program { static void Main(string[] args) ...

阅读全文>>

标签: 设计模式

评论(0) 浏览(2852)

抽象工厂模式(Abstract Factory)

作者:追风剑情 发布于:2016-6-17 17:41 分类:设计模式

应用场景:创建产品簇 using System; using System.Collections.Generic; using System.Text; namespace FactoryTest { class Program { static void Main(string[] args) { ...

阅读全文>>

标签: 设计模式

评论(0) 浏览(2786)

工厂方法模式(Factory Method)

作者:追风剑情 发布于:2016-6-17 17:12 分类:设计模式

应用场景:产品的组装比较复杂。用工厂模式外部可以不关心生产过程以及产品相关的部件对象。 using System; using System.Collections.Generic; using System.Text; namespace FactoryTest { class Program { static void Main(st...

阅读全文>>

标签: 设计模式

评论(0) 浏览(2582)

生成器模式(Builder)

作者:追风剑情 发布于:2016-6-17 15:50 分类:设计模式

应用场景:产品对象的构造比较复杂时使用。 using System; using System.Collections.Generic; using System.Text; namespace BuilderTest { class Program { static void Main(string[] args) {...

阅读全文>>

标签: 设计模式

评论(0) 浏览(2861)

HexString与byte[]互转

作者:追风剑情 发布于:2016-6-16 12:55 分类:C#

byte[]转16进制字符串 16进制字符串转byte[] 示例代码 using System; using System.Collections.Generic; using System.Text; namespace PrototypeTest { class Program { static void Ma...

阅读全文>>

标签: C#

评论(0) 浏览(4229)

<include>标签

作者:追风剑情 发布于:2016-6-15 17:40 分类:Android

示例一 include_layout.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent...

阅读全文>>

标签: Android

评论(0) 浏览(3870)

原型模式(Prototype)

作者:追风剑情 发布于:2016-6-15 14:09 分类:设计模式

using System; using System.Collections.Generic; using System.Text; namespace PrototypeTest { class Program { static void Main(string[] args) { ConcretePr...

阅读全文>>

标签: 设计模式

评论(0) 浏览(2906)

使用Wake Lock

作者:追风剑情 发布于:2016-6-14 17:49 分类:Android

      为了延长电池使用寿命,Android设备会在闲置一段时间后使屏幕变暗,然后关闭屏幕显示,最后停止CPU。WakeLock是一个电源管理系统服务功能,应用程序可以使用它来控制主机设备的电源状态。WakeLock可以用来保持CPU运行,避免屏幕变暗和关闭,以及避免键盘背光灯熄灭。创建和使用WakeLock会对设备的电池电量消耗产生显著的影响。因此,最好只在确实...

阅读全文>>

标签: Android

评论(0) 浏览(3578)

录音与播放——(AudioRecord & AudioTrack)

作者:追风剑情 发布于:2016-6-13 17:55 分类:Android

添加权限 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permissio...

阅读全文>>

标签: Android

评论(0) 浏览(4640)

去除UTF8文本中BOM标记

作者:追风剑情 发布于:2016-6-8 14:23 分类:C#

public string TrimBOM(string fileText) { if (string.IsNullOrEmpty(fileText)) return ""; byte[] bytes = Encoding.UTF8.GetBytes(fileText); if (bytes.Length...

阅读全文>>

标签: C#

评论(0) 浏览(3326)

状态模式

作者:追风剑情 发布于:2016-6-5 15:31 分类:设计模式

应用场景:当有多个状态时,不同的状态对应不同的行为 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace StateTest { class Program { static void Main(st...

阅读全文>>

标签: Algorithms

评论(0) 浏览(2801)

策略模式

作者:追风剑情 发布于:2016-6-5 14:55 分类:设计模式

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace StrategyTest { class Program { static void Main(string[] args) { ...

阅读全文>>

标签: Algorithms

评论(0) 浏览(3474)

访问者模式

作者:追风剑情 发布于:2016-6-1 18:09 分类:设计模式

访问者模式 using System; using System.Collections.Generic; using System.Text; /************************************************************************/ /* 访问者模式 ...

阅读全文>>

标签: Algorithms

评论(0) 浏览(2780)

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号