android_Tv项目

来源:互联网 发布:淘宝二手钢琴英昌u3 编辑:程序博客网 时间:2024/06/03 12:57





  GestureDetector.SimpleOnGestureListener;  A convenience class to extend when you only want to listen for a subset of all the gestures.
  自定义Listiew,实现AdapterView<ListAdapter>{ ** };   重写dispatchTouchEvent()方法;  利用GestureDetector对象;
  自定义方法removeNonVisibleItems()中调用了ViewGroup的removeViewInLayout()方法;



  Queue集成了Collection接口方法:add(e); offer(e); remove(); poll();  element();  peek();
  A collection designed for holding elements prior to processing. Besides basic Collection operations, queues provide additional insertion, extraction, and inspection operations. Each of these methods exists in two forms.
  Collection接口:Collection is the root of the collection hierarchy.
  HashMap继承AbstractMap,AbstractMap实现Map接口;Key-Value;
  Hashtable继承Dictionary,同时实现Map;



  WeakReference继承Reference; Implements a weak reference, which is the middle of the three types of references.
  Weak references are useful for mappings that should have their entries removed automatically once they are not referenced any more (from outside). The difference between a SoftReference and a WeakReference is the point of time at which the decision is made to clear and enqueue the reference:A SoftReference should be cleared and enqueued as late as possible, that is, in case the VM is in danger of running out of memory;  A WeakReference may be cleared and enqueued as soon as is known to be weakly-referenced.
  自己定义 ImageCache;  LruCache;  DiskLruCache;



  mMediaPlayer: 自己释放;  mMediaPlayer.seekTo(mPos)
  mSurfaceView;    surfaceDestroyed()释放资源;
  mSurfaceHolder;








  if(!bmp.isRecycle() ){
         bmp.recycle()   //回收图片所占的内存
         system.gc()  //提醒系统及时回收
  }

  优化Dalvik虚拟机的堆内存分配。对于Android平台来说,其托管层使用的Dalvik Java VM从目前的表现来看还有很多地方可以优化处理,比如我们在开发一些大型游戏或    耗资源的应用中可能考虑手动干涉GC处理,使用 dalvik.system.VMRuntime类提供的setTargetHeapUtilization方法可以增强程序堆内存的处理效率。使用方法:
  private final static float TARGET_HEAP_UTILIZATION = 0.75f;
  VMRuntime.getRuntime().setTargetHeapUtilization(TARGET_HEAP_UTILIZATION);   即可。

 还有就是可以定义堆内存的大小。
  private final static int CWJ_HEAP_SIZE = 6* 1024* 1024 ;
  VMRuntime.getRuntime().setMinimumHeapSize(CWJ_HEAP_SIZE);//设置最小heap内存为6MB大小

  java.lang.System --> Object.     Provides access to system-related information and resources including standard input and output. Enables clients to dynamically load native libraries. All methods of this class are accessed in a static way and the class itself can not be instantiated.
  System.gc();  Indicates to the VM that it would be a good time to run the garbage collector. Note that this is a hint only. There is no guarantee that the garbage collector will actually be run.








  MediaController --> FrameLayout --> ViewGroup --> View --> Object.
  A view containing controls for a MediaPlayer. Typically contains the buttons like "Play/Pause", "Rewind", "Fast Forward" and a progress slider. It takes care of synchronizing the controls with the state of the MediaPlayer.
  The way to use this class is to instantiate it programatically. The MediaController will create a default set of controls and put them in a window floating above your application. Specifically, the controls will float above the view specified with setAnchorView(). The window will disappear if left idle for three seconds and reappear when the user touches the anchor view.
 




原创粉丝点击