
而keytool列出來的是SHA1,

怎麼會這樣呢?以前都沒有問題啊!原來最近將JDK升級到版本7。結果呢!在版本7的keytool預設的輸出是SHA1,我的嗎啊!怎麼會這樣呢?需不需要降級到版本6啊?還好查了一下,只要在執行時加上 -v 這個參數就可以將所有編碼的憑證指紋都列出來了。

下回還是不要亂升級了,會搞死人的。 :)
Android是Google為手機所打造的作業系統,良好的介面和易於學習的語言。這裡記錄著我的學習片段,就像一杯杯的咖啡,香韻留存。



<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="-100%p"
android:toXDelta="0"
android:duration="500" />
</set>
left_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0"
android:toXDelta="-100%p"
android:duration="500" />
</set>
right_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="100%p"
android:toXDelta="0"
android:duration="500" />
</set>
right_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0"
android:toXDelta="100%p"
android:duration="500" />
</set>
在main.xml我們定義了兩個Views,一個一開始是顯示的,另一個是隱藏起來的,另外定義了兩個按鈕來做視窗的切換。
.....
<LinearLayout
android:id="@+id/map_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dip"
android:layout_marginBottom="0dip"
android:layout_marginLeft="3dip"
android:layout_marginRight="3dip"
android:layout_weight="1"
android:visibility="gone"
>
</LinearLayout>
<ListView android:id="@+id/oxcache_list"
android:persistentDrawingCache="animation|scrolling"
android:cacheColorHint="#00000000"
android:divider="@color/gray_light"
android:dividerHeight="1dip"
android:orientation="vertical"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ListView>
.....
<Button
android:id="@+id/list_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="0dip"
android:text="@string/list"
android:textColor="@color/header_text"
android:background="@drawable/btn_left_unpress"
style="@style/List"
/>
<Button
android:id="@+id/map_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dip"
android:text="@string/map"
android:textColor="@color/header_text"
android:background="@drawable/btn_right_unpress"
style="@style/List"
/>
在程式中,透過監聽兩個按鈕的click event來切換不同的視窗,重點是什麼情況是右進左出,左進右出了。
listBtn.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
mOxcacheList.setVisibility(View.VISIBLE);
mOxcacheList.setClickable(true);
mOxcacheList.setAnimation(AnimationUtils.loadAnimation(CacheMe.this, R.layout.push_left_in));
mMapLinear.setVisibility(View.GONE);
mMapLinear.setAnimation(AnimationUtils.loadAnimation(CacheMe.this, R.layout.push_right_out));
}
}
});
mapBtn.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
mMapLinear.setVisibility(View.VISIBLE);
mMapLinear.setClickable(true);
mMapLinear.setAnimation(AnimationUtils.loadAnimation(CacheMe.this, R.layout.push_right_in));
mOxcacheList.setVisibility(View.GONE);
mOxcacheList.setAnimation(AnimationUtils.loadAnimation(CacheMe.this, R.layout.push_left_out));
}
}
});
......
public static boolean isDebugMode(Context ctx) {
PackageInfo packageInfo;
try {
packageInfo = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), PackageManager.GET_SIGNATURES);
int flags = packageInfo.applicationInfo.flags;
if ((flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
return true;
}
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
Bitmap bitmap = Bitmap.createBitmap(mapView.getWidth(), mapView.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); mapView.draw(canvas);
mFacebook = new Facebook;
...
if (mFacebook.isSessionValid() == false) {
mFacebook.authorize(ctx, APP_ID, FB_PERMISSIONS, new DialogListener() {
@Override
public void onCancel() {
}
@Override
public void onComplete(Bundle values) {
post();
}
@Override
public void onError(DialogError e) {
sendNotify(false);
}
@Override
public void onFacebookError(FacebookError e) {
sendNotify(false);
}
});
} else {
post();
}
當mFacebook.isSessionValid()為true時代表授權還沒有過期,是不需要在要求使用者登錄的,可以繼續我們上傳的程序。 final String GRAPH_PATH = "me/feed";
final String POST_MESSAGE = "message";
Bundle params = new Bundle();
String msgVal = null;
if (this.msg != null) {
msgVal = this.title+"\n"+this.msg;
} else {
msgVal = this.title;
}
params.putString(POST_MESSAGE, msgVal);
try {
String resp = mFacebook.request(GRAPH_PATH, params, "POST");
JSONObject json = Util.parseJson(resp);
postId = json.getString("id");
final String GRAPH_PATH = "me/photos";
final String POST_MESSAGE = "message";
Bundle params = new Bundle();
String msgVal = null;
if (this.msg != null) {
msgVal = this.title+"\n"+this.msg;
} else {
msgVal = this.title;
}
params.putString(POST_MESSAGE, msgVal);
ByteArrayOutputStream out = new ByteArrayOutputStream();
travelMap.compress(Bitmap.CompressFormat.PNG, 100, out);
params.putByteArray("picture", out.toByteArray());
try {
String resp = mFacebook.request(GRAPH_PATH, params, "POST");
JSONObject json = Util.parseJson(resp);
postId = json.getString("id");
private void post() {
Thread thread = new Thread()
{
@Override
public void run() {
boolean bRet = false;
switch(hi.getType()) {
case HistoryDB.HISTORY_PHOTO_TYPE:
bRet = postPhoto();
break;
case HistoryDB.HISTORY_POI_TYPE:
bRet = postFeed();
break;
default:
break;
}
Message msg = new Message();
if (bRet == true)
msg.arg1 = 1;
else
msg.arg1 = 0;
handler.sendMessage(msg);
}
};
thread.start();
}
Handler handler=new Handler() {
@Override
public void handleMessage(Message msg) {
if (msg.arg1 == 1) {
sendNotify(true);
} else {
sendNotify(false);
}
}
};