2013-07-18 2 views
0

나는 그림을 듣고 싶습니다.Android에서 새로운 그림 작업 수행

<receiver 
android:name="CameraButtonActivity"> 
    <intent-filter> 
     <action 
     android:name="android.intent.action.CAMERA_BUTTON" 
     /> 
     <category 
     android:name="android.intent.category.LAUNCHER" 
     /> 
    </intent-filter> 
</receiver>  




public class CameraButtonActivity extends BroadcastReceiver { 
    static final String ACTION = "android.intent.action.CAMERA_BUTTON"; 

    public void onReceive(Context context, Intent intent) { 
     if (intent.getAction().equals(ACTION)) { 
      System.out.println("Take picture"); 
     } 
    } 
} 

를하지만 작품을 보인다 없습니다 :
나는 코드 아래 사용합니다.
요청을 어떻게받을 수 있습니까?

답변

1

당신은 작업

public static final String ACTION_NEW_PICTURE 

이 새로운 사진이 카메라로 촬영하고, 사진의 항목이 미디어 저장소에 추가 된 경우 해고되는 방송 활동이다 경청해야한다. getData()는 그림의 URI입니다.

상수 값 : "android.hardware.action.NEW_PICTURE"

또한 동일한 질문이 link을 확인합니다.

희망이 내가 'android.hardware.action.NEW_PICTURE'와 'android.intent.action.CAMERA_BUTTON'을 대체하려고

+0

을 할 수 있지만, 일을하지 보인다. – brian

+0

하드웨어 카메라에 대한 권한을 추가 했습니까? – Shraddha

+1

내 대답을 편집하고 하나의 링크를 추가했습니다. 확인하십시오. – Shraddha