계정설정화면으로 이동처리하기

구글 계정을 이용하는 안드로이드 어플리케이션을 작업할 경우가 생긴다.
단말내의 구글 계정이 설정이 되어 있지 않다면, 아래의 샘플코드처럼 인텐트를 날려 셋팅기능을 이용하도록 화면전환을 처리하자.

 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);

            }
        });

Sending HTML Email With Android Intent

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/

[CentOS] 한글지원 패키지 추가 및 한글설정

사용자 삽입 이미지


음. 
요새 느끼는건 CentOS는 Ubuntu보다 매우 친절하지 못하다는 것이다.
그래서 좀 더 공부를 해야겠다는 욕구가 생기는 것 같다. 

리눅스와 좀 더 친해질 필요가 있다!!!

TelephonyManager 클래스의 getDeviceId()에 대한 포스팅

TelephonyManager mTelephonyMgr =
 (TelephonyManager)getSystemService(this.TELEPHONY_SERVICE);
String deviceId = mTelephonyMgr.getDeviceId();

TelephonyManager 클래스를 이용하여 단말기마다의 디바이스 아이디를 추출해 낼 수 있다.
오늘 애뮬레이터에서 해당 메서드를 사용해보니, devideId 변수에 들어오는 값이 '000000000000000' 라고 보여졌다.
음~ 애뮬레이터라 그런가? 싶어서 검색을 해보았다.
국내에는 관련 자료가 없었는데, 당연하니깐 없는건가 -_-; 아. 이것도 나만 모르나 보다.
외쿡 자료에서 발취한 내용을 아래 담아본다. 출처는 스택오버플로.
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을 리턴할 거야~


음. 역시 애뮬레이터라 그런거였구나!

오늘도 하나씩 배워간다.

Android ActivityGroup and TabActivity Sample Application


사용자 삽입 이미지


Android ActivityGroup and TabActivity Sample Application: While working on IGranth App I had a requirement of using ActivityGroup, TabActivity. Googled it and came across this post http://blog.henriklarsentoft.com/2010/07/android-tabactivity-nested-activities/ even though the post explained things well it was missing the code, and as a programmer I know its easy to download the code and get started, so I created a sample app so you can download here and run it on your emulator.


위 원문글에 첨부된 샘플소스가 OSX로 되어 있길래, 윈도우 기반으로 샘플 구동해보고 다시 첨부합니다.
탭호스트 사용시, 뒤로가기에 대한 이슈해결내용을 주 내용으로 하고 있습니다.
도움이 되었으면 좋겠습니다.