当前位置: 首页>>代码示例>>Java>>正文


Java Intent.getStringArrayExtra方法代码示例

本文整理汇总了Java中android.content.Intent.getStringArrayExtra方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getStringArrayExtra方法的具体用法?Java Intent.getStringArrayExtra怎么用?Java Intent.getStringArrayExtra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.Intent的用法示例。


在下文中一共展示了Intent.getStringArrayExtra方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPlayerData

import android.content.Intent; //导入方法依赖的package包/类
private void getPlayerData() {
    Intent intent = getIntent();
    if (intent != null) {
        Player = intent.getIntArrayExtra(Config.INTENT_EXTRA_PLAYER);
        PlayerWords = intent.getStringArrayExtra(Config.INTENT_EXTRA_PLAYER_WORDS);
        PlayerName = intent.getStringArrayExtra(Config.INTENT_EXTRA_PLAYER_NAME);
        if (Player == null || PlayerWords == null) {
            Toast.makeText(this, R.string.data_error, Toast.LENGTH_SHORT).show();
            finish();
        } else {
            playerNumber = Player.length;
            if (PlayerName == null) {
                PlayerName = new String[playerNumber];
            } else {
                hasPlayerName = true;
                changePlayerName = true;
            }
        }
    } else {
        Toast.makeText(this, R.string.data_error, Toast.LENGTH_SHORT).show();
        finish();
    }
}
 
开发者ID:XFY9326,项目名称:CatchSpy,代码行数:24,代码来源:ShowActivity.java

