Code example for WifiP2pConfig

			public void onItemClick(AdapterView<?> adapterView, View arg1,
					int pos, long arg3) {
				String s = (String) listView.getItemAtPosition(pos);
				String deviceDetails = (s.replace("Connect to ", "")).trim();
				String[] devDetails = deviceDetails.split(",");
				WifiP2pConfig config = new WifiP2pConfig();
				config.deviceAddress = devDetails[1];
				config.wps.setup = WpsInfo.PBC;
				manager.connect(channel, config, new ActionListener() {
					public void onSuccess() { 
						(Toast.makeText(context, "p2p connect success",
					public void onFailure(int reason) {
								"p2p connect failed:" + reason,
Stop searching for code, let great code find you!  Add Codota to your java IDE