0

ユーザーの携帯電話のギャラリーから写真を撮り、Android ウェアラブル ウォッチフェイスに変換するアプリを作成することは可能ですか?

私はこれらのAndroidの記事を読んでいます

https://developer.android.com/training/wearables/watch-faces/index.html

https://developer.android.com/training/wearables/watch-faces/drawing.html

ユーザーにギャラリーから画像を選択してビットマップに変換させることができれば、それをウォッチフェイスとして設定するのが妥当だと思われます。Android と APK に関して言えば、私は間違いなく初心者のプログラマーです。より高度な Android 開発者からの確認は素晴らしいことです。

私が混乱しているのは、ユーザーの電話で写真の選択が行われ、それが Android ウェアラブル アプリに送信されるか、またはウェアラブル アプリがユーザーの電話のギャラリーにアクセスして直接選択できるかどうかです。ウェアラブル アプリがユーザーの携帯電話のギャラリーにアクセスできるかどうか知っている人はいますか?

選択した画像の参照が既にあると仮定すると、次のようになりますか? 私が間違っている場合は修正してください。(「ウォッチフェイス要素の初期化」の 2 番目の記事から取得)

@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    // configure the system UI (see next section)
    ...

    // load the background image
    Resources resources = AnalogWatchFaceService.this.getResources();
    //at this point the user should have already picked the picture they want
    //so set "backgroundDrawable" to the image the user picture
    int idOfUserSelectPicture = GetIdOfUserSelectedPictureSomehow();
    Drawable backgroundDrawable = resources.getDrawable(idOfUserSelectPicture, null);
    //original implementation from article
    //Drawable backgroundDrawable = resources.getDrawable(R.drawable.bg, null);
    mBackgroundBitmap = ((BitmapDrawable) backgroundDrawable).getBitmap();

    // create graphic styles
    mHourPaint = new Paint();
    mHourPaint.setARGB(255, 200, 200, 200);
    mHourPaint.setStrokeWidth(5.0f);
    mHourPaint.setAntiAlias(true);
    mHourPaint.setStrokeCap(Paint.Cap.ROUND);
    ...

    // allocate a Calendar to calculate local time using the UTC time and time zone
    mCalendar = Calendar.getInstance();
}

助けてくれてありがとう。

4

1 に答える 1

0

これを実装する方法は、デバイス上の画像から選択する、電話で実行される構成アクティビティを作成することです。次に、この画像をデータレイヤーhttp://developer.android.com/training/wearables/data-layer/index.htmlを介してアセットとして送信すると、時計側で受信され、作成できますウォッチフェイスの背景。

Android Wear デバイスが携帯電話で写真コレクションを表示することはできません。それらは完全に別のデバイスであり、これを行うアプリケーションを作成しない限り、既定では何も共有されません。

データレイヤーのサンプルは、電話で写真を撮り、それをウェアラブルに送信する方法を示しています: https://github.com/googlesamples/android-DataLayer

于 2015-07-22T18:39:31.760 に答える