기술참고자료/Android | 2011. 3. 14. 13:11
구글 계정을 이용하는 안드로이드 어플리케이션을 작업할 경우가 생긴다.
단말내의 구글 계정이 설정이 되어 있지 않다면, 아래의 샘플코드처럼 인텐트를 날려 셋팅기능을 이용하도록 화면전환을 처리하자.
private Button button = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button = (Button) findViewById(R.id.main01);
button.setOnClickListener(new OnClickListener(){public void onClick(View v) {
Intent intent = new Intent("android.settings.SYNC_SETTINGS");
intent.addCategory("android.intent.category.DEFAULT");
startActivity(intent);
}
});
안드로이드 차트관련 정보모음 (2) | 2011.03.22 |
---|---|
getLocalActivityManager()내의 AlertDialog() 사용시의 유의점!! (0) | 2011.03.14 |
Sending HTML Email With Android Intent (0) | 2011.03.14 |
TelephonyManager 클래스의 getDeviceId()에 대한 포스팅 (0) | 2011.03.06 |
Android ActivityGroup and TabActivity Sample Application (0) | 2011.03.04 |
기술참고자료/Android | 2011. 3. 14. 13:02
It’s very easy to send email via an Android intent. Here’s an example where we already have the subject and body prepared but want to let the user decide on the recipient:
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
startActivity(Intent.createChooser(emailIntent, "Email:"));
(It’s important to note that this should be attempted on a real device.)
I ran into some trouble with sending HTML in an email because it was being interpreted as plain text both in the user’s email client and in the recipient’s. Simply changing the MIME type didn’t help, but I eventually came across the solution:
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));
startActivity(Intent.createChooser(emailIntent, "Email:"));
Note that both the MIME type is changed and the EXTRA_TEXT is now set asHtml.fromHtml(body) instead of just being passed a string with HTML in it. As long as the mail app that is selected is able to properly handle the Intent (e.g., the Gmail app can, the default mail app cannot), then HTML email can be sent.
원문 : http://blog.iangclifton.com/2010/05/17/sending-html-email-with-android-intent/
getLocalActivityManager()내의 AlertDialog() 사용시의 유의점!! (0) | 2011.03.14 |
---|---|
계정설정화면으로 이동처리하기 (0) | 2011.03.14 |
TelephonyManager 클래스의 getDeviceId()에 대한 포스팅 (0) | 2011.03.06 |
Android ActivityGroup and TabActivity Sample Application (0) | 2011.03.04 |
Android: TabActivity Nested Activities (0) | 2011.03.04 |
기술참고자료/Linux | 2011. 3. 9. 02:38
[리눅스] netstat 명령으로 포트확인하기 (0) | 2011.05.10 |
---|---|
[리눅스] phpMyAdmin, ‘Error #2002 – The server is not responding’, and OS X 10.x (0) | 2011.05.09 |
[리눅스] php 설치시의 configure 옵션 (0) | 2011.05.03 |
top명령어와 사용방법 (0) | 2011.03.22 |
우분투 10.04 한글깨짐현상 해결방법 (0) | 2011.03.17 |
기술참고자료/Android | 2011. 3. 6. 22:00
TelephonyManager mTelephonyMgr =
(TelephonyManager)getSystemService(this.TELEPHONY_SERVICE);
String deviceId = mTelephonyMgr.getDeviceId();
In addition to the answer of Trevor Johns, you can use this as follows:
Trevor Johns의 답변에 추가하자면, 너는 아래와 같이 사용할 수 있을거야.
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>In emulator, you'll probably get a like a "00000..." value. getDeviceId() returns NULL if device ID is not available.애뮬레이터에서는 넌 아마도 "00000..." 같은 결과를 보게될거고, deviceId를 사용하지 못하는 경우에는 null을 리턴할 거야~
음. 역시 애뮬레이터라 그런거였구나!
오늘도 하나씩 배워간다.
계정설정화면으로 이동처리하기 (0) | 2011.03.14 |
---|---|
Sending HTML Email With Android Intent (0) | 2011.03.14 |
Android ActivityGroup and TabActivity Sample Application (0) | 2011.03.04 |
Android: TabActivity Nested Activities (0) | 2011.03.04 |
브로드캐스트리시버의 등록과 해제 (0) | 2011.03.04 |
기술참고자료/Android | 2011. 3. 4. 11:48
Sending HTML Email With Android Intent (0) | 2011.03.14 |
---|---|
TelephonyManager 클래스의 getDeviceId()에 대한 포스팅 (0) | 2011.03.06 |
Android: TabActivity Nested Activities (0) | 2011.03.04 |
브로드캐스트리시버의 등록과 해제 (0) | 2011.03.04 |
커스텀 타이틀바 처리하기 (0) | 2011.03.04 |