posted by 네코냥이 2014. 7. 1. 10:15


ViewPager with FragmentPagerAdapter · thecodepath_android_guides Wiki · GitHub.pdf




Test_ViewPager_Ver01.zip


Test_ViewPager_Ver02.zip



프로젝트는 소스 보고 따라 작성한것. 내용이 상이할 수 있습니다.

posted by 네코냥이 2014. 1. 6. 17:39

[Android] 액션바 단어 설명



대협의 일상 __ [안드로이드]액션바에 대하여..pdf


posted by 네코냥이 2013. 9. 28. 22:48


브로드캐스트 리시버와 관련된 인텐트.pdf


posted by 네코냥이 2013. 9. 25. 14:17


Optimizing Your UI _ Android Developers.pdf


posted by 네코냥이 2013. 8. 16. 10:30


원문: http://blog.naver.com/donordonut/171482157




안드로이드 디자인 - 스타일과 테마 적용법.pdf


posted by 네코냥이 2013. 8. 2. 09:55

http://blog.naver.com/websearch/70102334274


안드로이드 프로그램이 실행 중에 Back 버튼을 클릭하면 프로그램이 화면에서 사라지게 됩니다. 물론 프로그램이 종료된 것은 아니고 프로그램의 GUI 가 사라지고 프로세스는 실행되는 상태가 됩니다. 사용자가 실수로 Back 버튼을 클릭하여서 불필요하게 프로그램의 GUI 가 사라지지 않도록 하기 위해서는 아래의 코드와 같이 키보드 이벤트를 감지하여서 Back 버튼이 클릭되었을 때에 사용자에게 프로그램을 종료할지를 확인하면 됩니다.

 

public class TestDestory extends Activity
{
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState)
 {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
 }

 

 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event)
 {
  if( keyCode == KeyEvent.KEYCODE_BACK )
  {
   new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle("Quit").setMessage("Do you want to quit").setPositiveButton("Yes", new DialogInterface.OnClickListener()
   {
     @Override
     public void onClick( DialogInterface dialog, int which )
     {
       finish();
     }
   }).setNegativeButton( "No", null ).show(); 
  
   return true;
  }
  
  return super.onKeyDown(keyCode, event);
 }
}


posted by 네코냥이 2013. 8. 2. 09:39

출처: http://blog.naver.com/websearch/70123690867



AudioManager 클래스의 getRingerMode 메소드를 호출하여서 안드로이드 디바이스의 소리/진동/무음 상태를 확인할 수 있다. 예제 소스 코드는 아래와 같다. 

 

AudioManager clsAudioManager = (AudioManager)m_clsContext.getSystemService(Context.AUDIO_SERVICE);
   
switch( clsAudioManager.getRingerMode( ) )
{
   case AudioManager.RINGER_MODE_VIBRATE:
    // 진동 모드

    break;
   case AudioManager.RINGER_MODE_NORMAL:

    // 소리 모드

    break;

   case RINGER_MODE_SILENT

    // 무음 모드

    break;

}


posted by 네코냥이 2013. 8. 2. 09:35


출처:     http://blog.naver.com/websearch/70100892837



일반적인 안드로이드 개발 도서에는 managedQuery( People.CONTENT_URI ... ) 을 사용하라고 기술되어 있는데 People 클래스가 deprecated 되었고 ContactsContract 클래스를 사용하라고 안드로이드 문서에 기술되어 있더군요.

 

안드로이드 2.1 이상에서 주소록을 가져오는 기능에 대한 예제 코드는 다음과 같습니다.

 

 private void ReadFromDB()
 {
  Vector<String> arrPhoneList = new Vector<String>();

  Vector<String> arrNameList = new Vector<String>();
  String [] arrProjection = { ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME };
  String [] arrPhoneProjection = { ContactsContract.CommonDataKinds.Phone.NUMBER };
  
  Cursor clsCursor = getContentResolver().query( ContactsContract.Contacts.CONTENT_URI, arrProjection, ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" , null, null );
    
  while( clsCursor.moveToNext() )
  {
   String strContactId = clsCursor.getString( 0 );
   
   Cursor clsPhoneCursor = getContentResolver().query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, arrPhoneProjection
     , ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + strContactId, null, null );
   while( clsPhoneCursor.moveToNext() )
   {

     // 이름과 전화 번호를 각각의 리스트에 저장한다.
     arrNameList.add( clsCursor.getString( 1 ) );
     arrPhoneList.add( clsPhoneCursor.getString( 0 ) );
   }
   
   clsPhoneCursor.close();   
  }

  clsCursor.close( );

 

  // QQQ: 이름과 전화 번호를 화면에 보여준다. - 이 부분은 원하시는 코드를 추가하시면 됩니다.

}

 

[참고자료] http://stackoverflow.com/questions/1721279/how-to-read-contacts-on-android-2-0


posted by 네코냥이 2013. 8. 2. 09:30


[출처] [안드로이드] disable 이미지 추가 방법|작성자 까미유



안드로이드 마켓 앱을 실행하여서 현재 실행 중인 앱에 대한 정보를 보여주는 예제는 다음과 같다.

 

Intent intent = new IntentIntent.ACTION_VIEW );
intent
.setDataUri.parse"market://details?id=com.android.example" ) );
startActivity
intent );

 

Summary of URI formats

The table below provides a summary of the URIs currently supported by the Android Market (both on the web and in the Android application), as discussed in the previous sections.

 

For this resultUse this URI in a web page linkOr this URI in an ACTION_VIEW intent
Display the details screen for a specific applicationhttp://market.android.com/details?id=<package_name>market://details?id=<package_name>
Search for applications using a general string query.http://market.android.com/search?q=<query>market://search?q=<query>
Search for applications by publisher namehttp://market.android.com/search?q=pub:<publisher_name>market://search?q=pub:<publisher_name>

 

 

[참고자료] http://developer.android.com/guide/publishing/publishing.html