일상/수다2014. 1. 18. 01:32
대화라는 것은 참으로 어려운 것인거 같다.

말의 시작과 끝을 어떻게 해야하나라는

큰 어려움

말이 불필요하게 늘어지면 사람들은 지루함을

간접적으로 표현한다.

그래서 느닫없이 다른 주제로 방향을

돌리면 왜 그러냐는 반응을 보인다.

그래서 대화를 정리하고 말을 마칠려하면

그 또한 아이러니하게 아쉬움을 표한다.

예전 부터 말을 잘하고 싶다는 생각에

사로 잡혀 말만 번지르 하게 늘어놓는 습관만

가졌는데 이제 부터는 필요할 때

말을 마치고 말을 정리해서 하려는 습관을

가지려 노력을 해야겠다.

오늘의 소소한 생각...

'일상 > 수다' 카테고리의 다른 글

대화라는 것에 대해  (0) 2014.01.18
부산 삼성소프트웨어멤버십 생활..  (0) 2013.10.30
오늘부터 c++공부해야지  (0) 2012.04.03
신개념 플레이어 하나 만들려다가  (0) 2012.03.10
  (0) 2012.02.20
소멤 생활 대략 20일차  (0) 2012.02.17
Posted by 최군 행복한 최군

댓글을 달아 주세요

일상/하루하루2014. 1. 10. 01:09

오늘부터 php 공부를 시작해보려한다.


목적은 홈페이지 제작


공부든 뭐든 동기가 있어야 되니.


이번에는 충분한 동기가 있는거라 생각된다.


잘해봐야지

'일상 > 하루하루' 카테고리의 다른 글

오늘부터 php 공부를 시작해야지.  (0) 2014.01.10
[음식] 파리바게뜨 블루베리크림 치즈케익  (0) 2013.11.03
부산 남포동 할매가야밀면  (0) 2013.10.30
부산국제영화제..  (0) 2013.10.22
경성대 모모스테이크  (0) 2013.10.22
10.20 생각?  (0) 2012.10.20
Posted by 최군 행복한 최군

댓글을 달아 주세요

programming/Android2013. 11. 3. 05:50

안드로이드에서 Notification


즉, status bar에 알람을 줄 때, 


단순히 주어진 것만 쓰기에 상당히 부족한감이 있다.


그래서 custom으로 만들어 쓰는데 


만들어 쓰기 위해서는 아래와 같이 해줘야한다.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
     NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        Notification.Builder builder = new Notification.Builder(getApplicationContext());
     builder.setSmallIcon(R.drawable.ic_launcher);
        builder.setTicker("Sample");
        builder.setWhen(System.currentTimeMillis());
        builder.setNumber(10);
        builder.setContentTitle("Title");
        builder.setContentText("");
        Notification noti = builder.build();    
        Intent intent_ = new Intent("com.example.mainactivity");
        PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent_,
                PendingIntent.FLAG_UPDATE_CURRENT);
         
     RemoteViews contentiew = new RemoteViews(getPackageName(), R.layout.removeview);
        contentiew.setOnClickPendingIntent(R.id.button, pendingIntent);
        noti.contentView = contentiew;
        nm.notify(1, noti);



위의 코드를 보면 RemoteViews의 객체를 통해 notification의 contentView를 바꿔치기 하는 것을볼 수 있다.


이 작업을 통해 Notification의 view를 바꿔 custom으로 제작 할 수 있게 된다.


여기서는 notification에 button을 추가하여 버튼 클릭시 동작 하도록 하였는데 이 때 필요한 작업이


아래와 같다.


1
2
3
4
5
6
        Intent intent_ = new Intent("com.example.mainactivity");
        PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent_,
                PendingIntent.FLAG_UPDATE_CURRENT);
         
     RemoteViews contentiew = new RemoteViews(getPackageName(), R.layout.removeview);
        contentiew.setOnClickPendingIntent(R.id.button, pendingIntent);

contentView에서 button 클릭 이벤트를 받는 방법은 BroadcastReceiver을 통한 방법인데, 


intent_에서 보내려는 action (여기서는 "com.example.mainactivity"가 그에 해당함)을 담아 pendingintent에 추가해주고 


선언한 contentview에서 setOnClickPendingIntent(Resource ID, pendingintent instance); 함수를 통해 


등록해준다 이렇게 등록을 해두고,


아래와 같이 BroadcastReceive를 등록해준다.


1
2
3
4
5
6
7
8
9
10
11
12
    BroadcastReceiver buttonBroadcastReceiver = new BroadcastReceiver() {
 
            @Override
            public void onReceive(Context context, Intent intent) {
                // TODO Auto-generated method stub
                Toast.makeText(context, "notification Button Clicked", Toast.LENGTH_LONG).show();
            }
        };
 
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("com.example.mainactivity");
        registerReceiver(buttonBroadcastReceiver, intent);


이렇게 등록해두면 Notification에 Button을 누를 때마다 


아래와 같이 "notification Button Clicked"라는 메세지가 toast가 된다.



    


이걸 응용하면 자신이 원하는 notification을 손쉽게 구현할 수 있다.






Posted by 최군 행복한 최군

댓글을 달아 주세요