2012-01-27 2 views
1

테마를 Theme.Dialog로 설정하여 작업을로드하기 위해 startActivity (인 텐트)를 사용할 때 내 응용 프로그램이 android : 새 활동의 레이블. 이것을 끌 수있는 방법이 있습니까? 새로운 활동의 onCreate에서 진행 대화 상자를 실행하면 토스트 메시지가 나타나지 않지만 진행 대화 상자 나 토스트 메시지는 원하지 않습니다.대화 상자 테마가있는 활동에 startActivity (인 텐트)를 사용하면 토스트가 튀어 나옵니다

Intent queriesIntent = new Intent(getApplicationContext(), GetQueriesPopup.class); 
startActivity(queriesIntent); 

그리고 Theme.Dialog를 내 활동 :

나는 함께 활동을 호출 내가 이동 전에/실제로 listActivity 보여주는의 제목임을 발견

public class GetQueriesPopup extends ListActivity { 
private static String server; 
private static String suffix; 
private static String project; 
private static int qid; 
private static String[] qidsArray; 
private static String username; 
private String[] queries; 
private ProgressDialog mDialog; 

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

    final SharedPreferences app_preferences = PreferenceManager.getDefaultSharedPreferences(this); 
    server = app_preferences.getString("server", "none"); 
    username = app_preferences.getString("username", "none"); 
    project = app_preferences.getString("project", "none"); 
    try 
    { 
     GetMap.showProgressDialog(true); 
     getRequest(); 
    } 
    catch(Exception ex) 
    { 
     GetMap.showProgressDialog(false); 
     AlertDialog alertDialog = new AlertDialog.Builder(this).create(); 
     alertDialog.setTitle("GTWeb"); 
     alertDialog.setMessage("Couldn't get a list of available queries, please check internet connection."); 
     alertDialog.setButton("OK", new DialogInterface.OnClickListener() 
     { 
      @Override 
      public void onClick(DialogInterface dialog, int which) 
      { 
       Intent intent = null; 
       intent = new Intent(getApplicationContext(), GTWeb.class); 
       intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
       startActivity(intent); 
      } 
     }); 
     alertDialog.show(); 
    } 

} 

     public void getRequest() 
{ 
    if (server.endsWith("/")) 
    { 
     suffix = "queries.aspx?usr=" + username + "&prj=" + project; 
    } 
    else 
    { 
     suffix = "/queries.aspx?usr=" + username + "&prj=" + project; 
    } 
    String url = server + suffix; 
    new HttpConnection().execute(url); 
} 

public void finishConnection(HttpConnection httpConn) 
{ 
    GetMap.showProgressDialog(false); 
    httpConn.cancel(true); 
    final SharedPreferences app_preferences = PreferenceManager.getDefaultSharedPreferences(this); 
    try 
    { 
     setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, queries)); 
     LayoutParams dialogParams = this.getWindow().getAttributes(); 
     dialogParams.height = 500; 
     dialogParams.width = 500; 
     dialogParams.gravity = Gravity.BOTTOM | Gravity.LEFT; 
     dialogParams.dimAmount = 0; 
     this.getWindow().setAttributes(dialogParams); 
     } 
    catch(Exception ex) 
    { 
     Log.e("QueryFragment Exception", ex.toString()); 
     AlertDialog alertDialog = new AlertDialog.Builder(this).create(); 
     alertDialog.setTitle("GTWeb"); 
     alertDialog.setMessage("Couldn't get a list of available queries, please check internet connection."); 
     alertDialog.setButton("OK", new DialogInterface.OnClickListener() 
     { 
      @Override 
      public void onClick(DialogInterface dialog, int which) 
      { 
       Intent intent = null; 
       intent = new Intent(getApplicationContext(), GTWeb.class); 
       intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
       startActivity(intent); 
      } 
     }); 
     alertDialog.show(); 
    } 
    final ListView lv = getListView(); 
    lv.setOnItemClickListener(new OnItemClickListener() 
    { 
     public void onItemClick(AdapterView<?> parent, View view, int position, long id) 
     { 
      qid = position; 
      SharedPreferences.Editor editor = app_preferences.edit(); 
      Intent myIntent = null; 

myIntent = new Intent(view.getContext(), GetPromptsPopup.class); 
       editor.putInt("qid", Integer.valueOf(qidsArray[qid])); 
       editor.putBoolean("location", false); 
       editor.commit(); 
       startActivityForResult(myIntent, 1); 
      } 

    }); 
} 

protected void onActivityResult(int requestCode, int resultCode, Intent data) 
{ 
    if (resultCode == RESULT_OK) 
    { 
     if (data.getBooleanExtra("finish", false)) 
     { 
      this.finish(); 
     } 
    } 
} 


private class HttpConnection extends AsyncTask<String, Void, String[]> 
{ 
    protected String[] doInBackground(String... url) 
    { 
     int TIMEOUT_MILLISEC = 10000; //=10sec 
     HttpParams my_httpParams = new BasicHttpParams();; 
     HttpConnectionParams.setConnectionTimeout(my_httpParams, 
       TIMEOUT_MILLISEC); //set conn time out 
     HttpConnectionParams.setSoTimeout(my_httpParams, TIMEOUT_MILLISEC); 

     HttpClient client = new DefaultHttpClient(my_httpParams); 
     String userAgent = "GTI;Android;" + Build.VERSION.SDK_INT; 
     client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, userAgent); 
     HttpGet request = new HttpGet(url[0]); 
     String[] txtResponse = null; 
     try{ 
      HttpResponse response = client.execute(request); 
      txtResponse = TestHttpGet.requestQueries(response); 
     }catch(Exception ex){ 
      Log.e("QueryFragment Exception @HttpConnection", ex.toString()); 
     } 
     return txtResponse; 
    } 


    protected void onPostExecute(String[] theResults) 
    { 
     try 
     { 
     queries = new String[theResults.length]; 
     qidsArray = new String[theResults.length]; 
     for (int i = 0; i < theResults.length; i++) 
     { 
      String[] tempQueries = theResults[i].split("\\|", -1); 
      if (tempQueries.length > 1) 
      { 
       qidsArray[i] = tempQueries[0]; 
       queries[i] = tempQueries[1]; 
      } 
     } 
     //   queries = theResults; 
     finishConnection(this); 
     } 
     catch (Exception ex) 
     { 
      Log.e("QueryFragment Exception", ex.toString()); 
      AlertDialog alertDialog = new AlertDialog.Builder(getApplicationContext()).create(); 
      alertDialog.setTitle("GTWeb"); 
      alertDialog.setMessage("Couldn't get a list of available queries, please check internet connection."); 
      alertDialog.setButton("OK", new DialogInterface.OnClickListener() 
      { 
       @Override 
       public void onClick(DialogInterface dialog, int which) 
       { 
        Intent intent = null; 
        intent = new Intent(getApplicationContext(), GTWeb.class); 
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
        startActivity(intent); 
       } 
      }); 
      alertDialog.show(); 
     } 
    } 
} 

답변

1

목록을로드했습니다. 나는 ProgressDialog로 그것을 덮어 버릴 수있는 방법을 찾지 못했습니다.