2011. 4. 14. 17:46

getBaseContext().getString(R.string.xxx)

'안드로이드 > 잔지식' 카테고리의 다른 글

adb shell에서 직접 app실행시키기  (0) 2012.02.10
나인패치  (0) 2011.05.05
한글 bold효과넣기  (0) 2011.04.06
singleinstance 는 startActivityForResult 사용불가  (0) 2011.04.04
Posted by newkie
2011. 4. 6. 17:08

tt.setPaintFlags(tt.getPaintFlags() | Paint.FAKE_BOLD_TEXT_FLAG);

'안드로이드 > 잔지식' 카테고리의 다른 글

adb shell에서 직접 app실행시키기  (0) 2012.02.10
나인패치  (0) 2011.05.05
코드에서 R.string 사용  (0) 2011.04.14
singleinstance 는 startActivityForResult 사용불가  (0) 2011.04.04
Posted by newkie
2011. 4. 6. 13:51
0이면 전환없이 바로 보여줌

public void onResume()
 {
  overridePendingTransition(0, 0);
  super.onResume();
 }

0을 딴걸로 바꿀수 있으니 찾아봐도 됨(fade, push_right_in 등등)
Posted by newkie
2011. 4. 4. 18:03

은 냉무

'안드로이드 > 잔지식' 카테고리의 다른 글

adb shell에서 직접 app실행시키기  (0) 2012.02.10
나인패치  (0) 2011.05.05
코드에서 R.string 사용  (0) 2011.04.14
한글 bold효과넣기  (0) 2011.04.06
Posted by newkie
2011. 4. 1. 17:13

import android.os.Vibrator;

Vibrator Vibe = (Vibrator)context.getSystemService( context.VIBRATOR_SERVICE );
Vibe.vibrate(1000);
Posted by newkie
2011. 3. 29. 09:00
private ProgressDialog mProgressDialog = null;

private Handler handler = new Handler();



...
mainProcessing();
...



    private void mainProcessing() 
    {
     // 시간이 많이 드는 작업을 자식 스레드로 옮긴다.
     Thread thread = new Thread(null, doBackgroundThreadProcessing, "Background");
     thread.start();
    }
    
    // 백그라운드 처리 메서드를 실행하는 Runnable.
    private Runnable doBackgroundThreadProcessing = new Runnable()
    {
     public void run()
     {
     backgroundThreadProcessing();
     }
    };
    
    // 백그라운드에서 몇 가지 처리를 수행하는 메서드.
    private void backgroundThreadProcessing()
    {    
     Log.d("Thread Start", "Thread Start~!");

     try 
     {
    //+
   // [...시간 소모적인 작업들...]
   //-
         
            handler.post(doUpdateGUI);
     }
     catch (Exception ex)
     {
     ex.toString();
     }
    }
    
    // GUI 업데이트 메서드를 실행하는 Runnable.
    public Runnable doUpdateGUI = new Runnable()
    {
     public void run()
     {
     updateGUI();
     }
    };
    
    public void updateGUI()
    {
     // [...다이얼로그를 오픈하거나 GUI 요소를 수정할 수 있다...]
    }
Posted by newkie
2011. 3. 24. 17:14

ActivityManager am = (ActivityManager) getSystemService(Activity.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> list = am.getRunningAppProcesses();
for(RunningAppProcessInfo rapi : list)
{
Log.i("proclist", "runningProcessName : " + rapi.processName + ", importance : " + rapi.importance);
}

//importance는 해당 프로세스가 FOREGROUND, BACKGROUND 또는 SERVICE로 구동중인지 알 수 있다.
//RunningAppProcessInfo.IMPORTANCE_FOREGROUND (100)
//RunningAppProcessInfo.IMPORTANCE_SERVICE (300)
//RunningAppProcessInfo.IMPORTANCE_BACKGROUND (400)
Posted by newkie
2011. 3. 16. 17:39
...

... class Notactivity
{
  ..
  private Context mContext = null;
  ..
  public Notactivity(Context context)
    {
     this.mContext = context;
    }
  ..
  //액티비티에서 실행되는 것 앞에다 mContext. 을 붙여줌
}
Posted by newkie
2011. 3. 14. 17:42

..extends Activity
{

  ..

  private ProgressDialog mProgressDialog = null;

  ..onCreate(..)
  {

    ..
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog = ProgressDialog.show(ctx,"로딩", "로딩중.", true);
    //로딩화면 띄운 동안 할것
    runOnUiThread(returnRes);

  }

  ..

  private Runnable returnRes = new Runnable()
 {
  @Override
  public void run()
  {
   mProgressDialog.dismiss();
  }
 };

Posted by newkie
2011. 3. 14. 13:07

핸들러로

new Thread(new Runnable()
      {
       @Override
       public void run()
       {
        Message msg = handler.obtainMessage();
           handler.sendMessage(msg);
       }
      }).start();


final Handler handler = new Handler() {
     public void handleMessage(Message msg) {
//실행할 부분
     }
    };
Posted by newkie