コード例 #1
0
 public static SpinnerFragment newInstance(
     String ip, TcpConnectionManager.ReceiverType type, int menu) {
   SpinnerFragment fragment = new SpinnerFragment();
   Bundle args = new Bundle();
   args.putString(ARG_IP, ip);
   args.putString(ARG_TYPE, type.toString());
   args.putInt(ARG_MENU, menu);
   fragment.setArguments(args);
   return fragment;
 }
コード例 #2
0
 public static SpinnerFragment recoverFromRecreationKey(String key) {
   try {
     String[] args = Util.split(key, SEP, 0);
     String ip = args[2];
     TcpConnectionManager.ReceiverType type = TcpConnectionManager.ReceiverType.valueOf(args[3]);
     int menu = Integer.parseInt(args[4]);
     SpinnerFragment fragment = newInstance(ip, type, menu);
     fragment.recoverPos(args[1]);
     return fragment;
   } catch (Exception e) {
     Log.e(LOG_TAG, "recoverFromRecreationKey: illegal key: " + key);
     Log.e(LOG_TAG, "Got exception: " + e);
     return null;
   }
 }