Guest User

Untitled

a guest
Sep 22nd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. package com.august.customtisensortagclient;
  2.  
  3. import android.app.AlertDialog;
  4. import android.app.Dialog;
  5. import android.content.Context;
  6. import android.content.DialogInterface;
  7. import android.content.Intent;
  8. import android.os.Bundle;
  9. import android.support.v4.app.DialogFragment;
  10.  
  11. import java.util.ArrayList;
  12.  
  13. public class GetInfoDialog extends DialogFragment {
  14.  
  15.  
  16. @Override
  17. public Dialog onCreateDialog(Bundle savedInstanceState) {
  18.  
  19.  
  20.  
  21.  
  22.  
  23. final String thisWhichGetInfoDialog = ((MainActivity)getActivity()).getWhichGetInfoDialog();
  24. final ArrayList<String> thisScannedDevicesArrayList =
  25. ((MainActivity)getActivity()).getScannedDevicesArrayList();
  26. final int thisIsInLeftConnectedDeviceDisplay = ((MainActivity)getActivity()).getIsInLeftConnectedDeviceDisplay();
  27. final int thisIsInRightConnectedDeviceDisplay = ((MainActivity)getActivity()).getIsInRightConnectedDeviceDisplay();
  28. int thisIsInThisConnectedDeviceDisplay = 0;
  29.  
  30. if (thisWhichGetInfoDialog == "Left") {
  31. thisIsInThisConnectedDeviceDisplay = thisIsInLeftConnectedDeviceDisplay;
  32. } else if (thisWhichGetInfoDialog == "Right")
  33. thisIsInThisConnectedDeviceDisplay = thisIsInRightConnectedDeviceDisplay;
  34.  
  35. AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  36. builder.setTitle(thisWhichGetInfoDialog + " Sensor Info");
  37. builder.setMessage("MAC Address: " + thisScannedDevicesArrayList.get(thisIsInThisConnectedDeviceDisplay));
  38. builder.setNeutralButton("View Data", new DialogInterface.OnClickListener() {
  39. @Override
  40. public void onClick(DialogInterface dialog, int which) {
  41. Intent myIntent = new Intent(?????, SensorDataDisplay.class);
  42. myIntent.putExtra("key", "TEST VALUE"); //Optional parameters
  43. ?????.startActivity(myIntent);
  44. }
  45. });
  46. builder.setNegativeButton("Done", new DialogInterface.OnClickListener() {
  47. public void onClick(DialogInterface dialog, int id) {
  48. // User cancelled the dialog
  49. }
  50. });
  51. return builder.create();
  52. }
  53. }
Add Comment
Please, Sign In to add comment