2012-01-29 4 views
0

새 대화 상자 또는 오히려 다음 대화 상자가 실행 중일 때 첫 번째 대화 상자 창으로 돌아갈 수 없습니다.뒤로 버튼이있는 첫 번째 대화 상자로 돌아 가기

내 목표는 이전 버튼을 클릭하여 대화 상자를 여는 것입니다. 나는 이것을 어떻게 얻을 수 있을까 ??

몇 가지 시도했지만 내 문제를 해결할 수 없습니다.

AlertDialog.Builder builder = new AlertDialog.Builder(context); 
       builder.setTitle("AP's"); 
       builder.setItems(scannedAP, new DialogInterface.OnClickListener() { 
        public void onClick(DialogInterface dialog, int which) { 
         try { 
          Cursor cursor = dbAdapter.queryRssiBlob(scannedMacSsid[which][mac],scannedMacSsid[which][ssid],coord[GridConfig.curXCoord],coord[GridConfig.curYCoord]); 
          if (cursor != null && cursor.moveToFirst()) { 
           byte[] rssiArrayOne = cursor.getBlob(cursor.getColumnIndex("rssi")); 
           cursor.close(); 
           ObjectInputStream objectIn = new ObjectInputStream(new ByteArrayInputStream(rssiArrayOne)); 
           List<Integer> readRssi = (List<Integer>) objectIn.readObject(); 
           rssiList = new CharSequence[readRssi.size()]; 
           for (int index = 0; index < readRssi.size(); index++) { 
            rssiList[index] = "" + readRssi.get(index); 
           } 
           AlertDialog.Builder build = new AlertDialog.Builder(context); 
           build.setTitle("RSSi values"); 
           build.setItems(rssiList, new DialogInterface.OnClickListener() { 
            public void onClick(DialogInterface dialog, int which) {} 
            }); 
           build.setOnKeyListener(new DialogInterface.OnKeyListener() { 
            public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event2) { 
             if (keyCode == KeyEvent.KEYCODE_BACK) { 
              return false; 
             } 
             return true; 
            } 
            }); 
           AlertDialog alertBuild = build.create(); 
           alertBuild.show(); 
          } else { 
           Toast.makeText(context, "No Values", Toast.LENGTH_SHORT).show(); 
          } 
         } catch (Exception e) { 
          e.printStackTrace(); 
         } 

        } 

       }); 
       AlertDialog alert = builder.create(); 
       alert.show(); 

답변

0

첫 번째 대화에 사용하는 별도의 클래스와 AndroidManifest를에서 해당 클래스의 <activity> 태그에 android:theme="@android:style/Theme.Dialog"를 추가 : 여기 내 코드입니다. finish()으로 전화하지 않으면 백 스택에 추가됩니다.

+0

도움을 주셔서 감사합니다. 곧 사용해 보겠습니다. – LikeMusic

관련 문제