JskAndroidGui.java
Go to the documentation of this file.
00001 package org.ros.android.jskAndroidGui;
00002 
00003 import java.util.ArrayList;
00004 
00005 import jsk_gui_msgs.Action;
00006 import jsk_gui_msgs.QueryRequest;
00007 import jsk_gui_msgs.QueryResponse;
00008 
00009 import org.ros.address.InetAddressFactory;
00010 import org.ros.android.robotapp.RosAppActivity;
00011 import org.ros.android.view.VirtualJoystickView;
00012 import org.ros.namespace.GraphName;
00013 import org.ros.namespace.NameResolver;
00014 import org.ros.node.Node;
00015 import org.ros.node.NodeConfiguration;
00016 import org.ros.node.NodeMainExecutor;
00017 import org.ros.node.parameter.ParameterListener;
00018 import org.ros.node.parameter.ParameterTree;
00019 import org.ros.node.service.ServiceServer;
00020 
00021 import android.annotation.SuppressLint;
00022 import android.app.AlertDialog;
00023 import android.content.DialogInterface;
00024 import android.graphics.Color;
00025 import android.os.Bundle;
00026 import android.os.Handler;
00027 import android.util.Log;
00028 import android.view.ContextMenu;
00029 import android.view.ContextMenu.ContextMenuInfo;
00030 import android.view.LayoutInflater;
00031 import android.view.Menu;
00032 import android.view.MenuInflater;
00033 import android.view.MenuItem;
00034 import android.view.View;
00035 import android.view.View.OnClickListener;
00036 import android.webkit.WebView;
00037 import android.webkit.WebViewClient;
00038 import android.widget.AdapterView;
00039 import android.widget.AdapterView.OnItemSelectedListener;
00040 import android.widget.ArrayAdapter;
00041 import android.widget.Button;
00042 import android.widget.EditText;
00043 import android.widget.FrameLayout;
00044 import android.widget.ImageButton;
00045 import android.widget.ImageView;
00046 import android.widget.RadioButton;
00047 import android.widget.RadioGroup;
00048 import android.widget.SeekBar;
00049 import android.widget.SeekBar.OnSeekBarChangeListener;
00050 import android.widget.Spinner;
00051 import android.widget.TextView;
00052 import android.widget.Toast;
00053 import android.widget.ViewFlipper;
00054 
00055 //import java.util.*;
00056 
00061 public class JskAndroidGui extends RosAppActivity {
00062 
00063         public JskAndroidGui() {
00064                 super("jsk android gui", "jsk android gui");
00065         }
00066 
00067         private String robotAppName, cameraTopic, cameraInfoTopic,
00068                         moveItWrt = "local";
00069         private SensorImageViewInfo cameraView;
00070         private VirtualJoystickView joystickView;
00071         private TextView postv, rottv;
00072         private EditText urltv;
00073         private JskAndroidGuiNode jskAndroidGuiNode;
00074 
00075         private ParameterTree params;
00076         private Node public_node;
00077         private ServiceServer<QueryRequest, QueryResponse> server;
00078         private Button yes_button, no_button, x_minus_button, x_plus_button,
00079                         y_minus_button, y_plus_button, z_minus_button, z_plus_button,
00080                         start_button, stop_button, movearm_button, url_button,
00081                         circle_button, linear_button, cancel_button;
00082         private ImageButton tweet_button;
00083         private RadioGroup radioGroup;
00084         private RadioGroup radioGroup_moveIt;
00085         private RadioGroup radioGroup_wrt;
00086         private boolean moveit_pos;
00087         private SeekBar posbar, rotbar;
00088         private int posval, rotval;
00089         private Spinner spots_spinner, tasks_spinner, image_spinner,
00090                         points_spinner;
00091         private ViewFlipper viewFlipper, webViewFlipper;
00092         private WebView webView;
00093         private BoundingBoxView boundingBoxView;
00094         private FrameLayout frameLayout;
00095 
00096         private ArrayList<String> spots_list = new ArrayList(),
00097                         tasks_list = new ArrayList(), image_list = new ArrayList(),
00098                         camera_info_list = new ArrayList(), points_list = new ArrayList();
00099         private String defaultImage = "/openni/rgb/image_color",
00100                         defaultCameraInfo = "/openni/rgb/camera_info",
00101                         defaultPoints = "/openni/depth_registered/points_throttle";
00102         // will be renamed when parameter updated
00103 
00104         private Object[] found_task, query_input;
00105         private boolean isDrawLine = false, isAdapterSet_spots = false,
00106                         isAdapterSet_tasks = false, isNotParamInit = true,
00107                         isAdapterSet_camera = false, isAdapterSet_points = false,
00108                         isParamSet = false, LongTouchFlag = true;
00109 
00110         private Handler mHandler;
00111 
00112         static final int CONTEXT_MENU1_ID = 0, CONTEXT_MENU2_ID = 1,
00113                         CONTEXT_MENU3_ID = 2, CONTEXT_MENU4_ID = 4;
00114 
00115         @SuppressLint("SetJavaScriptEnabled")
00116         @Override
00117         public void onCreate(Bundle savedInstanceState) {
00118 
00119                 setDefaultRobotName("pr1040");
00120                 setDefaultAppName("jsk_android_gui/jsk_android_gui");
00121                 setDashboardResource(R.id.top_bar);
00122                 setMainWindowResource(R.layout.main);
00123                 super.onCreate(savedInstanceState);
00124 
00125                 jskAndroidGuiNode = new JskAndroidGuiNode();
00126 
00127                 viewFlipper = (ViewFlipper) findViewById(R.id.flipper);
00128                 webViewFlipper = (ViewFlipper) findViewById(R.id.webviewflipper);
00129                 webView = (WebView) findViewById(R.id.WebView);
00130                 webView.setWebViewClient(new WebViewClient() {
00131                         @Override
00132                         public boolean shouldOverrideUrlLoading(WebView view, String url) {
00133                                 return false;
00134                         }
00135                 });
00136                 webView.getSettings().setJavaScriptEnabled(true);
00137                 webView.loadUrl("http://www.google.co.jp/");
00138                 urltv = (EditText) findViewById(R.id.webURL);
00139                 urltv.setText("http://www.google.co.jp/");
00140                 url_button = (Button) findViewById(R.id.URLbutton);
00141 
00142                 tweet_button = (ImageButton) findViewById(R.id.tweet);
00143                 yes_button = (Button) findViewById(R.id.resultyes);
00144                 no_button = (Button) findViewById(R.id.resultno);
00145                 x_minus_button = (Button) findViewById(R.id.move_x_minus);
00146                 x_plus_button = (Button) findViewById(R.id.move_x_plus);
00147                 y_minus_button = (Button) findViewById(R.id.move_y_minus);
00148                 y_plus_button = (Button) findViewById(R.id.move_y_plus);
00149                 z_minus_button = (Button) findViewById(R.id.move_z_minus);
00150                 z_plus_button = (Button) findViewById(R.id.move_z_plus);
00151                 start_button = (Button) findViewById(R.id.manipulation_start);
00152                 stop_button = (Button) findViewById(R.id.manipulation_stop);
00153                 movearm_button = (Button) findViewById(R.id.movearm);
00154                 circle_button = (Button) findViewById(R.id.circular_manipulation);
00155                 linear_button = (Button) findViewById(R.id.linear_manipulation);
00156                 cancel_button = (Button) findViewById(R.id.cancel_manipulation);
00157 
00158                 posbar = (SeekBar) findViewById(R.id.seekbarpos);
00159                 rotbar = (SeekBar) findViewById(R.id.seekbarrot);
00160                 postv = (TextView) findViewById(R.id.posvaluetv);
00161                 postv.setText("pos: " + posbar.getProgress() + " mm");
00162                 posval = posbar.getProgress();
00163                 rottv = (TextView) findViewById(R.id.rotvaluetv);
00164                 rottv.setText("rot " + rotbar.getProgress() + " degree");
00165                 rotval = rotbar.getProgress();
00166 
00167                 posbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
00168                         public void onProgressChanged(SeekBar seekBar, int progress,
00169                                         boolean fromUser) {
00170                                 postv.setText("pos: " + progress + " mm");
00171                                 posval = progress;
00172                         }
00173 
00174                         public void onStartTrackingTouch(SeekBar seekBar) {
00175 
00176                         }
00177 
00178                         public void onStopTrackingTouch(SeekBar seekBar) {
00179 
00180                         }
00181                 });
00182 
00183                 rotbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
00184                         public void onProgressChanged(SeekBar seekBar, int progress,
00185                                         boolean fromUser) {
00186                                 rottv.setText("rot: " + progress + " degree");
00187                                 rotval = progress;
00188                         }
00189 
00190                         public void onStartTrackingTouch(SeekBar seekBar) {
00191 
00192                         }
00193 
00194                         public void onStopTrackingTouch(SeekBar seekBar) {
00195 
00196                         }
00197                 });
00198 
00199                 radioGroup = (RadioGroup) findViewById(R.id.radiogroup);
00200                 radioGroup.check(R.id.radiobutton_L);
00201                 radioGroup
00202                                 .setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
00203                                         public void onCheckedChanged(RadioGroup group, int checkedId) {
00204                                                 RadioButton radioButton = (RadioButton) findViewById(checkedId);
00205                                                 if (radioButton.getText().equals("left")) {
00206                                                         cameraView.SetRobotArm(Action.LARMID);
00207                                                         Toast.makeText(JskAndroidGui.this,
00208                                                                         "robot arm set to :larm",
00209                                                                         Toast.LENGTH_SHORT).show();
00210                                                         Log.i("JskAndroidGui:ItemSeleted",
00211                                                                         "Set arm to :larm");
00212                                                 } else {
00213                                                         cameraView.SetRobotArm(Action.RARMID);
00214                                                         Toast.makeText(JskAndroidGui.this,
00215                                                                         "robot arm set to :rarm",
00216                                                                         Toast.LENGTH_SHORT).show();
00217                                                         Log.i("JskAndroidGui:ItemSeleted",
00218                                                                         "Set arm to :rarm");
00219                                                 }
00220                                         }
00221                                 });
00222                 radioGroup_moveIt = (RadioGroup) findViewById(R.id.radiogroup_moveit);
00223                 radioGroup_moveIt.check(R.id.radiobutton_pos);
00224                 moveit_pos = true;
00225                 radioGroup_moveIt
00226                                 .setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
00227                                         public void onCheckedChanged(RadioGroup group, int checkedId) {
00228                                                 RadioButton radioButton = (RadioButton) findViewById(checkedId);
00229                                                 if (radioButton.getText().equals("pos")) {
00230                                                         moveit_pos = true;
00231                                                         x_minus_button.setText("x-");
00232                                                         x_plus_button.setText("x+");
00233                                                         y_minus_button.setText("y-");
00234                                                         y_plus_button.setText("y+");
00235                                                         z_minus_button.setText("z-");
00236                                                         z_plus_button.setText("z+");
00237 
00238                                                 } else {
00239                                                         moveit_pos = false;
00240                                                         x_minus_button.setText("roll-");
00241                                                         x_plus_button.setText("roll+");
00242                                                         y_minus_button.setText("pitch-");
00243                                                         y_plus_button.setText("pitch+");
00244                                                         z_minus_button.setText("yaw-");
00245                                                         z_plus_button.setText("yaw+");
00246                                                 }
00247                                         }
00248                                 });
00249 
00250                 radioGroup_wrt = (RadioGroup) findViewById(R.id.radiogroup_wrt);
00251                 radioGroup_wrt.check(R.id.radiobutton_local);
00252                 radioGroup_wrt
00253                                 .setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
00254                                         public void onCheckedChanged(RadioGroup group, int checkedId) {
00255                                                 RadioButton radioButton = (RadioButton) findViewById(checkedId);
00256                                                 if (radioButton.getText().equals("local")) {
00257                                                         moveItWrt = "local";
00258                                                 } else {
00259                                                         moveItWrt = "world";
00260                                                 }
00261                                         }
00262                                 });
00263 
00264                 spots_spinner = (Spinner) findViewById(R.id.spinner_spots);
00265                 ArrayAdapter<String> adapter_spots = new ArrayAdapter<String>(this,
00266                                 R.layout.list);
00267                 spots_spinner.setAdapter(adapter_spots);
00268                 adapter_spots
00269                                 .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
00270                 spots_spinner.setPromptId(R.string.SpinnerPrompt_spots);
00271 
00272                 tasks_spinner = (Spinner) findViewById(R.id.spinner_tasks);
00273                 ArrayAdapter<String> adapter_tasks = new ArrayAdapter<String>(this,
00274                                 R.layout.list);
00275                 tasks_spinner.setAdapter(adapter_tasks);
00276                 adapter_tasks
00277                                 .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
00278                 tasks_spinner.setPromptId(R.string.SpinnerPrompt_tasks);
00279 
00280                 image_spinner = (Spinner) findViewById(R.id.spinner_image);
00281 
00282                 ArrayAdapter<String> adapter_image = new ArrayAdapter<String>(this,
00283                                 R.layout.list);
00284                 image_spinner.setAdapter(adapter_image);
00285                 adapter_image
00286                                 .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
00287 
00288                 points_spinner = (Spinner) findViewById(R.id.spinner_points);
00289 
00290                 ArrayAdapter<String> adapter_points = new ArrayAdapter<String>(this,
00291                                 R.layout.list);
00292                 points_spinner.setAdapter(adapter_points);
00293                 adapter_points
00294                                 .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
00295 
00296                 if (getIntent().hasExtra("camera_topic")) {
00297                         cameraTopic = getIntent().getStringExtra("camera_topic");
00298                 } else {
00299                         cameraTopic = "/tablet/marked/image_rect_color/compressed_throttle";
00300                 }
00301                 if (getIntent().hasExtra("camera_info_topic")) {
00302                         cameraInfoTopic = getIntent().getStringExtra("camera_info_topic");
00303                 } else {
00304                         cameraInfoTopic = "/tablet/marked/camera_info";
00305                 }
00306                 joystickView = (VirtualJoystickView) findViewById(R.id.joystick);
00307                 joystickView.setTopicName("android/cmd_vel");
00308                 frameLayout = (FrameLayout) findViewById(R.id.image);
00309                 cameraView = new SensorImageViewInfo(this);
00310                 cameraView.setClickable(true);
00311                 cameraView.SetRobotArm(Action.LARMID);
00312                 cameraView.setCameraTopic(cameraTopic);
00313                 cameraView.setCameraInfoTopic(cameraInfoTopic);
00314                 boundingBoxView = new BoundingBoxView(this);
00315                 cameraView.setView(boundingBoxView);
00316                 frameLayout.addView(boundingBoxView);
00317                 frameLayout.addView(cameraView);
00318 
00319                 mHandler = new Handler();
00320                 // ImageView ivInContext = (ImageView) findViewById(R.id.image);
00321                 // ivInContext.setFocusable(true);
00322                 // ivInContext.setClickable(true);
00323                 boundingBoxView.setFocusable(true);
00324                 boundingBoxView.setClickable(true);
00325                 registerForContextMenu(boundingBoxView);
00326         }
00327 
00328         @Override
00329         protected void init(NodeMainExecutor nodeMainExecutor) {
00330 
00331                 super.init(nodeMainExecutor);
00332 
00333                 NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(
00334                                 InetAddressFactory.newNonLoopback().getHostAddress(),
00335                                 getMasterUri());
00336 
00337                 NameResolver appNamespace = getAppNameSpace();
00338                 nodeMainExecutor.execute(cameraView,
00339                                 nodeConfiguration.setNodeName("android/camera_view"));
00340 
00341                 // cameraView.start(node, appNamespace.resolve(cameraTopic).toString());
00342                 cameraView.post(new Runnable() {
00343                         @Override
00344                         public void run() {
00345                                 Log.i("JskAndroidGui:debug", "cameraView run");
00346                                 cameraView.setSelected(true);
00347                         }
00348                 });
00349                 nodeMainExecutor.execute(jskAndroidGuiNode,
00350                                 nodeConfiguration.setNodeName("android/jsk_android_gui"));
00351                 nodeMainExecutor.execute(joystickView,
00352                                 nodeConfiguration.setNodeName("android/joystick"));
00353 
00354                 waitForSetupNode();
00355         }
00356 
00357         private void waitForSetupNode() {
00358                 while (!jskAndroidGuiNode.setupEnd) {
00359 
00360                         try {
00361                                 Thread.sleep(1000);
00362                         } catch (Exception e) {
00363 
00364                         }
00365                 }
00366 
00367                 setListener();
00368                 setupListener();
00369         }
00370 
00371         private void setListener() {
00372                 // Tweet function
00373                 tweet_button.setOnClickListener(new OnClickListener() {
00374                         public void onClick(View viw) {
00375                                 LayoutInflater inflater = LayoutInflater
00376                                                 .from(JskAndroidGui.this);
00377                                 final View view = inflater.inflate(R.layout.dialog, null);
00378 
00379                                 final EditText editText = (EditText) view
00380                                                 .findViewById(R.id.editText1);
00381                                 mHandler.post(new Runnable() {
00382                                         public void run() {
00383                                                 Log.i("JskAndroidGui:debug", "dialog handler");
00384                                                 new AlertDialog.Builder(JskAndroidGui.this)
00385                                                                 .setTitle("tweet with image")
00386                                                                 .setView(view)
00387                                                                 .setPositiveButton("tweet",
00388                                                                                 new DialogInterface.OnClickListener() {
00389                                                                                         @Override
00390                                                                                         public void onClick(
00391                                                                                                         DialogInterface dialog,
00392                                                                                                         int which) {
00393 
00394                                                                                                 jskAndroidGuiNode
00395                                                                                                                 .tweetTask(editText
00396                                                                                                                                 .getText()
00397                                                                                                                                 .toString());
00398                                                                                                 Toast.makeText(
00399                                                                                                                 JskAndroidGui.this,
00400                                                                                                                 "tasks: Tweet",
00401                                                                                                                 Toast.LENGTH_SHORT)
00402                                                                                                                 .show();
00403                                                                                                 Log.i("JskAndroidGui:ButtonClicked",
00404                                                                                                                 "Sending Tweet");
00405                                                                                         }
00406                                                                                 }).show();
00407                                         }
00408                                 });
00409                         }
00410                 });
00411         }
00412 
00413         protected void setupListener() {
00414                 yes_button.setOnClickListener(new OnClickListener() {
00415                         public void onClick(View viw) {
00416                                 jskAndroidGuiNode.selectTask("ResultYes");
00417                                 Toast.makeText(JskAndroidGui.this, "tasks: ResultYes",
00418                                                 Toast.LENGTH_SHORT).show();
00419                                 Log.i("JskAndroidGui:ButtonClicked", "Sending ResultYes");
00420                         }
00421                 });
00422 
00423                 no_button.setOnClickListener(new OnClickListener() {
00424                         public void onClick(View viw) {
00425                                 jskAndroidGuiNode.selectTask("ResultNo");
00426                                 Toast.makeText(JskAndroidGui.this, "tasks: ResultNo",
00427                                                 Toast.LENGTH_SHORT).show();
00428                                 Log.i("JskAndroidGui:ButtonClicked", "Sending ResultNo");
00429                         }
00430                 });
00431 
00432                 x_minus_button.setOnClickListener(new OnClickListener() {
00433                         public void onClick(View viw) {
00434                                 if (moveit_pos)
00435                                         cameraView.SendMoveItMsg("x-", moveItWrt, posval);
00436                                 else
00437                                         cameraView.SendMoveItMsg("roll-", moveItWrt, rotval);
00438                         }
00439                 });
00440                 x_plus_button.setOnClickListener(new OnClickListener() {
00441                         public void onClick(View viw) {
00442                                 if (moveit_pos)
00443                                         cameraView.SendMoveItMsg("x+", moveItWrt, posval);
00444                                 else
00445                                         cameraView.SendMoveItMsg("roll+", moveItWrt, rotval);
00446                         }
00447                 });
00448                 y_minus_button.setOnClickListener(new OnClickListener() {
00449                         public void onClick(View viw) {
00450                                 if (moveit_pos)
00451                                         cameraView.SendMoveItMsg("y-", moveItWrt, posval);
00452                                 else
00453                                         cameraView.SendMoveItMsg("pitch-", moveItWrt, rotval);
00454                         }
00455                 });
00456                 y_plus_button.setOnClickListener(new OnClickListener() {
00457                         public void onClick(View viw) {
00458                                 if (moveit_pos)
00459                                         cameraView.SendMoveItMsg("y+", moveItWrt, posval);
00460                                 else
00461                                         cameraView.SendMoveItMsg("pitch+", moveItWrt, rotval);
00462                         }
00463                 });
00464                 z_minus_button.setOnClickListener(new OnClickListener() {
00465                         public void onClick(View viw) {
00466                                 if (moveit_pos)
00467                                         cameraView.SendMoveItMsg("z-", moveItWrt, posval);
00468                                 else
00469                                         cameraView.SendMoveItMsg("yaw-", moveItWrt, rotval);
00470                         }
00471                 });
00472                 z_plus_button.setOnClickListener(new OnClickListener() {
00473                         public void onClick(View viw) {
00474                                 if (moveit_pos)
00475                                         cameraView.SendMoveItMsg("z+", moveItWrt, posval);
00476                                 else
00477                                         cameraView.SendMoveItMsg("yaw+", moveItWrt, rotval);
00478                         }
00479                 });
00480 
00481                 start_button.setOnClickListener(new OnClickListener() {
00482                         public void onClick(View viw) {
00483                                 cameraView.SendMoveItMsg("start", moveItWrt, 0);
00484                         }
00485                 });
00486                 stop_button.setOnClickListener(new OnClickListener() {
00487                         public void onClick(View viw) {
00488                                 cameraView.SendMoveItMsg("stop", moveItWrt, 0);
00489                         }
00490                 });
00491                 movearm_button.setOnClickListener(new OnClickListener() {
00492                         public void onClick(View viw) {
00493                                 cameraView.SendMoveItMsg("movearm", moveItWrt, 0);
00494                         }
00495                 });
00496 
00497                 circle_button.setOnClickListener(new OnClickListener() {
00498                         public void onClick(View viw) {
00499                                 cameraView.SetCircularManipulation();
00500                         }
00501                 });
00502 
00503                 linear_button.setOnClickListener(new OnClickListener() {
00504                         public void onClick(View viw) {
00505                                 cameraView.SetLinearManipulation();
00506                                 // cameraView.hoge();
00507                         }
00508                 });
00509 
00510                 cancel_button.setOnClickListener(new OnClickListener() {
00511                         public void onClick(View viw) {
00512                                 cameraView.CancelManipulation();
00513                         }
00514                 });
00515 
00516                 url_button.setOnClickListener(new OnClickListener() {
00517                         public void onClick(View viw) {
00518                                 webView.loadUrl(urltv.getText().toString());
00519                         }
00520                 });
00521 
00522                 try {
00523                         jskAndroidGuiNode.getSpotsParam();
00524                         spots_list = jskAndroidGuiNode.getSpotsList();
00525                 } catch (Exception ex) {
00526                         Log.e("JskAndroidGui", "Param cast error: " + ex.toString());
00527                         // Toast.makeText(JskAndroidGui.this, "No Param Found: " +
00528                         // ex.getMessage(), Toast.LENGTH_SHORT) .show();
00529                 }
00530 
00531                 spots_spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
00532                         public void onItemSelected(AdapterView parent, View viw, int arg2,
00533                                         long arg3) {
00534                                 if (isAdapterSet_spots) {
00535                                         Spinner spinner = (Spinner) parent;
00536                                         String item = (String) spinner.getSelectedItem();
00537                                         jskAndroidGuiNode.spotsSpinnerTask(item);
00538                                         Toast.makeText(JskAndroidGui.this,
00539                                                         "spots: MoveToSpot " + item, Toast.LENGTH_SHORT)
00540                                                         .show();
00541                                         Log.i("JskAndroidGui:ItemSeleted",
00542                                                         "Sending MoveToSpot messgae");
00543                                 } else {
00544                                         isAdapterSet_spots = true;
00545                                         Log.i("JskAndroidGui:", "spots adapter not set");
00546                                 }
00547                         }
00548 
00549                         public void onNothingSelected(AdapterView parent) {
00550                                 Toast.makeText(JskAndroidGui.this, "Updating Param",
00551                                                 Toast.LENGTH_SHORT).show();
00552                                 GetParamAndSetSpinner();
00553                         }
00554                 }); // for tasks
00555                 try {
00556                         jskAndroidGuiNode.getTasksParam();
00557                         tasks_list = jskAndroidGuiNode.getTasksList();
00558                 } catch (Exception ex) {
00559                         Log.e("JskAndroidGui", "Param cast error: " + ex.toString());
00560                         // Toast.makeText(JskAndroidGui.this, "No Param Found: " +
00561                         // ex.getMessage(), Toast.LENGTH_SHORT).show();
00562                 }
00563                 tasks_spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
00564                         public void onItemSelected(AdapterView parent, View viw, int arg2,
00565                                         long arg3) {
00566                                 if (isAdapterSet_tasks) {
00567                                         Spinner spinner = (Spinner) parent;
00568                                         String item = (String) spinner.getSelectedItem();
00569                                         jskAndroidGuiNode.tasksSpinnerTask(item);
00570                                         Toast.makeText(JskAndroidGui.this,
00571                                                         "tasks: StartDemo " + item, Toast.LENGTH_SHORT)
00572                                                         .show();
00573                                         Log.i("JskAndroidGui:ItemSeleted",
00574                                                         "Sending StartDemo messgae");
00575                                 } else {
00576                                         isAdapterSet_tasks = true;
00577                                         Log.i("JskAndroidGui:", "tasks adapter not set");
00578                                 }
00579                         }
00580 
00581                         public void onNothingSelected(AdapterView parent) {
00582                                 // Toast.makeText(JskAndroidGui.this, "Updating Param",
00583                                 // Toast.LENGTH_SHORT).show();
00584                                 GetParamAndSetSpinner();
00585                         }
00586                 });
00587                 // for camera
00588                 try {
00589                         jskAndroidGuiNode.getCameraParam();
00590                         image_list = jskAndroidGuiNode.getImageList();
00591                         camera_info_list = jskAndroidGuiNode.getCameraInfoList();
00592                 } catch (Exception ex) {
00593                         Log.e("JskAndroidGui", "Param cast error: " + ex.toString());
00594                         // Toast.makeText(JskAndroidGui.this, "No Param Found: " +
00595                         // ex.getMessage(), Toast.LENGTH_SHORT).show();
00596                 }
00597                 image_spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
00598                         public void onItemSelected(AdapterView parent, View viw, int arg2,
00599                                         long arg3) {
00600                                 if (isAdapterSet_camera) {
00601                                         Spinner spinner = (Spinner) parent;
00602                                         defaultImage = (String) spinner.getSelectedItem();
00603                                         // assume that the first element is "cameras", so -1
00604                                         defaultCameraInfo = camera_info_list.get(arg2 - 1);
00605                                         String str = "((:image " + defaultImage
00606                                                         + ") (:camera_info " + defaultCameraInfo
00607                                                         + ") (:points " + defaultPoints + "))";
00608                                         cameraView.PubSwitchSensor(str);
00609                                         // Toast.makeText(JskAndroidGui.this, "SwitchSensor: " +
00610                                         // str, Toast.LENGTH_SHORT).show();
00611                                         Log.i("JskAndroidGui:ItemSeleted", "Sending switch messgae");
00612                                 } else {
00613                                         isAdapterSet_camera = true;
00614                                         Log.i("JskAndroidGui:", "camera adapter not set");
00615                                 }
00616                         }
00617 
00618                         public void onNothingSelected(AdapterView parent) {
00619                                 Toast.makeText(JskAndroidGui.this, "Updating Param",
00620                                                 Toast.LENGTH_SHORT).show();
00621                                 GetParamAndSetSpinner();
00622                         }
00623                 });
00624 
00625                 // for points
00626                 try {
00627                         jskAndroidGuiNode.getPointsParam();
00628                         points_list = jskAndroidGuiNode.getPointsList();
00629                 } catch (Exception ex) {
00630                         Log.e("JskAndroidGui", "Param cast error: " + ex.toString());
00631                         // Toast.makeText(JskAndroidGui.this, "No Param Found: " +
00632                         // ex.getMessage(), Toast.LENGTH_SHORT).show();
00633                 }
00634                 points_spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
00635                         public void onItemSelected(AdapterView parent, View viw, int arg2,
00636                                         long arg3) {
00637                                 if (isAdapterSet_points) {
00638                                         Spinner spinner = (Spinner) parent;
00639                                         defaultPoints = (String) spinner.getSelectedItem();
00640                                         String str = "((:image " + defaultImage
00641                                                         + ") (:camera_info " + defaultCameraInfo
00642                                                         + ") (:points " + defaultPoints + "))";
00643                                         cameraView.PubSwitchSensor(str);
00644                                         Toast.makeText(JskAndroidGui.this, "SwitchSensor: " + str,
00645                                                         Toast.LENGTH_SHORT).show();
00646                                         Log.i("JskAndroidGui:ItemSeleted", "Sending switch messgae");
00647                                 } else {
00648                                         isAdapterSet_points = true;
00649                                         Log.i("JskAndroidGui:", "points adapter not set");
00650                                 }
00651                         }
00652 
00653                         public void onNothingSelected(AdapterView parent) {
00654                                 Toast.makeText(JskAndroidGui.this, "Updating Param",
00655                                                 Toast.LENGTH_SHORT).show();
00656                                 GetParamAndSetSpinner();
00657                         }
00658                 });
00659 
00660                 params = jskAndroidGuiNode.getParameterTree();
00661                 params.addParameterListener("/Tablet/UserList",
00662                                 new ParameterListener() {
00663                                         @Override
00664                                         public void onNewValue(Object value) {
00665                                                 try {
00666                                                         jskAndroidGuiNode.getTasksParam();
00667                                                 } catch (Exception ex) {
00668                                                         Log.e("JskAndroidGui",
00669                                                                         "Param cast error: " + ex.toString());
00670                                                         // Toast.makeText(JskAndroidGui.this,
00671                                                         // "No Param Found: " + ex.getMessage(),
00672                                                         // Toast.LENGTH_SHORT).show();
00673                                                 }
00674 
00675                                                 Log.i("JskAndroidGui:GetTasksParam", "end");
00676                                                 tasks_spinner
00677                                                                 .setOnItemSelectedListener(new OnItemSelectedListener() {
00678                                                                         public void onItemSelected(
00679                                                                                         AdapterView parent, View viw,
00680                                                                                         int arg2, long arg3) {
00681                                                                                 if (isAdapterSet_tasks) {
00682                                                                                         Spinner spinner = (Spinner) parent;
00683                                                                                         String item = (String) spinner
00684                                                                                                         .getSelectedItem();
00685                                                                                         jskAndroidGuiNode
00686                                                                                                         .tasksSpinnerTask(item);
00687                                                                                         Toast.makeText(JskAndroidGui.this,
00688                                                                                                         "tasks: StartDemo " + item,
00689                                                                                                         Toast.LENGTH_SHORT).show();
00690                                                                                         Log.i("JskAndroidGui:ItemSeleted",
00691                                                                                                         "Sending StartDemo messgae");
00692 
00693                                                                                         TextView tv = (TextView) findViewById(R.id.textarea_test);
00694                                                                                         try {
00695                                                                                                 tv.setText("param update searching");
00696                                                                                                 tv.setTextSize(14);
00697                                                                                                 tv.setTextColor(Color.WHITE);
00698                                                                                                 Log.i("JskAndroidGui:GetTasksParam",
00699                                                                                                                 "setting text");
00700                                                                                         } catch (Exception ex) {
00701                                                                                                 Log.i("JskAndroidGui:GetTasksParam",
00702                                                                                                                 "set text error");
00703                                                                                         }
00704                                                                                 } else {
00705                                                                                         isAdapterSet_tasks = true;
00706                                                                                         Log.i("JskAndroidGui:",
00707                                                                                                         "tasks adapter not set");
00708                                                                                 }
00709                                                                         }
00710 
00711                                                                         public void onNothingSelected(
00712                                                                                         AdapterView parent) {
00713                                                                                 Toast.makeText(JskAndroidGui.this,
00714                                                                                                 "Updating Param",
00715                                                                                                 Toast.LENGTH_SHORT).show();
00716                                                                                 TextView tv = (TextView) findViewById(R.id.textarea_test);
00717                                                                                 try {
00718                                                                                         tv.setText("param update searching");
00719                                                                                         tv.setTextSize(14);
00720                                                                                         tv.setTextColor(Color.WHITE);
00721                                                                                         Log.i("JskAndroidGui:GetTasksParam",
00722                                                                                                         "setting text");
00723                                                                                 } catch (Exception ex) {
00724                                                                                         Log.i("JskAndroidGui:GetTasksParam",
00725                                                                                                         "set text error");
00726                                                                                 }
00727                                                                         }
00728                                                                 });
00729 
00730                                                 mHandler.post(new Runnable() {
00731                                                         public void run() {
00732                                                                 TextView tv = (TextView) findViewById(R.id.textarea_test);
00733                                                                 if (isParamSet) {
00734                                                                         try {
00735                                                                                 tv.setText("Updated");
00736                                                                                 tv.setTextSize(50);
00737                                                                                 tv.setTextColor(Color.RED);
00738                                                                                 Log.i("JskAndroidGui:GetTasksParam",
00739                                                                                                 "setting text");
00740                                                                         } catch (Exception ex) {
00741                                                                                 Log.i("JskAndroidGui:GetTasksParam",
00742                                                                                                 "set text error");
00743                                                                         }
00744                                                                 } else {
00745                                                                         isParamSet = true;
00746                                                                         Log.i("JskAndroidGui:", "param not set");
00747                                                                 }
00748 
00749                                                                 Log.i("JskAndroidGui:debug", "spinner updating");
00750                                                                 isAdapterSet_spots = false;
00751                                                                 isAdapterSet_tasks = false;
00752                                                                 isAdapterSet_camera = false;
00753                                                                 isAdapterSet_points = false;
00754                                                                 GetParamAndSetSpinner();
00755 
00756                                                         }
00757                                                 });
00758 
00759                                                 Log.i("JskAndroidGui:GetTasksParam", "updated");
00760                                         }
00761                                 });// end of parameter listener
00762                 params.addParameterListener("/Tablet/Found", new ParameterListener() {
00763                         @Override
00764                         public void onNewValue(Object value) {
00765                                 String defaultTask_ns = "/Tablet";
00766                                 GraphName guser = GraphName.of(defaultTask_ns);
00767                                 NameResolver resolver_user = public_node.getResolver()
00768                                                 .newChild(guser);
00769                                 try {
00770                                         found_task = params.getList(resolver_user.resolve("Found"))
00771                                                         .toArray();
00772                                 } catch (Exception ex) {
00773                                         Log.i("JskAndroidGui:GetTasksParam", (String) found_task[0]
00774                                                         + " set text error");
00775                                 }
00776                                 mHandler.post(new Runnable() {
00777                                         public void run() {
00778                                                 TextView tv = (TextView) findViewById(R.id.textarea_test);
00779                                                 if (isParamSet) {
00780                                                         try {
00781                                                                 tv.setText((String) found_task[0]);
00782                                                                 tv.setTextSize(40);
00783                                                                 tv.setTextColor(Color.GREEN);
00784                                                                 Log.i("JskAndroidGui:GetTasksParam",
00785                                                                                 "setting text");
00786                                                         } catch (Exception ex) {
00787                                                                 Log.i("JskAndroidGui:GetTasksParam",
00788                                                                                 "set text error");
00789                                                         }
00790                                                 } else {
00791                                                         isParamSet = true;
00792                                                         Log.i("JskAndroidGui:", "param not set");
00793                                                 }
00794                                                 Log.i("JskAndroidGui:debug", "spinner updating");
00795                                                 isAdapterSet_spots = false;
00796                                                 isAdapterSet_tasks = false;
00797                                                 isAdapterSet_camera = false;
00798                                                 isAdapterSet_points = false;
00799                                                 GetParamAndSetSpinner();
00800 
00801                                         }
00802                                 });
00803                         }
00804                 });// end of parameter listener
00805 
00806                 params.addParameterListener("/Tablet/query_input",
00807                                 new ParameterListener() {
00808 
00809                                         @Override
00810                                         public void onNewValue(Object value) {
00811                                                 String defaultTask_ns = "/Tablet";
00812                                                 GraphName guser = GraphName.of(defaultTask_ns);
00813                                                 NameResolver resolver_user = public_node.getResolver()
00814                                                                 .newChild(guser);
00815                                                 try {
00816                                                         query_input = params.getList(
00817                                                                         resolver_user.resolve("query_input"))
00818                                                                         .toArray();
00819                                                 } catch (Exception ex) {
00820                                                         Log.i("JskAndroidGui:GetTasksParam", query_input[0]
00821                                                                         + " set text error");
00822                                                 }
00823                                                 LayoutInflater inflater = LayoutInflater
00824                                                                 .from(JskAndroidGui.this);
00825                                                 final View view = inflater.inflate(R.layout.dialog,
00826                                                                 null);
00827 
00828                                                 final EditText editText = (EditText) view
00829                                                                 .findViewById(R.id.editText1);
00830                                                 mHandler.post(new Runnable() {
00831                                                         public void run() {
00832                                                                 Log.i("JskAndroidGui:debug", "dialog handler");
00833                                                                 new AlertDialog.Builder(JskAndroidGui.this)
00834                                                                                 .setTitle(
00835                                                                                                 "teach name: " + query_input[0])
00836                                                                                 .setView(view)
00837                                                                                 .setPositiveButton(
00838                                                                                                 "Save",
00839                                                                                                 new DialogInterface.OnClickListener() {
00840 
00841                                                                                                         @Override
00842                                                                                                         public void onClick(
00843                                                                                                                         DialogInterface dialog,
00844                                                                                                                         int which) {
00845                                                                                                                 jskAndroidGuiNode
00846                                                                                                                                 .selectTask(editText
00847                                                                                                                                                 .getText()
00848                                                                                                                                                 .toString());
00849                                                                                                                 Toast.makeText(
00850                                                                                                                                 JskAndroidGui.this,
00851                                                                                                                                 "tasks: Send dialog msg",
00852                                                                                                                                 Toast.LENGTH_SHORT)
00853                                                                                                                                 .show();
00854                                                                                                                 Log.i("JskAndroidGui:debug",
00855                                                                                                                                 "dialog clicked");
00856                                                                                                         }
00857                                                                                                 }).show();
00858                                                         }
00859                                                 });
00860                                         }
00861                                 });// end of parameter listener
00862 
00863                 Log.i("JskAndroidGui:debug", "before first spinner update");
00864 
00865                 mHandler.post(new Runnable() {
00866                         public void run() {
00867                                 Log.i("JskAndroidGui:debug", "spinner updating");
00868                                 GetParamAndSetSpinner();
00869                                 isParamSet = true;
00870                         }
00871                 });
00872         }
00873 
00874         @Override
00875         public void onCreateContextMenu(ContextMenu menu, View v,
00876                         ContextMenuInfo menuInfo) {
00877                 super.onCreateContextMenu(menu, v, menuInfo);
00878 
00879                 Log.i("JskAndroidGui:debug", "onCreateContextMenu");
00880                 menu.setHeaderTitle("Long touch detected");
00881                 // Menu.add(int groupId, int itemId, int order, CharSequence title)
00882                 menu.add(0, CONTEXT_MENU1_ID, 0, "PUSHONCE");
00883                 menu.add(0, CONTEXT_MENU2_ID, 0, "PICKONCE");
00884                 menu.add(0, CONTEXT_MENU3_ID, 0, "PLACEONCE");
00885                 menu.add(0, CONTEXT_MENU4_ID, 0, "GetTemplate");
00886         }
00887 
00888         @Override
00889         public boolean onCreateOptionsMenu(Menu menu) {
00890                 Log.i("JskAndroidGui:debug", "onCreateOptionsMenu");
00891                 MenuInflater inflater = getMenuInflater();
00892                 inflater.inflate(R.menu.jsk_android_gui, menu);
00893                 isAdapterSet_spots = false;
00894                 isAdapterSet_tasks = false;
00895                 isAdapterSet_camera = false;
00896                 isAdapterSet_points = false;
00897                 GetParamAndSetSpinner();
00898                 return true;
00899         }
00900 
00901         @Override
00902         public boolean onContextItemSelected(MenuItem item) {
00903                 switch (item.getItemId()) {
00904                 case CONTEXT_MENU1_ID:
00905                         Log.i("JskAndroidGui:ItemSeleted", "Publish PushOnce");
00906                         cameraView.PublishPushOnce();
00907                         return true;
00908                 case CONTEXT_MENU2_ID:
00909                         Log.i("JskAndroidGui:ItemSeleted", "Publish PickOnce");
00910                         cameraView.PublishPickOnce();
00911                         return true;
00912                 case CONTEXT_MENU3_ID:
00913                         Log.i("JskAndroidGui:ItemSeleted", "Publish PlaceOnce");
00914                         cameraView.PublishPlaceOnce();
00915                         return true;
00916                 case CONTEXT_MENU4_ID:
00917                         Log.i("JskAndroidGui:ItemSeleted", "Publish GetTemplate");
00918                         cameraView.PublishGetTemplateOnce();
00919                         return true;
00920                 default:
00921                         return super.onContextItemSelected(item);
00922                 }
00923         }
00924 
00925         @Override
00926         public boolean onOptionsItemSelected(MenuItem item) {
00927                 switch (item.getItemId()) {
00928                 case R.id.getspot:
00929                         jskAndroidGuiNode.getSpot();
00930                         Log.i("JskAndroidGui:ItemSeleted", "Sending GetSpot messgae");
00931                         return true;
00932                 case R.id.gettemplate:
00933                         cameraView.SetGetTemplate();
00934                         return true;
00935                 case R.id.zoomcamera:
00936                         cameraView.SetZoomCamera();
00937                         return true;
00938                 case R.id.endzoomcamera:
00939                         cameraView.unSetZoomCamera();
00940                         return true;
00941                 case R.id.pickonce:
00942                         Log.i("JskAndroidGui:ItemSeleted", "Set PickOnce");
00943                         cameraView.SetPickOnce();
00944                         return true;
00945                         /*
00946                          * case R.id.opendoor: cameraView.unSetMovingFingerInfo();
00947                          * cameraView.SendOpenDoorMsg(); Log.i("JskAndroidGui:ItemSeleted",
00948                          * "Send OpenDoorMsg"); return true;
00949                          */
00950                 case R.id.pushonce:
00951                         Log.i("JskAndroidGui:ItemSeleted", "Set PushOnce");
00952                         cameraView.SetPushOnce();
00953                         return true;
00954                 case R.id.placeonce:
00955                         Log.i("JskAndroidGui:ItemSeleted", "Set PlaceOnce");
00956                         cameraView.SetPlaceOnce();//
00957                         return true;
00958                         /*
00959                          * case R.id.closedoor: Log.i("JskAndroidGui:ItemSeleted",
00960                          * "Send CloseDoorMsg"); cameraView.SendCloseDoorMsg();// return
00961                          * true;
00962                          */
00963                 case R.id.passtohumanonce:
00964                         Log.i("JskAndroidGui:ItemSeleted", "Set PassToHuman");
00965                         cameraView.SetPassToHumanOnce();//
00966                         return true;
00967 
00968                 case R.id.tuckarmpose:
00969                         Log.i("JskAndroidGui:ItemSeleted", "TuckArmPose");
00970                         cameraView.SendTuckArmPoseMsg();//
00971                         return true;
00972                 case R.id.torsoup: // DECATED
00973                         cameraView.SendTorsoUpMsg();//
00974                         Log.i("JskAndroidGui:ItemSeleted", "Send TorsoUpMsg");
00975                         return true;
00976                 case R.id.torsodown: // DEPRECATED
00977                         cameraView.SendTorsoDownMsg();//
00978                         Log.i("JskAndroidGui:ItemSeleted", "Send TorsoDownMsg");
00979                         return true;
00980                 case R.id.opengripper: // DEPRECATED
00981                         cameraView.SendOpenGripperMsg();
00982                         Log.i("JskAndroidGui:ItemSeleted", "Send OpenGripperMsg");
00983                         return true;
00984                 case R.id.closegripper: // DEPRECATED
00985                         cameraView.SendCloseGripperMsg();
00986                         Log.i("JskAndroidGui:ItemSeleted", "Send CloseGripperMsg");
00987                         return true;
00988                 case R.id.changetouchmode:
00989                         cameraView.ChangeTouchMode();
00990                         Log.i("JskAndroidGui:ItemSeleted", "Change TouchMode");
00991                         return true;
00992                 case R.id.changelongtouch:
00993                         Log.i("JskAndroidGui:ItemSeleted", "Change LongTouch");
00994                         if (LongTouchFlag) {
00995                                 // ImageView ivInContext = (ImageView) findViewById(R.id.image);
00996                                 unregisterForContextMenu(boundingBoxView);
00997                                 LongTouchFlag = false;
00998                         } else {
00999                                 // ImageView ivInContext = (ImageView) findViewById(R.id.image);
01000                                 // ivInContext.setFocusable(true);
01001                                 // ivInContext.setClickable(true);
01002                                 registerForContextMenu(boundingBoxView);
01003                                 LongTouchFlag = true;
01004                         }
01005                         return true;
01006                 case R.id.resetall:
01007                         isAdapterSet_spots = false;
01008                         isAdapterSet_tasks = false;
01009                         GetParamAndSetSpinner();
01010                         cameraView.SetResetAll();
01011                         isDrawLine = false;
01012                         ImageView ivInContext = (ImageView) findViewById(R.id.image);
01013                         ivInContext.setFocusable(true);
01014                         ivInContext.setClickable(true);
01015                         registerForContextMenu(ivInContext);
01016                         LongTouchFlag = true;
01017                         Log.i("JskAndroidGui:ItemSeleted", "Set ResetAll");
01018                         return true;
01019                 case R.id.stopjoint:
01020                         jskAndroidGuiNode.stopJoint();
01021                         Toast.makeText(JskAndroidGui.this, "tasks: EmergencyStopJoint",
01022                                         Toast.LENGTH_SHORT).show();
01023                         Log.i("JskAndroidGui:ItemSeleted", "Sending EmergencyStopJoint");
01024                         return true;
01025                 case R.id.stopnavigation:
01026                         jskAndroidGuiNode.stopNavigation();
01027                         Toast.makeText(JskAndroidGui.this,
01028                                         "tasks: EmergencyStopNavigation", Toast.LENGTH_SHORT)
01029                                         .show();
01030                         Log.i("JskAndroidGui:ItemSeleted",
01031                                         "Sending EmergencyStopNavigation");
01032                         return true;
01033                 case R.id.resetcollider:
01034                         cameraView.SetResetCollider();
01035                         return true;
01036 
01037                 case R.id.switchjoy:
01038                         jskAndroidGuiNode.switchJoy();
01039                         Toast.makeText(JskAndroidGui.this, "tasks: Switchjoy",
01040                                         Toast.LENGTH_SHORT).show();
01041                         Log.i("JskAndroidGui:ItemSelected", "Sending switchjoy");
01042                         return true;
01043                 case R.id.change_layout:
01044                         viewFlipper.showNext();
01045                         return true;
01046                 case R.id.change_webview:
01047                         webViewFlipper.showNext();
01048                         return true;
01049                 default:
01050                         return super.onOptionsItemSelected(item);
01051                 }
01052         }
01053 
01054         protected void GetParamAndSetSpinner() {
01055                 // tasks_list.clear(); spots_list.clear();
01056                 // image_list.clear(); camera_info_list.clear(); points_list.clear();
01057                 try {
01058                         ArrayAdapter<String> adapter_tasks = new ArrayAdapter<String>(this,
01059                                         R.layout.list);
01060                         adapter_tasks
01061                                         .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
01062                         for (int i = 0; i <= tasks_list.size() - 1; i++) {
01063                                 adapter_tasks.add(tasks_list.get(i));
01064                         }
01065                         tasks_spinner.setAdapter(adapter_tasks);
01066                         tasks_spinner.setPromptId(R.string.SpinnerPrompt_tasks);
01067 
01068                         ArrayAdapter<String> adapter_spots = new ArrayAdapter<String>(this,
01069                                         R.layout.list);
01070                         adapter_spots
01071                                         .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
01072                         for (int i = 0; i <= spots_list.size() - 1; i++) {
01073                                 adapter_spots.add(spots_list.get(i));
01074                         }
01075                         spots_spinner.setAdapter(adapter_spots);
01076                         spots_spinner.setPromptId(R.string.SpinnerPrompt_spots);
01077 
01078                         ArrayAdapter<String> adapter_image = new ArrayAdapter<String>(this,
01079                                         R.layout.list);
01080                         adapter_image
01081                                         .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
01082                         for (int i = 0; i <= image_list.size() - 1; i++) {
01083                                 adapter_image.add(image_list.get(i));
01084                         }
01085                         image_spinner.setAdapter(adapter_image);
01086 
01087                         ArrayAdapter<String> adapter_points = new ArrayAdapter<String>(
01088                                         this, R.layout.list);
01089                         adapter_points
01090                                         .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
01091                         for (int i = 0; i <= points_list.size() - 1; i++) {
01092                                 adapter_points.add(points_list.get(i));
01093                         }
01094                         points_spinner.setAdapter(adapter_points);
01095 
01096                 } catch (Exception ex) {
01097                         Log.e("JskAndroidGui", "param adapter error: " + ex.toString());
01098                         Toast.makeText(JskAndroidGui.this,
01099                                         "adapter error: " + ex.getMessage(), Toast.LENGTH_SHORT)
01100                                         .show();
01101                 }
01102         }
01103 }


jsk_android_gui
Author(s): Kazuto Murase
autogenerated on Thu Jun 6 2019 18:03:48