Back to project page aSimpleDiceRoller.
The source code is released under:
GNU General Public License
If you think the Android project aSimpleDiceRoller listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * aSimpleDiceRoller - Simple dice roller application for Android. * Copyright 2012 Elad Alfassa <elad@fedoraproject.org> * /*from w w w . j a v a 2 s . c o m*/ * This file is part of aSimpleDiceRoller. * * aSimpleDiceRoller is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * aSimpleDiceRoller is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with aSimpleDiceRoller. If not, see <http://www.gnu.org/licenses/>. */ package com.elad.diceroller; import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.AdapterView.OnItemClickListener; import android.widget.TextView; import android.widget.ListView; import android.view.View; import android.widget.ArrayAdapter; import android.widget.AdapterView; public class DiceListActivity extends ListActivity { private Context context; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, dice)); context=this; ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(context, ASimpleDiceRollerActivity.class); String message = ((TextView) view).getText().toString(); ASimpleDiceRollerActivity.selected_die=message; startActivity(intent); } }); } static final String[] dice = new String[] { "d4", "d6", "d8","d10","d12","d20","d100" }; }