2013年8月29日 星期四

WIN遙控器

環境設定
(如您的版本是1.2,請先更新至2.0以上版本,然後重新下載第2步的電腦端程式)

1 安裝JAVA執行程式,請至下面連結下載
Download

2 下載電腦端程式WINRemoteService_1.0.rar,然後解壓縮,會看到有三個檔案(winremote_1.0_x64, winremote_1.0_x86, WINRemoteService_1.0, 前二者為32位元及64位元的程式庫,第三個就是執行檔)
Download

3 藍芽配對,先點選右上角案鈕,然後選擇"是"


進入控制台\硬體和音效\新增Bluetooth裝置,此時會電腦已找到您的手機(我的是GT-I9300),
然後點選按下一步


看到配對碼後一樣按下一步


在上個步驟後,手機端會出現對畫框如下,按下確定,即完成配對設定,

 ****上述這些設定只需做一次即可****


=========================================================
如何使用


1.點擊電腦端的WINRemoteService_1.0,來開啟服務
(少數的使用者會看到WINRemoteService_1.0變成RAR, 如果是的話,請點選此檔案,及按滑鼠右鍵,然後選"開啟檔案",最後選擇"JAVA(TM) platform SE binary)




2.點選右上角的按鈕,然後點選裝置名稱(KANZO-AIR是我的電腦名稱)


3.連接成功,可開始遙控嘍



=====================================================================
下載WIN遙控器連結:
http://powerpoint-remote844843.android.informer.com/1.2/


如有任何設定或操作上的問題,請留這或寫信給我

WIN remote control

Set up environment
(If your version is 1.2, please upgrade to 2.0 or newer)

1 Install Java program, download link below
Download

2 Download WINRemoteService_1.0.rar to your computer and unzip it, there'll be 3 files there(winremote_1.0_x64, winremote_1.0_x86, WINRemoteService_1.0, first two files are libraries for 32/64bit, the last file is execute file for lunching service)
Download

3.Pair Bluetooth device between computer and your android phone.


Enter Control Panel -> Hardware and Sound -> Add a Bluetooth device, then computer will
find your android phone(GT-I9300 is my phone type), click it and press "next"

Press "Next" key to pair your phone


After last step, your phone will auto show the dialog box below, just click "OK" to finish pair.
All of these steps above only do one time.



============================================================
Start to Use

1.double Click WINRemoteService_1.0  to lunch service.
(rarely users see the WINRemoteService_1.0 becoming .rar extension file,
 please click the file with mouse right button, choose "open with", then choose "JAVA(TM) platform SE binary)

2. Click the right-top button to connect to computer.(KANZO-AIR is my computer name)


3.If connection is successful, it will show as following.



============================================================
download WIN remote control from:
http://powerpoint-remote844843.android.informer.com/1.2/


If there're any problem about setting or use, please leave message here or mail me.

2013年8月4日 星期日

[Android] 如何監測長按結束 (Detect End of Long Press)

這個範例,我們來看看如何監看按壓按鈕的三個狀態
(This example will show you how to monitor click, long press and release button status)
1)點擊(click)
2)長按(long press)
3)放開(release)

File : MainActivity.java
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.View.OnTouchListener;
import android.widget.Button;

public class MainActivity extends Activity {

 boolean isBtnLongPressed = false;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  Button btn = (Button) findViewById(R.id.button1);

  btn.setOnLongClickListener(new HoldListener());
  btn.setOnTouchListener(new touchListener());
  btn.setOnClickListener(new clickListener());
 }

 //監聽點擊(detect click)
 private class clickListener implements OnClickListener {

  @Override
  public void onClick(View view) {
   Log.e("log", "click button");
  }
 }

 //監聽長按(detect long press)
 private class HoldListener implements OnLongClickListener {

  @Override
  public boolean onLongClick(View pView) {
   // Do something when your hold starts here.
   isBtnLongPressed = true;
   Log.e("log", "long press button");
   return true;
  }

 }

 //監聽放開按鈕(detect release button)
 private class touchListener implements OnTouchListener {

  @Override
  public boolean onTouch(View pView, MotionEvent pEvent) {
   
   if (pEvent.getAction() == MotionEvent.ACTION_UP) {
    
    if (isBtnLongPressed) {
     // Do something when the button is released.
     isBtnLongPressed = false;
     Log.e("log", "release");
    }
   }
   return false;
  }
 }

}


2013年8月3日 星期六

[Android] How to add a Dropdown item on the action bar

Action Bar是android 3.0提供的一個功能,像下圖這樣
(The Action Bar  APIs were first added in Android 3.0 as following picture)




這個範例將教大家,如何在Action bar上加入下拉選單
(This example will teach you how to add a dropdown item on action bar)


File : MainActivity.java
import java.util.ArrayList;
import android.os.Bundle;
import android.app.ActionBar;
import android.app.Activity;
import android.app.ActionBar.OnNavigationListener;
import android.util.Log;
import android.widget.ArrayAdapter;

public class MainActivity extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  final ActionBar actionBar = getActionBar();
  actionBar.setDisplayShowTitleEnabled(false);
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

  ArrayList itemList = new ArrayList();
  itemList.add("WMP");
  itemList.add("iTunes");
  itemList.add("Winamp");

  ArrayAdapter adapt = new ArrayAdapter(this,
    android.R.layout.simple_list_item_1, android.R.id.text1,
    itemList);
  actionBar.setListNavigationCallbacks(adapt, new DropDownListenser());
 }

 class DropDownListenser implements OnNavigationListener {

  public boolean onNavigationItemSelected(int itemPosition, long itemId) {
   if (itemPosition == 0) // windows media player
   {
    Log.e("log", "you choose WMP");
   }

   if (itemPosition == 1) // iTunes
   {
    Log.e("log", "you choose iTunes");
   }
   if (itemPosition == 2) // Winamp
   {
    Log.e("log", "you choose Winamp");
   }

   return true;

  }
 }

}