2 * ******************************************************************
4 * Copyright 2016 Samsung Electronics All Rights Reserved.
6 * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
20 * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
23 package org.iotivity.base.examples;
25 import android.app.Activity;
26 import android.app.Fragment;
27 import android.content.Context;
28 import android.os.Bundle;
29 import android.view.LayoutInflater;
30 import android.view.View;
31 import android.view.ViewGroup;
32 import android.widget.Button;
35 * This class the template for the test.
37 public class TemplateFragment extends Fragment implements View.OnClickListener {
39 private Activity mActivity;
40 private Context mContext;
47 public View onCreateView(LayoutInflater inflater, ViewGroup container,
48 Bundle savedInstanceState) {
49 View rootView = inflater.inflate(R.layout.fragment_template, container, false);
51 buttonA = (Button) rootView.findViewById(R.id.btn_A);
52 buttonB = (Button) rootView.findViewById(R.id.btn_B);
53 buttonC = (Button) rootView.findViewById(R.id.btn_C);
55 buttonA.setOnClickListener(this);
56 buttonB.setOnClickListener(this);
57 buttonC.setOnClickListener(this);
63 public void onCreate(Bundle savedInstanceState) {
64 super.onCreate(savedInstanceState);
65 mActivity = getActivity();
66 mContext = mActivity.getBaseContext();
70 public void onResume() {
75 public void onPause() {
80 public void onDestroy() {
85 public void onClick(View view) {
86 StringBuilder sb = new StringBuilder(getString(R.string.action_onclick));
87 switch (view.getId()) {
89 sb.append(getString(R.string.button_A));
92 sb.append(getString(R.string.button_B));
95 sb.append(getString(R.string.button_C));
98 Common.showToast(mContext, sb.toString());