마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

갤러리의 크롭 / 배경화면 설정 구현방법이 궁금합니다..

0 추천

크롭화면

 

위의 스샷처럼 크롭도 하면서 바로 배경화면 설정도 하게끔 하려하는데

어떻게 Intent 를 날려야되는지 모르겠습니다 ㅠㅠ 

구글 검색해보니 일반 크롭화면 설정소스만 공유되있는거같네요...ㅠㅠ

꼭좀 답변부탁드립니다!

아직도초보 (3,030 포인트) 님이 2014년 7월 4일 질문

1개의 답변

+1 추천
 
채택된 답변
Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
startActivity(Intent.createChooser(intent, "Select Wallpaper"));
이렇게해주시면
android.intent.action.SET_WALLPAPER 액션으로 등록된 앱목록들이 반응을합니다.
아니면 직접 커스텀해서 만들어야합니다..
whdrb19 (23,520 포인트) 님이 2014년 7월 4일 답변
아직도초보님이 2014년 7월 7일 채택됨
아니요 ㅠㅠ 갤러리가서 배경화면 지정하면
홈화면 설정, 잠금화면설정 이런게 뜨던데
Intent에서 잘 불러오면 쓸수있을거같은데 어케써야될지몰라서요...
무슨말씀이세요...?
배경화면 지정누르면 저액션을 요청합니다..
갤러리앱소스에서 퍼온건데...


//갤러리앱소스..
package com.android.camera;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

/**
 * Wallpaper picker for the camera application. This just redirects to the
 * standard pick action.
 */
public class Wallpaper extends NoSearchActivity {
    @SuppressWarnings("unused")
    private static final String TAG = "Wallpaper";
    private static final int PHOTO_PICKED = 1;
    private static final int CROP_DONE = 2;

    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        
        Uri imageToUse = getIntent().getData();
        if (imageToUse != null) {
            Intent intent = new Intent();
            intent.setClass(this, CropImage.class);
            intent.setData(imageToUse);
            formatIntent(intent);
            startActivityForResult(intent, CROP_DONE);
        } else {
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
            intent.setType("image/*");
            intent.putExtra("crop", "true");
            formatIntent(intent);
            startActivityForResult(intent, PHOTO_PICKED);
        }
    }

    protected void formatIntent(Intent intent) {
        int width = getWallpaperDesiredMinimumWidth();
        int height = getWallpaperDesiredMinimumHeight();
        intent.putExtra("outputX",         width);
        intent.putExtra("outputY",         height);
        intent.putExtra("aspectX",         width);
        intent.putExtra("aspectY",         height);
        intent.putExtra("scale",           true);
        intent.putExtra("noFaceDetection", true);
        intent.putExtra("setWallpaper",    true);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode,
                                    Intent data) {
        if ((requestCode == PHOTO_PICKED || requestCode == CROP_DONE)) {
            setResult(resultCode);
            finish();
        }
    }
}
매니페스트
<activity android:name="com.android.camera.Wallpaper"
                android:label="@string/camera_setas_wallpaper"
                android:icon="@drawable/ic_launcher_gallery">
            <intent-filter>
                <action android:name="android.intent.action.ATTACH_DATA" />
                <data android:mimeType="image/*" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>


/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.camera;

/**
 * Wallpaper picker for the camera application.
 * This just redirects to the standard pick action.
 */
public class PickWallpaper extends Wallpaper {
}


<activity android:name="com.android.camera.PickWallpaper"
                android:label="@string/camera_pick_wallpaper"
                android:icon="@drawable/ic_launcher_gallery">
            <intent-filter>
                <action android:name="android.intent.action.SET_WALLPAPER" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

하고싶은것을 정확히 ... 상세하게 말씀해주세요~
혹시 괜찮으시면 메일좀 알수있을까요? 메일로 사진첨부해서 보내드릴게요 ㅠㅠ
hjkhjk2002@naver.com이에요
...