2017年6月15日 星期四

Android 在別的畫面(app) 去呼叫特定已開啟的App

AndroidMainfest.xml
-------------------
<activity    android:name=".main.Activity1"   
 android:configChanges="keyboard|keyboardHidden|orientation"
 android:label="@string/app_name"   
 android:screenOrientation="portrait"
  android:launchMode="singleInstance" <= 此行絕對不能加,會造成呼叫其他的app
> <!-- Prevents authorization dialog from closing when screen orientation is changed -->
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>


-------------------
可用BroadcastReceiver來收到廣播,再行處理,此方法每次呼叫 不會onCreate其activity

Intent intent = new Intent();
intent.setComponent(new ComponentName("com.captain.voice.alexa.mobile", 
"com.captain.voice.alexa.mobile.main.Audio_Record"));
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);

網頁動畫效果

1.斜角度移動:
<div  id="move_bar2"  style="position:absolute;z-index:1;left:290px;top:240px">
<img  src="images/n/demo/mask1_back.jpg"  style="width:40%;"/>
</div>
---------------------------------

 $("#move_bar2").animate({left: "-=110",top: "+=60" }, 500);

2017年6月8日 星期四

OKHTTP 重要教學

1.同步與非同步傳輸模式
https://github.com/square/okhttp/wiki/Recipes

非同步(asy) 可以捕捉request失敗的狀況,再重傳.


2,Application與Network 的Response監聽方式
https://github.com/square/okhttp/wiki/Interceptors

Application較為正常