1 package org.iotivity.service.sample.client;
3 import android.content.Context;
4 import android.util.Log;
5 import android.widget.Toast;
7 import org.iotivity.service.RcsException;
8 import org.iotivity.service.client.RcsRemoteResourceObject;
11 public static String resourceInfo(RcsRemoteResourceObject resourceObject)
13 StringBuilder sb = new StringBuilder();
15 sb.append("URI : " + resourceObject.getUri() + "\n");
16 sb.append("Host : " + resourceObject.getAddress() + "\n");
17 for (String type : resourceObject.getTypes()) {
18 sb.append("resourceType : " + type + "\n");
21 for (String itf : resourceObject.getInterfaces()) {
22 sb.append("resourceInterfaces : " + itf + "\n");
25 sb.append("isObservable : " + resourceObject.isObservable() + "\n");
30 public static void showError(Context ctx, String tag, String msg) {
31 Toast.makeText(ctx, msg, Toast.LENGTH_SHORT).show();
35 public static void showError(Context ctx, String tag, Exception e) {
36 Toast.makeText(ctx, e.getMessage(), Toast.LENGTH_SHORT).show();
37 Log.e(tag, e.getMessage(), e);