Time of Update: 2018-12-08
Android
Time of Update: 2018-12-08
Android模擬器內容是用OpenGL渲染的,所以用一般的編程(如PrintWindow()等)會是黑屏。這是因為畫的東西放在framebuffer裡。 一種方法是通過adb把guest的framebuffer資料/dev/graphics/fb0倒到host,再轉為圖片。但這樣速度比較慢。 好在Android模擬器中把guest的framebuffer傳到host進行顯示,所以在host端只要將framebuffer輸出到檔案即可。首先定義每次framebuffer更新時的回呼函數:
Time of Update: 2018-12-08
自訂控制項(類似按鈕等)的使用,自訂一個SurfaceView。 如某一塊的動態圖(自訂相應),或者類似UC瀏覽器下面的工具列。 如樣本: 自訂類代碼: 複製代碼 代碼如下:public class ImageSurfaceView extends SurfaceView implements Callback{ //用於控制SurfaceView private SurfaceHolder sfh; private Handler handler = new Handler();
Time of Update: 2018-12-08
從SD卡中擷取圖片資源,或者拍一張新的圖片。 先貼代碼 擷取圖片: 注釋:拍照擷取的話,可以指定圖片的儲存地址,在此不說明。 複製代碼 代碼如下:CharSequence[] items = {"相簿", "相機"}; new AlertDialog.Builder(this) .setTitle("選擇圖片來源") .setItems(items, new OnClickListener() { public void onClick(DialogInterface dialog, int
Time of Update: 2018-12-08
今天看到EOE問答裡面有這“[Android 介面]NotificationManager 如何使用Bitmap做表徵圖”這樣一個問題,在論壇搜尋也沒有好的案例 特寫一個簡單的demo供大家參考 今天發布的是NotificationManager 使用Bitmap做表徵圖 關鍵code 複製代碼 代碼如下:public void notification(int flag) { Notification notification = new Notification();
Time of Update: 2018-12-08
部分網友會發現Activity在切換到後台或布局從橫屏LANDSCAPE切換到PORTRAIT,會重新切換Activity會觸發一次onCreate方法,我們可以在androidmanifest.xml中的activit元素加入這個屬性Android:configChanges="orientation|keyboardHidden" 即可,比如 <activity android:name=".android123" android:configChanges="orientation|
Time of Update: 2013-11-16
public class HeadlinesFragment extends ListFragment { OnHeadlineSelectedListener mCallback; // Container Activity must implement this interface public interface OnHeadlineSelectedListener { public void onArticleSelected(int position);
Time of Update: 2013-11-05
線程,互斥鎖,訊號量: 注意:cocos2d-x引擎,已經內建pthread庫,如下加入條件編譯即可:[cpp] view plaincopy本項目TCP用的是ODSocket,直接加入ODSocket.h,ODSocket.cpp到工程目錄即可。順便提一下通用的BSD Socket: :udp部分,使用通用的socket :[cpp] view plaincopyclosesocket(new_socket);#elseclose(new_socket); //
Time of Update: 2013-11-05
一、工程檔案的混淆混淆檔案下載:http://download.csdn.net/detail/lxq_xsyu/63287511、在根目錄下添加progard.cfg檔案 2、開啟project.properties在底下添加proguard.config=proguard.cfg# This file is automatically generated by Android Tools.# Do not modify this file
Time of Update: 2013-11-05
在上一篇文章Android圖形顯示之硬體抽象層Gralloc介紹了Gralloc模組的定義,Gralloc模組中的fb裝置的開啟過程及gpu裝置的開啟過程。關於Gralloc模組的載入過程在Android硬體抽象Hardware庫載入過程源碼分析中已經詳細介紹過了,通過Android圖形顯示之硬體抽象層Gralloc的介紹,相信大家對Gralloc模組的設計有了大概的瞭解,本文在前文的基礎上繼續分析Android系統的圖形顯示內容。我們知道在Gralloc模組中定義了gpu裝置來分配圖形緩衝區,
Time of Update: 2013-11-05
在應用裡使用了後台服務,並且在通知欄推送了訊息,希望點擊這個訊息回到activity,結果總是存在好幾個同樣的activity,就算要返回的activity正在前台,點擊訊息後也會重新開啟一個一樣的activity,返回好幾次才能退出,而不能像qq之類的點擊通知欄訊息回到之前存在的activity,如果存在就不再建立一個activity說的有點繞,如果是遇到此類問題的肯定能懂,沒遇到過的估計看不懂我這混亂的表達了.....經過查閱資料,通過如下方式解決了,其實主要功勞就是第10行,public
Time of Update: 2013-11-05
object and coordination with the class. When recording video with , you must manage the and calls to allow access to the camera hardware, in addition to
Time of Update: 2013-11-05
添加公告欄的方法(右側出來,左側消失)公告欄用的是node節點,錨點位置是(0,0),文字資訊使用CCLabelTTF儲存,錨點位置是(0,0),使用的時候將它加入到node裡面就好了文字移動的思路是:每次都update公告的CCLabelTTF的座標,為了讓它從右往左進行移動,右側邊欄出來,左側邊欄消失,需要設定一下CCLabelTTF的可顯示地區,CCLabelTTF::setTextureRect函數正是設定Label的可顯示地區,因此左右邊界需要特殊處理,解決方案://
Time of Update: 2013-10-28
解決方案: 1. 在res/layout中的activity_main.xml添加一個按鈕,命名為button1。 2. 在MainActivity.java中添加按鈕事件綁定: View btn1 = this.findViewById(R.id.button1); btn1.setOnClickListener(new ButtonClickListener()); 3. 重寫ButtonClickListener函數: private class
Time of Update: 2013-10-28
Android的開發平台搭建主要需要的工具有:Java虛擬機器JDK、Eclipse、Eclipse外掛程式ADT(Android Developer Tool)和Android開發包SDK,以下是具體的安裝方法。 A、JDK 在MAC中已經為我們預裝了JDK並預設配置了Java系統變數,因此JDK對我們來說直接使用即可,查看MAC中的JDK版本方法是在命令列(硬碟/應用程式/工具 + 生產力/終端)中輸入"java
Time of Update: 2013-10-28
@Overrideprotected Scene onCreateScene() {final Scene scene = new Scene();Sprite background = new Sprite(0, 0, backgroundTextureRegion, getVertexBufferObjectManager());scene.attachChild(background);RectangleParticleEmitter emitter = new
Time of Update: 2013-10-28
效果看完了就來實現這個效果。1.布局檔案主介面使用下面的布局: <?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
Time of Update: 2013-10-28
實現技術: android.media.SoundPool實現 (管理和播放應用程式的聲音資源,直接載入到記憶體)。 一.基礎知識: 1. 建立一個SoundPool : 我們先看看SoundPool函數的定義,如下: [java] public SoundPool( int maxStream, // 同時播放的流的最大數量 int streamType,// 流的類型,一般為STREAM_MUSIC int srcQuality //
Time of Update: 2013-10-28
一、基礎知識: 1.ProgressBar在介面檔案XML中的布局:[html]<progressBar android:id="@+id/progressbar_updown" android:layout_width="200dp"
Time of Update: 2013-10-28
一、配置搜尋描述檔案要在res中的xml檔案加建立sreachable.xml,內容如下:<?xml version="1.0"