Back to project page tennis-charting-android.
The source code is released under:
GNU General Public License
If you think the Android project tennis-charting-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.inklily.tennischarting; /* w w w . j a v a 2s.co m*/ import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; /** * Activity to display a list of matches. */ public class MatchReviewActivity extends Activity implements MatchStorage.OnStorageAvailableListener { private SQLiteMatchStorage mStorage; @Override public void onStorageAvailable(MatchStorage storage) { ((ListView)findViewById(R.id.match_list)).setAdapter(storage); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_match_review); ListView match_list = (ListView)findViewById(R.id.match_list); match_list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent it = new Intent(MatchReviewActivity.this, MatchDetailActivity.class); it.putExtra("match_id", id); startActivity(it); } }); match_list.setOnItemLongClickListener(new ListView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, final long id) { AlertDialog.Builder builder = new AlertDialog.Builder(MatchReviewActivity.this); builder.setMessage("Really delete this match?"); builder.setNegativeButton("Not yet", null); builder.setPositiveButton("Do it", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { mStorage.deleteMatch(id); } catch (MatchStorage.MatchStorageNotAvailableException e) { e.printStackTrace(); } } }); builder.show(); return false; } }); mStorage = SQLiteMatchStorage.getGlobalInstance(this.getApplication()); } @Override protected void onResume() { super.onResume(); mStorage.addOnStorageAvailableListener(this); } }