Когда я использую startActivity (Intent) для загрузки действия с темой, установленной на Theme.Dialog, мое приложение отображает уведомление Toast с меткой android: для нового действия. Есть ли способ отключить это? Я заметил, что если я запускаю диалоговое окно прогресса в onCreate нового действия, оно не выскакивает сообщение Toast, но мне не нужно диалоговое окно прогресса или сообщение Toast.
Я называю деятельность с:
Intent queriesIntent = new Intent(getApplicationContext(), GetQueriesPopup.class);
startActivity(queriesIntent);
И моя деятельность с Theme.Dialog:
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();
}
}
}