I defined a dialog as follows:
Public Zero Display Available Devices ( Vector & lt; UserDevice & gt; AvailableDevices) {connector.setDevicesFound (true); UserDevice [] Device = New UserDevice [availableDevices.size ()]; (Int i = 0; I & lt; Available Device Size (); i ++) {Device [i] = Available Devices Emantement (i); Arrays.sort (Tools); Of vector & lt; UserDevice & gt; Sorted = new vector & lt; UserDevice & gt; (); For (int j = 0; j and lt; devices; tall; j ++) {sorted.add (device [j]); } AllAvailableDevices = Sorted; Connector.stopNeighbourDiscovery (); If (dialog! = Null) {dialog.dismiss (); CheckedUser = null; } Dialog = new dialog (this); Dialog.setContentView (R.layout.available_users); Dialog.setTitle ("Available Devices"); Relative layout root layer = (relative layout) dialog.findViewById (R.id.dialogRoot); RootLayer.setBackgroundColor (Color.WHITE); ListView userTable = (ListView) dialog.findViewById (R.id.userList); Adapter = new UserAdapter (); UserTable.setAdapter (adapter); UserTable.setOnItemClickListener (New UserListener ()); Demo Metrics DM = New Performance Metrics (); . GetWindowManager () getDefaultDisplay () getMetrics (DM) Connect = (button) dialog.findViewById (R.id.userList_connect); Connect.setMinWidth (dm.widthPixels / 2); Click on Connect.setOnClickListener (New OnClickListener) {@Override Public Zero (see V) {if (check user! = Tap) {dialog.dismiss (); Connector.connectToDevice (checkedUser);}}}); Button start = (button) dialog.findViewById (R.id.userList_start); Start.setMinWidth (dm.widthPixels / 2); Click Start.setOnClickListener (New OnClickListener) {@Override Public Zero (see V) {dialog.dismiss (); StartProfileView ();}}); Button Refresh = (Button) dialog.findViewById (R.id.userList_refresh); Refresh Setin Wide (DM with Pixels / 2); Refresh.setOnClickListener (New OnClickListener) Click on {@Override Public Zero (Click V) {dialog.dismiss (); getGameBaseLayer (). Reset disabled UserDisable (); connector.reface ();}}); Button cancel = (button) dialog.findViewById (R.id.userList_cancel); Cancel.SsetMinWidth (dm.widthPixels / 2); Cancel.SetOnClicklist (New OnListList () {@Override Click Public Zero (see V) {Finish ();}}); Dialog.show (); If (check user == blank) {connect.setEnabled (false); }} If this dialog is displayed and the user presses the back button, then the dialog is dismissed. However I want to do some more processing, but how can I find out if the user presses the back button?
I am quite positive which can help a lot. As far as I understand, by pressing 'back', the dialogue is canceled (eg by pressing 'Cancer'), they show how to apply an audience to make a dialog unspecified and to catch 'cancel' incidents.
Comments
Post a Comment