Advertisement
Guest User

DialogDisplayDataHelpers

a guest
Mar 27th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.17 KB | None | 0 0
  1. public static AlertDialog.Builder dlgAlert;     //Error dlgBox
  2.  
  3. public static void displayDialogMSG(String msg, String title){
  4.         dlgAlert.setMessage(msg);
  5.         dlgAlert.setTitle(title);
  6.         dlgAlert.setPositiveButton("Close",
  7.                 new DialogInterface.OnClickListener() {
  8.                     public void onClick(DialogInterface dialog, int which) {
  9.                         //dismiss the dialog
  10.                     }
  11.                 });
  12.         dlgAlert.setCancelable(true);
  13.         dlgAlert.create().show();
  14.     }
  15.     public static void displayDialogMSG(String[] msg, String title){
  16.  
  17.         dlgAlert.setTitle(title);
  18.         dlgAlert.setPositiveButton("Close",
  19.                 new DialogInterface.OnClickListener() {
  20.                     public void onClick(DialogInterface dialog, int which) {
  21.                         //dismiss the dialog
  22.                     }
  23.                 });
  24.         dlgAlert.setCancelable(true);
  25.         dlgAlert.create().show();
  26.         dlgAlert.setItems(msg, new DialogInterface.OnClickListener() {
  27.             public void onClick(DialogInterface dialog, int selection) {
  28.                 //File imgFile = new  File(dirList[selection]);
  29.                 //deletePrivateFile(imgFile);
  30.             }
  31.         }).show();
  32.     }
  33.     public static void displayDialogData(byte data, String title){
  34.  
  35.         String byteMsg = String.valueOf(data);
  36.  
  37.         dlgAlert.setMessage(byteMsg);
  38.         dlgAlert.setTitle(title);
  39.         dlgAlert.setPositiveButton("Close",
  40.                 new DialogInterface.OnClickListener() {
  41.                     public void onClick(DialogInterface dialog, int which) {
  42.                         //dismiss the dialog
  43.                     }
  44.                 });
  45.         dlgAlert.setCancelable(true);
  46.         dlgAlert.create().show();
  47.     }
  48.     public static void displayDialogData(byte[] data, String title){
  49.  
  50.         String byteList[] = new String[data.length];
  51.         int i = 0;
  52.         for (i = 0; i < data.length; i++)
  53.         {
  54.             byteList[i] = String.valueOf(data[i]);
  55.         }
  56.  
  57.         //dlgAlert.setMessage(e.getMessage());
  58.         dlgAlert.setTitle(title);
  59.         dlgAlert.setPositiveButton("Close",
  60.                 new DialogInterface.OnClickListener() {
  61.                     public void onClick(DialogInterface dialog, int which) {
  62.                         //dismiss the dialog
  63.                     }
  64.                 });
  65.         dlgAlert.setCancelable(true);
  66.         dlgAlert.setItems(byteList, new DialogInterface.OnClickListener() {
  67.             public void onClick(DialogInterface dialog, int selection) {
  68.                 //File imgFile = new  File(dirList[selection]);
  69.                 //deletePrivateFile(imgFile);
  70.             }
  71.         }).create().show();
  72.     }
  73.     public static void displayDialogData(byte[][] data, String title){
  74.  
  75.         //String dataList[] = new String[(data.length * data[0].length)];//8x8 = 64
  76.         String dataList[] = new String[(data.length)];//8x8 = 64
  77.         int i = 0;
  78.         int j = 0;
  79.         for (i = 0; i < data.length; i++)
  80.         {
  81.             dataList[i] = "[" + String.valueOf(data[i][0]) + "]";
  82.             for (j = 1; j < data[0].length; j++)
  83.             {
  84.                 dataList[i] += ( "  [" + String.valueOf(data[i][j]) + "]");
  85.             }
  86.  
  87.         }
  88.  
  89.         //dlgAlert.setMessage(e.getMessage());
  90.         dlgAlert.setTitle(title);
  91.         dlgAlert.setPositiveButton("Close",
  92.                 new DialogInterface.OnClickListener() {
  93.                     public void onClick(DialogInterface dialog, int which) {
  94.                         //dismiss the dialog
  95.                     }
  96.                 });
  97.         dlgAlert.setCancelable(true);
  98.         dlgAlert.setItems(dataList, new DialogInterface.OnClickListener() {
  99.             public void onClick(DialogInterface dialog, int selection) {
  100.                 //File imgFile = new  File(dirList[selection]);
  101.                 //deletePrivateFile(imgFile);
  102.             }
  103.         }).create().show();
  104.     }
  105.     public static void displayDialogData(double[] data, String title){
  106.  
  107.         String dataList[] = new String[data.length];
  108.         int i = 0;
  109.         for (i = 0; i < data.length; i++)
  110.         {
  111.             dataList[i] = String.valueOf(data[i]);
  112.         }
  113.  
  114.         //dlgAlert.setMessage(e.getMessage());
  115.         dlgAlert.setTitle(title);
  116.         dlgAlert.setPositiveButton("Close",
  117.                 new DialogInterface.OnClickListener() {
  118.                     public void onClick(DialogInterface dialog, int which) {
  119.                         //dismiss the dialog
  120.                     }
  121.                 });
  122.         dlgAlert.setCancelable(true);
  123.         dlgAlert.setItems(dataList, new DialogInterface.OnClickListener() {
  124.             public void onClick(DialogInterface dialog, int selection) {
  125.                 //File imgFile = new  File(dirList[selection]);
  126.                 //deletePrivateFile(imgFile);
  127.             }
  128.         }).create().show();
  129.     }
  130.     public static void displayDialogData(double[][] data, String title){
  131.  
  132.         //String dataList[] = new String[(data.length * data[0].length)];//8x8 = 64
  133.         String dataList[] = new String[(data.length)];//8x8 = 64
  134.         int i = 0;
  135.         int j = 0;
  136.         for (i = 0; i < data.length; i++)
  137.         {
  138.             dataList[i] = "[" + String.valueOf(data[i][0]) + "]";
  139.             for (j = 1; j < data[0].length; j++)
  140.             {
  141.                 dataList[i] += ( "  [" + String.valueOf(data[i][j]) + "]");
  142.             }
  143.  
  144.         }
  145.  
  146.         //dlgAlert.setMessage(e.getMessage());
  147.         dlgAlert.setTitle(title);
  148.         dlgAlert.setPositiveButton("Close",
  149.                 new DialogInterface.OnClickListener() {
  150.                     public void onClick(DialogInterface dialog, int which) {
  151.                         //dismiss the dialog
  152.                     }
  153.                 });
  154.         dlgAlert.setCancelable(true);
  155.         dlgAlert.setItems(dataList, new DialogInterface.OnClickListener() {
  156.             public void onClick(DialogInterface dialog, int selection) {
  157.                 //File imgFile = new  File(dirList[selection]);
  158.                 //deletePrivateFile(imgFile);
  159.             }
  160.         }).create().show();
  161.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement