Code example for WifiP2pConfig

0
			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() {
 
					@Override 
					public void onSuccess() { 
						(Toast.makeText(context, "p2p connect success",
								Toast.LENGTH_SHORT)).show();
					} 
 
					@Override 
					public void onFailure(int reason) {
						(Toast.makeText(context,
								"p2p connect failed:" + reason,
Stop searching for code, let great code find you!  Add Codota to your java IDE