1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.example.android.wearable.datalayer.fragments;
18 
19 import android.app.Fragment;
20 import android.graphics.Bitmap;
21 import android.os.Bundle;
22 import android.support.annotation.Nullable;
23 import android.view.LayoutInflater;
24 import android.view.View;
25 import android.view.ViewGroup;
26 import android.widget.ImageView;
27 
28 import com.example.android.wearable.datalayer.R;
29 
30 /**
31  * A simple fragment that shows a (photo) asset received from the phone.
32  */
33 public class AssetFragment extends Fragment {
34 
35     private ImageView mPhoto;
36 
37     @Nullable
38     @Override
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)39     public View onCreateView(LayoutInflater inflater, ViewGroup container,
40             Bundle savedInstanceState) {
41         View view = inflater.inflate(R.layout.asset_fragment, container, false);
42         mPhoto = (ImageView) view.findViewById(R.id.photo);
43         return view;
44     }
45 
setBackgroundImage(Bitmap bitmap)46     public void setBackgroundImage(Bitmap bitmap) {
47         mPhoto.setImageBitmap(bitmap);
48     }
49 }
50