Skip to content

Minimise internet Usage

witnessmenow edited this page May 13, 2012 · 1 revision

hitting the interent uses more data, battery and leaves the user waiting. We should minimise it where possible

Show Settings config

To lower the amount of times we have to hit the interet, when the user removes one show from there shows we should just remove that one show rather than reloading the entire list.

I ran a spike test on this and we can do it fairly easy.

in showConfigActivity.java - onPostExecute for deleteing a show

`//displayToast("Deleted " + selectedShow);

			Intent intent = new Intent();
			intent.putExtra("action", "delete");
			intent.putExtra("showName", selectedShow);
			setResult(RESULT_OK, intent);
			
			finish();
			//onBackPressed();`

in YourSHowsActivity create a new method:

` @Override protected void onActivityResult (int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data);

	  // Collect data from the intent and use it
	 this.returedShowName = data.getStringExtra("showName");
	 this.returnedAction = data.getStringExtra("action");
	  
}`

then in onResume() ` //new getShows().execute();

  //No switch statements on strings in Java 1.6 
  if (returnedAction == "delete")
      {
              YourShows.removeShow(returedShowName)
	  displayToast("Deleted " + returedShowName);
      }`

A couple of negative things with doing it this way:

  • We need to change the list of shows we have from a arrayList to a map. (OR change the arrayList to be a list of strings as instead of Show objects)