Note that there are some explanatory texts on larger screens.

plurals
  1. PORestarting application using calling startActivity() but getting "complete action using"
    text
    copied!<p>I want my application to restart when pressing "OK" in an alertDialog. But when I am pressing the button I am getting "Complete Action USing" screen, how do I start my application without having to go to "Complete Action.." ? </p> <p>And is it the right way to restart application? </p> <p>P.S. I need to restart application because initially when the application starts the list is shown from the local database, then after getting the new data from server and updating local database, I can't display updated list. It works after restarting app. </p> <p>Code for calling startActivity: </p> <pre><code>Toast.makeText(mContext, "Reading complete", Toast.LENGTH_SHORT).show(); AlertDialog.Builder clickAlert = new AlertDialog.Builder(mContext); clickAlert.setMessage("Database has been updated, please restart application to load new data. "); clickAlert.setPositiveButton("Restart", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub Intent i = new Intent("android.intent.action.MAIN"); mContext.startActivity(i); } }); clickAlert.create().show(); </code></pre> <p>I have a listFragment that gets populated from a String adapter and this this string is filled from a method which returns data from server. I need to repopulate this list. Code: </p> <pre><code>// Get a cursor containing storelist Cursor curStoreList = mDbHelper.getStoreList(); String[] StoreList = new String[curStoreList.getCount()]; int i = 0; // Store returned items in StoreList[] while (curStoreList.moveToNext()) { String storeName = curStoreList.getString(0); StoreList[i] = storeName; i++; } // Create an adapter with list of stores and populate the list with // values ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getActivity(), android.R.layout.simple_list_item_1, StoreList); setListAdapter(adapter); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload