有時候import project的時候,就會出現中文亂碼#%$#%一整個很困擾
Sometime i import a project the chinese character all become %$#$%# !!!!
IT'S VERY NOISY!!!!!
SOLVE METHOD
Step 1. 「Window」->「Preferences」
Step 2. 「General」->「Workspace」。
Step 3. 「Text file encoding」 Change Default (MS950) ->「UTF-8」。
Step 4. Press 「Apply」
2015年7月26日 星期日
[Android] 通知(Notification)
Take a note !! so next time if i use notification it will become faster :"))
新(New):Notification.Builder來快速產生出來
http://www.codedata.com.tw/mobile/android-tutorial-the-5th-class-2-notificationhttp://givemepass.blogspot.tw/2011/11/notification.html
http://blog.maxkit.com.tw/2014/03/android-notification.html
新(New):Notification.Builder來快速產生出來
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE ); Builder builder = new Notification.Builder(Update.this ); PendingIntent contentIndent = PendingIntent.getActivity(Update. this, 0, new Intent(Update.this , Update. class),PendingIntent. FLAG_UPDATE_CURRENT); builder.setContentIntent(contentIndent) .setSmallIcon(R.drawable.icon) // 設置狀態列裡面的圖示 .setTicker("New Message") // 設置狀態列的顯示的資訊 .setWhen(System. currentTimeMillis()) // 設置發生時間 .setContentTitle( "I-Calories計算結果通知" )//設置通知清單裡的標題 .setContentText("共消耗"+ca); // 設置內容 Notification notification = builder.getNotification(); notificationManager.notify(1, notification);設定預設提示音(notification.defaults to set default alarm ring)
notification.defaults |= Notification.DEFAULT_SOUND;//預設鈴聲相關連結(good learning website) 更詳細可以點及這個很棒的網站作更深入的學習 http://magiclen.org/android-notifications/
http://www.codedata.com.tw/mobile/android-tutorial-the-5th-class-2-notificationhttp://givemepass.blogspot.tw/2011/11/notification.html
http://blog.maxkit.com.tw/2014/03/android-notification.html
[Android] Vibrate 振動實作
Sometime we need to let the phone vibrate when receive a message or something happen
我們現在來進行實做 "振動" 這項功能
<uses-permission android:name="android.permission.VIBRATE" />
我們現在來進行實做 "振動" 這項功能
Vibrator myVibrator = (Vibrator) getApplication().getSystemService(Service.VIBRATOR_SERVICE); myVibrator.vibrate(1000);//millisecondDon't forget to add in your AndroidManifest.xml!!!!!
<uses-permission android:name="android.permission.VIBRATE" />
[Android] Toast
We have two method to use Toast
我們有兩種方式來顯示Toast
1.ToastActivity.this depends on this class name
1.ToastActivity.this depends on this class name
Toast toast = Toast.makeText(ToastActivity.this,"Hello world!", Toast.LENGTH_LONG); toast.show();2.getApplicationContext()to get Current Context
Context context1 = getApplication(); Toast.makeText(context2, "Hello world!", Toast.LENGTH_LONG).show();
訂閱:
文章 (Atom)