示例2: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    _logger.Debug("_updateReceiver onReceive");
    String[] socketStringArray = intent.getStringArrayExtra(Bundles.SOCKET_LIST);

    if (socketStringArray != null) {
        SerializableList<WirelessSocketDto> socketList = JsonDataToSocketConverter.GetList(socketStringArray);
        if (socketList != null) {
            _broadcastController.SendSerializableBroadcast(
                    Broadcasts.SOCKET_LIST,
                    Bundles.SOCKET_LIST,
                    socketList);
        } else {
            Toasty.error(_context, "Failed to convert socket list from string array!", Toast.LENGTH_LONG).show();
        }
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-MediaServer,代码行数:18,代码来源:SocketListUpdater.java

示例3: combineArrayExtra

import android.content.Intent; //导入方法依赖的package包/类
private void combineArrayExtra(String extra, String[] add) {
    int oldLength;
    Intent intent = getIntent();
    String[] old = intent.getStringArrayExtra(extra);
    if (old != null) {
        oldLength = old.length;
    } else {
        oldLength = 0;
    }
    String[] result = new String[(add.length + oldLength)];
    if (old != null) {
        System.arraycopy(old, 0, result, 0, oldLength);
    }
    System.arraycopy(add, 0, result, oldLength, add.length);
    intent.putExtra(extra, result);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:17,代码来源:ShareCompat.java

示例4: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    if (action.equals(WifiPriorityActivity.ACTION_WIFI_TRUSTED_CHANGED)) {
        if (intent.hasExtra(WifiPriorityActivity.EXTRA_WIFI_TRUSTED)) {
            String[] values = intent.getStringArrayExtra(WifiPriorityActivity.EXTRA_WIFI_TRUSTED);
            if (mWifiTrusted.size() > 0 && values.length == 0) {
                mForceRefreshAgentList = true;
            }
            mWifiTrusted = new HashSet<String>(Arrays.asList(values));
            if (DEBUG) log("ACTION_WIFI_TRUSTED_CHANGED: mWifiTrusted=" + mWifiTrusted +
                    "; mForceRefreshAgentList=" + mForceRefreshAgentList);
            updateTrustAll();
        }
    } else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
        if (intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, -1) ==
                ConnectivityManager.TYPE_WIFI) {
            onWifiConnectivityChanged();
        }
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:22,代码来源:ModTrustManager.java

示例5: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
  String action = intent.getAction();
  switch (action) {
    case WXModule.ACTION_ACTIVITY_RESULT:
      int requestCode = intent.getIntExtra(WXModule.REQUEST_CODE, -1);
      int resultCode = intent.getIntExtra(WXModule.RESULT_CODE, Activity.RESULT_OK);
      mWXCompatModule.onActivityResult(requestCode, resultCode, intent);
      break;
    case WXModule.ACTION_REQUEST_PERMISSIONS_RESULT:
      requestCode = intent.getIntExtra(WXModule.REQUEST_CODE, -1);
      String[] permissions = intent.getStringArrayExtra(WXModule.PERMISSIONS);
      int[] grantResults = intent.getIntArrayExtra(WXModule.GRANT_RESULTS);
      mWXCompatModule.onRequestPermissionsResult(requestCode, permissions, grantResults);
      break;
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:18,代码来源:WXCompatModule.java

示例6: dispatchRequestPermissionsResultToFragment

import android.content.Intent; //导入方法依赖的package包/类
private void dispatchRequestPermissionsResultToFragment(int requestCode, Intent data,
                                                        Fragment fragment) {
    // If the package installer crashed we may have not data - best effort.
    String[] permissions = (data != null) ? data.getStringArrayExtra(
            PackageManager.EXTRA_REQUEST_PERMISSIONS_NAMES) : new String[0];
    final int[] grantResults = (data != null) ? data.getIntArrayExtra(
            PackageManager.EXTRA_REQUEST_PERMISSIONS_RESULTS) : new int[0];
    fragment.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:10,代码来源:a.java

示例7: getValue

import android.content.Intent; //导入方法依赖的package包/类
/**
 * Get a value from an intent by a giving class and key.
 * @param intent
 *  the source intent
 * @param key
 *  the key of the value
 * @param clz
 *  the class of the value
 * @return
 *  the value from the source intent
 */
public static Object getValue(Intent intent, String key, Class<?> clz) {
    Object value = null;
    // Cause it is not an easy job to handle inheritance in apt, it is a lot easier to put the code in the Android environment.
    if(Bundle.class.isAssignableFrom(clz)) {
        // bundle implements parcelable, so it should place before parcelable.
        value = intent.getBundleExtra(key);
    } else if(Parcelable.class.isAssignableFrom(clz)) {
        value = intent.getParcelableExtra(key);
    } else if(Parcelable[].class.isAssignableFrom(clz)) {
        value = intent.getParcelableArrayExtra(key);
    } else if(boolean[].class.isAssignableFrom(clz)) {
        value = intent.getBooleanArrayExtra(key);
    } else if(byte[].class.isAssignableFrom(clz)) {
        value = intent.getByteArrayExtra(key);
    } else if(short[].class.isAssignableFrom(clz)) {
        value = intent.getShortArrayExtra(key);
    } else if(char[].class.isAssignableFrom(clz)) {
        value = intent.getCharArrayExtra(key);
    } else if(int[].class.isAssignableFrom(clz)) {
        value = intent.getIntArrayExtra(key);
    } else if(long[].class.isAssignableFrom(clz)) {
        value = intent.getLongArrayExtra(key);
    } else if(float[].class.isAssignableFrom(clz)) {
        value = intent.getFloatArrayExtra(key);
    } else if(double[].class.isAssignableFrom(clz)) {
        value = intent.getDoubleArrayExtra(key);
    } else if(String[].class.isAssignableFrom(clz)) {
        value = intent.getStringArrayExtra(key);
    } else if(CharSequence[].class.isAssignableFrom(clz)) {
        value = intent.getCharSequenceArrayExtra(key);
    } else if(Serializable.class.isAssignableFrom(clz)) {
        // some of the above are assignable for serializable, so serializable should be in the last place.
        value = intent.getSerializableExtra(key);
    } else {
        throw new RuntimeException(clz + " is not compatible with intent (key=" + key + ")");
    }

    return value;
}
 
开发者ID:foreveruseful,项目名称:smartkey,代码行数:51,代码来源:IntentValueGetter.java

示例8: init

import android.content.Intent; //导入方法依赖的package包/类
private void init() {

		llTopMenuWindowBg = findViewById(R.id.llTopMenuWindowBg);
		llTopMenuWindowBg.setOnClickListener(this);

		Intent intent = getIntent();

		int[] intentCodes = intent.getIntArrayExtra(INTENT_INTENTCODES);
		if (intentCodes == null || intentCodes.length <= 0) {
			intentCodeList = intent.getIntegerArrayListExtra(INTENT_INTENTCODES);
		} else {
			intentCodeList = new ArrayList<Integer>();
			for (int code : intentCodes) {
				intentCodeList.add(code);
			}
		}

		String[] menuItems = intent.getStringArrayExtra(INTENT_NAMES);
		if (menuItems == null || menuItems.length <= 0) {
			nameList = intent.getStringArrayListExtra(INTENT_NAMES);
		} else {
			nameList = new ArrayList<String>(Arrays.asList(menuItems));
		}

		if (nameList == null || nameList.size() <= 0) {
			Log.e(TAG, "init   nameList == null || nameList.size() <= 0 >> finish();return;");
			finish();
			return;
		}

		adapter = new ArrayAdapter<String>(this, R.layout.top_menu_list_item, R.id.tvTopMenuListItem, nameList);

		lvTopMenu = (ListView) findViewById(R.id.lvTopMenuWindowMenu);
		lvTopMenu.setAdapter(adapter);
		lvTopMenu.setOnItemClickListener(this);
	}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:TopMenuWindow.java

示例9: encodeFromTextExtras

import android.content.Intent; //导入方法依赖的package包/类
private void encodeFromTextExtras(Intent intent) throws WriterException {
  // Notice: Google Maps shares both URL and details in one text, bummer!
  String theContents = ContactEncoder.trim(intent.getStringExtra(Intent.EXTRA_TEXT));
  if (theContents == null) {
    theContents = ContactEncoder.trim(intent.getStringExtra("android.intent.extra.HTML_TEXT"));
    // Intent.EXTRA_HTML_TEXT
    if (theContents == null) {
      theContents = ContactEncoder.trim(intent.getStringExtra(Intent.EXTRA_SUBJECT));
      if (theContents == null) {
        String[] emails = intent.getStringArrayExtra(Intent.EXTRA_EMAIL);
        if (emails != null) {
          theContents = ContactEncoder.trim(emails[0]);
        } else {
          theContents = "?";
        }
      }
    }
  }

  // Trim text to avoid URL breaking.
  if (theContents == null || theContents.isEmpty()) {
    throw new WriterException("Empty EXTRA_TEXT");
  }
  contents = theContents;
  // We only do QR code.
  format = BarcodeFormat.QR_CODE;
  if (intent.hasExtra(Intent.EXTRA_SUBJECT)) {
    displayContents = intent.getStringExtra(Intent.EXTRA_SUBJECT);
  } else if (intent.hasExtra(Intent.EXTRA_TITLE)) {
    displayContents = intent.getStringExtra(Intent.EXTRA_TITLE);
  } else {
    displayContents = contents;
  }
  title = activity.getString(R.string.contents_text);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:36,代码来源:QRCodeEncoder.java

示例10: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == RESULT_OK) {
        // 获取返回的准备邀请的群成员信息
        final String[] memberses = data.getStringArrayExtra("members");

        Model.getInstance().getGlobalThreadPool().execute(new Runnable() {
            @Override
            public void run() {
                try {
                    // 去环信服务器,发送邀请信息
                    EMClient.getInstance().groupManager().addUsersToGroup(mGroup.getGroupId(), memberses);

                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(GroupDetailActivity.this, "发送邀请成功", Toast.LENGTH_SHORT).show();
                        }
                    });
                } catch (final HyphenateException e) {
                    e.printStackTrace();

                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(GroupDetailActivity.this, "发送邀请失败" + e.toString(), Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            }
        });
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:36,代码来源:GroupDetailActivity.java

示例11: createConfig

import android.content.Intent; //导入方法依赖的package包/类
private static VpnConfiguration createConfig(Intent intent) {
    String[] dnsServers = intent.getStringArrayExtra(EXTRA_DNS_SERVERS);
    if (dnsServers == null) {
        dnsServers = new String[0];
    }
    return new VpnConfiguration(Net.toInetAddresses(dnsServers));
}
 
开发者ID:Genymobile,项目名称:gnirehtet,代码行数:8,代码来源:GnirehtetControlReceiver.java

示例12: dispatchRequestPermissionsResult

import android.content.Intent; //导入方法依赖的package包/类
private void dispatchRequestPermissionsResult(int requestCode, Intent data) {
    mHasCurrentPermissionsRequest = false;
    // If the package installer crashed we may have not data - best effort.
    String[] permissions = (data != null) ? data.getStringArrayExtra(
            PackageManager.EXTRA_REQUEST_PERMISSIONS_NAMES) : new String[0];
    final int[] grantResults = (data != null) ? data.getIntArrayExtra(
            PackageManager.EXTRA_REQUEST_PERMISSIONS_RESULTS) : new int[0];
    onRequestPermissionsResult(requestCode, permissions, grantResults);
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:10,代码来源:a.java

示例13: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    _logger.Debug("_updateReceiver onReceive");
    String[] menuStringArray = intent.getStringArrayExtra(Bundles.MENU);

    if (menuStringArray != null) {
        SerializableList<MenuDto> menu = JsonDataToMenuConverter.GetList(menuStringArray);
        if (menu != null) {
            _broadcastController.SendSerializableBroadcast(Broadcasts.MENU, Bundles.MENU, menu);
        } else {
            Toasty.error(_context, "Failed to convert menu from string array!", Toast.LENGTH_LONG).show();
        }
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-MediaServer,代码行数:15,代码来源:MenuListUpdater.java

示例14: handleIntent

import android.content.Intent; //导入方法依赖的package包/类
private void handleIntent(Intent intent) {
    String[] permissions = intent.getStringArrayExtra(PERMISSION_STRINGS);
    ActivityCompat.requestPermissions(this, permissions, AppPermissionHelper.REQUEST_CODE);
}
 
开发者ID:jjuiddong,项目名称:Android-Practice,代码行数:5,代码来源:AppPermissionHandlerActivity.java

示例15: handleIntent

import android.content.Intent; //导入方法依赖的package包/类
private void handleIntent(final Intent intent) {
  final String[] permissions = intent.getStringArrayExtra(ARG_PERMISSIONS);
  shouldShowRequestPermissionRationale = rationales(permissions);

  requestPermissions(permissions, REQUEST_CODE);
}
 
开发者ID:vanniktech,项目名称:RxPermission,代码行数:7,代码来源:ShadowActivity.java


注:本文中的android.content.Intent.getStringArrayExtra方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。