[android-developers] removing items from listview and array list problem

2012-03-04 Thread minnie me
I have this code i am used to pass an array list to another page and
show it as a listview. When the list shows up, i want to be able to
check an item and remove it at button click which will modify the
array.

public class Oppout extends Activity {
int selectedPosition;
/** Called when the activity is first created. */

@Override
public void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);
  setContentView(R.layout.oppout);

 final ListView lv2 = (ListView) findViewById
(R.id.custom_list_view);
 lv2.setClickable(true);
 lv2.setAdapter(new ArrayAdapterString(Oppout.this,
   android.R.layout.simple_list_item_checked,
Entername.playerList));

 lv2.setOnItemClickListener
 (
new AdapterView.OnItemClickListener()
{
public void onItemClick(AdapterView adapterView, 
View
view,int arg2, long arg3)
{
   int selectedPosition =
adapterView.getSelectedItemPosition();

   Toast.makeText(getBaseContext(), mu+
selectedPosition,
   Toast.LENGTH_SHORT).show();

}
}
 );


Button next = (Button) findViewById(R.id.button1);
next.setOnClickListener(new 
View.OnClickListener() {

public void onClick(View view) {
//on click call the adapterview and 
delete string at selected
position..this is my problem,
//i just don't know how to do it
 int selectedPosition = 
adapterView.getSelectedItemPosition();
 
adapterView.remove(player.SelectedPosition);

Intent myIntent = new Intent 
(view.getContext(),
Callacab.class);

startActivityForResult(myIntent, 0);

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: EditText input into array

2012-02-29 Thread minnie me
got it..i put it after the button click now..and i don't have tiime to
learn java first..i need to do both. thanks

On Feb 29, 8:27 am, TreKing treking...@gmail.com wrote:
 On Wed, Feb 29, 2012 at 12:53 AM, minnie me mgm...@gmail.com wrote:
  This is my new updated code, it prints out blank input in the
  array...so why is it not storing my user input?

 Your variable player is never set to the text after clicking your button.
 I think you need to spend some time learning Java before you jump into
 Android.

 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: EditText input into array

2012-02-28 Thread minnie me
It doesn't store array and allow me to display it on click

On Feb 28, 8:45 am, TreKing treking...@gmail.com wrote:
 On Mon, Feb 27, 2012 at 9:45 PM, minnie me mgm...@gmail.com wrote:
  Add more button and storing to array doesn't quite work

 Would you explain what doesn't quite work 
 means?http://www.catb.org/~esr/faqs/smart-questions.html

 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: EditText input into array

2012-02-28 Thread minnie me
This is my new updated code, it prints out blank input in the
array...so why is it not storing my user input?
public class Screen2 extends Activity {
 EditText txt1;
String player;
ArrayListString playerList = new ArrayListString();


/** Called when the activity is first created. **/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.screen2);

// edittext1 or textview1
txt1 = (EditText) findViewById(R.id.editText1);
player = txt1.getText().toString();


//add more items button
Button more = (Button) findViewById(R.id.button1);
more.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view){
if (txt1.getText().toString().length() !=0){
playerList.add(player);
}
System.out.println(playerList.toString());
}

});


On Feb 28, 12:54 pm, TreKing treking...@gmail.com wrote:
 On Tue, Feb 28, 2012 at 11:46 AM, minnie me mgm...@gmail.com wrote:
  It doesn't store array and allow me to display it on click

 That's still quite ambiguous. Read the link I gave you, then please try
 again, with more detail. Explain what you are doing. Pretend we have no
 knowledge of your problem since, you know, we don't.

 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] EditText input into array

2012-02-27 Thread minnie me


I have an input box (EditText1) 1. that i want to keep adding values
and save them to an Array 2. then when am done, i can click the done
button and it can take me to the next screen and I can display the
values or call the values of the array.. this is what i have so far 1.
Done Button Works 2. Add more button and storing to array doesn't
quite workHELP PLZ,

Thanks

public class Screen2 extends Activity {
private EditText txt1;
String ag;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.screen2);

// edittext1 or textview1
txt1 = (EditText) findViewById(R.id.editText1);
ag = txt1.getText().toString();

// done button
// -done button---
Button done = (Button) findViewById(R.id.button2);
done.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {

if(txt1.getText().length() != 0){
String ag = Players:, +txt1.getText().toString();
Toast.makeText(getBaseContext(), ag,
Toast.LENGTH_SHORT).show();

Intent myIntent = new Intent(view.getContext(),
Screen3.class);
startActivityForResult(myIntent, 0);

}else if (txt1.getText().length() == 0){
String ag = Error!! Enter Player Name;
Toast.makeText(getBaseContext(), ag,
Toast.LENGTH_SHORT).show();
}}

});

//add more items button need help on how to go about the array
Button more = (Button) findViewById(R.id.button1);
more.setOnClickListener(new View.OnClickListener() {
public void onClick(View view){
Intent myIntent = new Intent(view.getContext(),
Screen2.class);
startActivityForResult(myIntent, 0);
}

});

}}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: check box states

2012-02-27 Thread minnie me
thanks, it work

On Feb 23, 10:45 am, chanakyaraichur chanakyaraic...@gmail.com
wrote:
 Instead of checkbox.ispressed()
 Use !checkbox.ischecked
 On Feb 23, 2012 8:32 PM, TreKing treking...@gmail.com wrote:







  On Tue, Feb 21, 2012 at 9:39 PM, minnie me mgm...@gmail.com wrote:

  Am trying to get the count of how many check boxes are selected and if
  you de-select one, it's suppose to update the counter to -1..So if
  i select 4 check boxes and it says check less = count 4...then i
  pick 3 and the counter=3..this is what i have:

  And the problem is ... ?
 http://www.catb.org/~esr/faqs/smart-questions.html

  -
  TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
  transit tracking app for Android-powered devices

   --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] check box states

2012-02-23 Thread minnie me
Am trying to get the count of how many check boxes are selected and if
you de-select one, it's suppose to update the counter to -1..So if
i select 4 check boxes and it says check less = count 4...then i
pick 3 and the counter=3..this is what i have:
// ---CheckBox 1---
   final CheckBox checkBox = (CheckBox)
findViewById(R.id.checkBox1);

   // ---CheckBox 2---
   final CheckBox checkBox2 = (CheckBox)
findViewById(R.id.checkBox2);

   // ---CheckBox 3---

   final CheckBox checkBox3 = (CheckBox)
findViewById(R.id.checkBox3);


   // ---CheckBox 4---

   final CheckBox checkBox4 = (CheckBox)
findViewById(R.id.checkBox4);

   Button next = (Button) findViewById(R.id.button1);
   next.setOnClickListener(new View.OnClickListener() {
   public void onClick(View view) {
   if (checkBox.isChecked())
   count++;
   if (checkBox.isPressed())
   count--;
   if (checkBox2.isChecked())
   count++;
   if (checkBox2.isPressed())
   count--;
   if (checkBox3.isChecked())
   count++;
   if (checkBox3.isPressed())
   count--;
   if (checkBox4.isChecked())
   count++;
   if (checkBox4.isPressed())
   count--;
   if (count == pubsSelected){
   Intent myIntent = new Intent(view.getContext(),
Screen2.class);
   startActivityForResult(myIntent, 0);
   }
   else if (count  pubsSelected)
   DisplayToast(Pick more pubs/holes);
   else if (count  pubsSelected)
   DisplayToast(Pick less pubs/holes);
   }

   });
   }

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en