Using AlertDialog.Builder
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to exit?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MyActivity.this.finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show()

關於使用Google API Services, 大部份朋友遇到的問題係 Api Key.
怎樣取得 Api Key:
1. 開啟命令提示行 (Command Line Prompt)
2. 到以下路徑: C:\Users\peter\.android (假設使用者名稱是 peter)
3. 輸入以下指令
C:\Users\peter\.android> keytool -list -alias androiddebugkey -keystore debug.keystore
Enter keystore password: android
androiddebugkey, Jan 1, 2011, PrivateKeyEntry,
Certificate fingerprint : 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF
api key 就是 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF
package com.cbthk.refercontacts;
import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.provider.Contacts.People;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.Toast;
public class ReferContacts extends ListActivity {
private ListAdapter mAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Cursor contactsCursor =
getContentResolver().query( ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
startManagingCursor( contactsCursor );
/*
// Get contact id
String contactId = contactsCursor.getString(
contactsCursor.getColumnIndex(ContactsContract.Contacts._ID) );
// Get whether the contact has phone no.
String IsPhone = contactsCursor.getString(
contactsCursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER) );
*/
String[] columns = new String[] { ContactsContract.Contacts.DISPLAY_NAME };
int[] names = new int[] { R.id.row_entry};
mAdapter = new SimpleCursorAdapter( this, R.layout.main,
contactsCursor, columns, names);
setListAdapter(mAdapter);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Cursor contactsCursor = (Cursor) mAdapter.getItem(position);
String contactId = contactsCursor.getString(
contactsCursor.getColumnIndex(ContactsContract.Contacts._ID) );
int hasPhoneNum = contactsCursor.getInt(
contactsCursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER) );
Toast.makeText( this, "hasPhoneNum = '" + String.format("%d", hasPhoneNum) + "'",
Toast.LENGTH_SHORT ).show();
if(hasPhoneNum==1) {
Cursor phonesCursor =
getContentResolver().query(
Phone.CONTENT_URI,
null,
Phone.CONTACT_ID + "=" + contactId,
null,
null);
if(phonesCursor.getCount()>0) {
phonesCursor.moveToNext();
String phoneNum = phonesCursor.getString(
phonesCursor.getColumnIndex(Phone.NUMBER));
Intent i = new Intent( Intent.ACTION_CALL );
i.setData( Uri.parse( "tel:" + phoneNum ) );
startActivity( i );
}
else {
Toast.makeText( this, "No phone no.", Toast.LENGTH_SHORT).show();
}
}
}
}
It seems there is a bug in the BDE (all versions) that causes it to incorrectly report the amount of free disk space with drives that have over 4GB free space.
We recently encountered this issue on a clients machine and found reference to a BDE bug caused by Borland using an obsolete API call (GetDiskSpace instead of GetDiskSpaceEX).
We believe it is causing a number of clients major problems (now that they have all upgraded their machines they are running out of drive space).
If it has not been fixed is there an official (or un official) work around?
It would seem simple to fix (just change the calls to GetDiskSpaceEX).
Related Link
在大量文字輸入的情況下, 在轉換輸入法期間突然衹可以英數字輸入,必需把正在使用的軟體關閉並重新啟動才回復正常, 但大量打字一陣子後又出問題.
解決方法: 可嘗試安裝 Microsoft Office 輸入法 2010.
rake aborted!
Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load — active_record/connection_adapters/mysql2_adapter)
Need to change two files:
1. [project name] > Configuration > database.yml
change “adapter: mysql” to “adapter: mysql2″
2. [project name] > Gemfile
add:
gem:’mysql2′
1. Set title
UIButton *button;
[button setTitle:@"Normal" forState:UIControlStateNormal];
[button setTitle:@"Highlighted" forState:UIControlStateHighlighted];
[button setTitle:@"Selected" forState:UIControlStateSelected];
[button setTitle:@"Disabled" forState:UIControlStateDisabled];
Button is highlighted whenever it is being pressed.
Button can be set “selected” using:
[button setSelected:YES];
Button will be disabled using:
[button setEnabled:NO];
2. Customed Buttons
// CALayer *myLayer = [myButton layer];
[[myButton layer] setCornerRadius:12.0f];
[[myButton layer] setMasksToBounds:YES];
[[myButton layer] setBorderWidth:1.0f];
[[myButton layer] setBorderColor:[[UIColor grayColor] CGColor]];
[myButton setBackgroundColor:[UIColor darkGrayColor]];
* Need to include:
#import “QuartzCore/QuartzCore.h” // for CALayer
In the New Toolbar – Choose a folder window, click in the Folder: dialog box near the bottom of the window.
Copy the following
%userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
Paste the above into the Folder: dialog box near the bottom of the Toolbar – Choose a folder window and then click on the Select Folder button.

原來 Yahoo 也有中文輸入法. 一次整合了「好打注音」、「傳統注音「(ㄅ半)」、「倉頡」跟「簡易」等四種輸入法,安裝後,可以自行切換成慣用的輸入法
一、符號表功能
無需記住符號的打法、開啟符號表,想要甚麼符號一目了然:


二、打繁出簡
這個可以記是特異功能。Windows本身的輸入法不能做到。
往往有些時候需要輸入中文字與內地人溝通,想要表達得更親近,莫過於用簡體中文字去表達,這樣,用開繁體 Windows 輸入繁體中文字就會覺得頭痛,不董簡體中文輸入法怎辦!
有了 奇摩, 就可以按 [Alt]+[S] 或點選工具列切換 繁/簡 輸出就完全解決這個問題。


下載