[android-developers] active button color
Hello all, I m wondering if someone can help me with a situation. I have this list view as shown in the picture below. http://www.flickr.com/photos/34403...@n02/5098102704/ Each button on the top has a list view corresponding to the above field. I m trying to see how it is possible to show the default selection as the user enters this particular screen. I m trying to keep one of the button on the top to have a different color so the user can know which of the tab views they have presently selected. Thanks, Varun -- 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] icon wont push to the right
Hello all, I am facing a small issue. In the picture below http://www.flickr.com/photos/34403...@n02/5098102704/ I have this icon on the right, the problem is I would like for it to be completely on the right side but after having played with the width and alignment it just wont go to the right. If I try to change the width it just disappears if I increase more than 10 px and the alignment wont make a difference neither does padding. Can anyone help me identify the problem. Here is the xml file ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal CheckBox android:text= android:id=@+id/list_checkbox android:layout_width=wrap_content android:layout_height=wrap_content android:checked=true android:layout_weight=1.0 android:paddingLeft=2px android:paddingRight=2px android:paddingTop=2px /CheckBox LinearLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=vertical LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/label1 android:layout_width=105px android:layout_height=wrap_content android:textSize=15sp android:layout_weight=1.0 / TextView android:id=@+id/label3 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_marginLeft=40px android:textSize=15sp android:text=hello3 android:layout_weight=1.0 / /LinearLayout LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/label2 android:layout_width=wrap_content android:layout_height=wrap_content android:gravity=center_vertical android:textSize=15sp android:layout_weight=1.0 / TextView android:id=@+id/label3 android:layout_width=wrap_content android:layout_marginLeft=40px android:paddingLeft=2px android:paddingRight=2px android:layout_height=wrap_content android:text=hello android:layout_weight=1.0 / /LinearLayout /LinearLayout !-- Moved here. Add android:paddingTop=2px as the first icon -- ImageView android:id=@+id/icon android:layout_width=22px android:layout_height=wrap_content android:paddingLeft=2px android:paddingTop=2px android:src=@drawable/icon android:layout_weight=1.0 android:layout_gravity=right/ /LinearLayout -- 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] on button click not working for calendar
Hi, I am not sure why my on button click is not working for the calender icon I have, does any one knows what I may be doing wrong? Here is my java code, thanks in advance. package com.varun.HelloListView; import java.util.Calendar; import android.app.Activity; import android.app.AlertDialog; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class screen3 extends Activity implements OnClickListener{ private int mYear; private int mMonth; private int mDay; private final int DATE_DIALOG_ID = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.form_screen_3); Button button = (Button) findViewById(R.id.Buttonsubmit); button.setOnClickListener(this); } public void onClick(View view) { /** check whether the yesno button has been clicked */ if (view == findViewById(R.id.Buttonsubmit)) { // Create the dialog box AlertDialog.Builder alertbox = new AlertDialog.Builder(this); // Set the message to display alertbox.setMessage(This is a dialog box with two buttons); // Set a positive/yes button and create a listener alertbox.setPositiveButton(Yes, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface arg0, int arg1) { Toast.makeText(getApplicationContext(), 'Yes' button clicked, Toast.LENGTH_SHORT).show(); } }); // Set a negative/no button and create a listener alertbox.setNegativeButton(No, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface arg0, int arg1) { Toast.makeText(getApplicationContext(), 'No' button clicked, Toast.LENGTH_SHORT).show(); } }); // display box alertbox.show(); } /*...@override public void onClick(View v) { Toast.makeText(screen3.this, The report #1234 has been submitted to Mr XYZ, Toast.LENGTH_SHORT).show(); } }); */ Button btnCalendar = (Button) findViewById(R.id.btnCalendar); btnCalendar.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); final Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); } @Override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: return new DatePickerDialog(this, null, mYear, mMonth, mDay); } return null; } } -- 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: on button click not working for calendar
Sorry about that. R.id.btnCalendar is not working. Thanks On Oct 15, 11:44 am, Kumar Bibek coomar@gmail.com wrote: Which button click is not working? You have to be more specific in describing your problem. On Sat, Oct 16, 2010 at 12:11 AM, Varun Khanduja varunkhand...@gmail.comwrote: Hi, I am not sure why my on button click is not working for the calender icon I have, does any one knows what I may be doing wrong? Here is my java code, thanks in advance. package com.varun.HelloListView; import java.util.Calendar; import android.app.Activity; import android.app.AlertDialog; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class screen3 extends Activity implements OnClickListener{ private int mYear; private int mMonth; private int mDay; private final int DATE_DIALOG_ID = 0; �...@override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.form_screen_3); Button button = (Button) findViewById(R.id.Buttonsubmit); button.setOnClickListener(this); } public void onClick(View view) { /** check whether the yesno button has been clicked */ if (view == findViewById(R.id.Buttonsubmit)) { // Create the dialog box AlertDialog.Builder alertbox = new AlertDialog.Builder(this); // Set the message to display alertbox.setMessage(This is a dialog box with two buttons); // Set a positive/yes button and create a listener alertbox.setPositiveButton(Yes, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface arg0, int arg1) { Toast.makeText(getApplicationContext(), 'Yes' button clicked, Toast.LENGTH_SHORT).show(); } }); // Set a negative/no button and create a listener alertbox.setNegativeButton(No, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface arg0, int arg1) { Toast.makeText(getApplicationContext(), 'No' button clicked, Toast.LENGTH_SHORT).show(); } }); // display box alertbox.show(); } /*...@override public void onClick(View v) { Toast.makeText(screen3.this, The report #1234 has been submitted to Mr XYZ, Toast.LENGTH_SHORT).show(); } }); */ Button btnCalendar = (Button) findViewById(R.id.btnCalendar); btnCalendar.setOnClickListener(new OnClickListener() { �...@override public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); final Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); } �...@override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: return new DatePickerDialog(this, null, mYear, mMonth, mDay); } return null; } } -- 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.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com -- 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: on button click not working for calendar
Log cat is not showing any errors as such. Isn't showDialog(DATE_DIALOG_ID); the show call to the dialog? On Oct 15, 11:54 am, Kumar Bibek coomar@gmail.com wrote: Any errors in the logcat? Try showing a toast in the event. I think you are missing a show call to the dialog On Sat, Oct 16, 2010 at 12:21 AM, Varun Khanduja varunkhand...@gmail.comwrote: Sorry about that. R.id.btnCalendar is not working. Thanks On Oct 15, 11:44 am, Kumar Bibek coomar@gmail.com wrote: Which button click is not working? You have to be more specific in describing your problem. On Sat, Oct 16, 2010 at 12:11 AM, Varun Khanduja varunkhand...@gmail.comwrote: Hi, I am not sure why my on button click is not working for the calender icon I have, does any one knows what I may be doing wrong? Here is my java code, thanks in advance. package com.varun.HelloListView; import java.util.Calendar; import android.app.Activity; import android.app.AlertDialog; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class screen3 extends Activity implements OnClickListener{ private int mYear; private int mMonth; private int mDay; private final int DATE_DIALOG_ID = 0; �...@override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.form_screen_3); Button button = (Button) findViewById(R.id.Buttonsubmit); button.setOnClickListener(this); } public void onClick(View view) { /** check whether the yesno button has been clicked */ if (view == findViewById(R.id.Buttonsubmit)) { // Create the dialog box AlertDialog.Builder alertbox = new AlertDialog.Builder(this); // Set the message to display alertbox.setMessage(This is a dialog box with two buttons); // Set a positive/yes button and create a listener alertbox.setPositiveButton(Yes, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface arg0, int arg1) { Toast.makeText(getApplicationContext(), 'Yes' button clicked, Toast.LENGTH_SHORT).show(); } }); // Set a negative/no button and create a listener alertbox.setNegativeButton(No, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface arg0, int arg1) { Toast.makeText(getApplicationContext(), 'No' button clicked, Toast.LENGTH_SHORT).show(); } }); // display box alertbox.show(); } /*...@override public void onClick(View v) { Toast.makeText(screen3.this, The report #1234 has been submitted to Mr XYZ, Toast.LENGTH_SHORT).show(); } }); */ Button btnCalendar = (Button) findViewById(R.id.btnCalendar); btnCalendar.setOnClickListener(new OnClickListener() { �...@override public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); final Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); } �...@override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: return new DatePickerDialog(this, null, mYear, mMonth, mDay); } return null; } } -- 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.comandroid-developers%2Bunsubs cr...@googlegroups.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send
[android-developers] Re: on button click not working for calendar
Hello, I tried to have a toast as well but it didn't seem to work. The button where I had toast was buttoncalender1. package com.varun.HelloListView; import java.util.Calendar; import android.app.Activity; import android.app.AlertDialog; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class screen3 extends Activity implements OnClickListener{ private int mYear; private int mMonth; private int mDay; private final int DATE_DIALOG_ID = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.form_screen_3); Button button = (Button) findViewById(R.id.Buttonsubmit); button.setOnClickListener(this); } public void onClick(View view) { /** check whether the yesno button has been clicked */ if (view == findViewById(R.id.Buttonsubmit)) { // Create the dialog box AlertDialog.Builder alertbox = new AlertDialog.Builder(this); // Set the message to display alertbox.setMessage(This is a dialog box with two buttons); // Set a positive/yes button and create a listener alertbox.setPositiveButton(Yes, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface arg0, int arg1) { Toast.makeText(getApplicationContext(), 'Yes' button clicked, Toast.LENGTH_SHORT).show(); } }); // Set a negative/no button and create a listener alertbox.setNegativeButton(No, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface arg0, int arg1) { Toast.makeText(getApplicationContext(), 'No' button clicked, Toast.LENGTH_SHORT).show(); } }); // display box alertbox.show(); /*...@override public void onClick(View v) { Toast.makeText(screen3.this, The report #1234 has been submitted to Mr XYZ, Toast.LENGTH_SHORT).show(); } }); */ /** check whether the selectlist button has been clicked */ if (view == findViewById(R.id.btnCalendar1)) { //List items final CharSequence[] items = {Milk, Butter, Cheese}; //Prepare the list dialog box AlertDialog.Builder builder = new AlertDialog.Builder(this); //Set its title builder.setTitle(Pick an item); //Set the list items and assign with the click listener builder.setItems(items, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface dialog, int item) { Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show(); } }); AlertDialog alert = builder.create(); //display dialog box alert.show(); } } Button btnCalendar = (Button) findViewById(R.id.btnCalendar); btnCalendar.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); final Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); } @Override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: return new DatePickerDialog(this, null, mYear, mMonth, mDay); } return null; } } On Oct 15, 12:17 pm, Varun Khanduja varunkhand...@gmail.com wrote: Log cat is not showing any errors as such. Isn't showDialog(DATE_DIALOG_ID); the show call to the dialog? On Oct 15, 11:54 am, Kumar Bibek coomar@gmail.com wrote: Any errors in the logcat? Try showing a toast in the event. I think you are missing a show call to the dialog On Sat, Oct 16, 2010 at 12:21 AM, Varun Khanduja varunkhand...@gmail.comwrote: Sorry about that. R.id.btnCalendar is not working. Thanks On Oct 15, 11:44 am, Kumar Bibek coomar@gmail.com wrote: Which button click is not working? You have to be more specific in describing your problem. On Sat, Oct 16, 2010 at 12:11 AM, Varun Khanduja varunkhand...@gmail.comwrote: Hi
[android-developers] Re: on button click not working for calendar
hello all, There were some more issues which I tried to resolve , however the buttons calender and attachment still don't work. package com.varun.HelloListView; import java.util.Calendar; import android.app.Activity; import android.app.AlertDialog; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class screen3 extends Activity implements OnClickListener{ private int mYear; private int mMonth; private int mDay; private final int DATE_DIALOG_ID = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.form_screen_3); Button button = (Button) findViewById(R.id.Buttonsubmit); button.setOnClickListener(this); } public void onClick(View view) { /** check whether the yesno button has been clicked */ //*** Jason, alternatively, we can use switch statement switch(view.getId()) { case R.id.Buttonsubmit: // Create the dialog box AlertDialog.Builder alertbox = new AlertDialog.Builder(this); // Set the message to display alertbox.setMessage(This is a dialog box with two buttons); // Set a positive/yes button and create a listener alertbox.setPositiveButton(Yes, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface arg0, int arg1) { Toast.makeText(getApplicationContext(), 'Yes' button clicked, Toast.LENGTH_SHORT).show(); } }); // Set a negative/no button and create a listener alertbox.setNegativeButton(No, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface arg0, int arg1) { Toast.makeText(getApplicationContext(), 'No' button clicked, Toast.LENGTH_SHORT).show(); } }); // display box alertbox.show(); /*...@override public void onClick(View v) { Toast.makeText(screen3.this, The report #1234 has been submitted to Mr XYZ, Toast.LENGTH_SHORT).show(); } }); */ break; /** check whether the selectlist button has been clicked */ case R.id.btnCalendar1: //List items final CharSequence[] items = {Milk, Butter, Cheese}; //Prepare the list dialog box AlertDialog.Builder builder = new AlertDialog.Builder(this); //Set its title builder.setTitle(Pick an item); //Set the list items and assign with the click listener builder.setItems(items, new DialogInterface.OnClickListener() { // Click listener public void onClick(DialogInterface dialog, int item) { Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show(); } }); AlertDialog alert = builder.create(); //display dialog box alert.show(); Button btnCalendar = (Button) findViewById(R.id.btnCalendar); btnCalendar.setOnClickListener(new OnClickListener() { public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); final Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); break; default: break; } } @Override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: return new DatePickerDialog(this, null, mYear, mMonth, mDay); } return null; } } On Oct 15, 2:17 pm, Varun Khanduja varunkhand...@gmail.com wrote: Hello, I tried to have a toast as well but it didn't seem to work. The button where I had toast was buttoncalender1. package com.varun.HelloListView; import java.util.Calendar; import android.app.Activity; import android.app.AlertDialog; import android.app.DatePickerDialog; import
[android-developers] divider for forms
Hello all, I was following this tutorial to make a simple form and I could make the form but I am wondering if someone has insights into how I can put a line divider between each line( row) http://mobile.tutsplus.com/tutorials/android/android-sdk-creating-forms/ Here is the preview to the final form I got and I am wondering if someone can help me with some xml attribute which can help the field one from field 2? Below is the xml file as well. http://www.flickr.com/photos/34403...@n02/5079751640/ ?xml version=1.0 encoding=utf-8? ScrollView xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/ScrollView01 android:layout_width=wrap_content android:layout_height=wrap_content android:scrollbars=vertical LinearLayout android:layout_width=fill_parent android:orientation=vertical android:layout_height=fill_parent !--Put form controls here-- LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/TextViewTitle android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/edittext1 android:textSize=10pt /TextView EditText android:id=@+id/EditTextName android:layout_height=wrap_content android:hint=@string/feedbackname android:inputType=textPersonName android:singleLine=true android:layout_width=wrap_content /EditText Spinner android:id=@+id/Spinnercurrency android:layout_height=wrap_content android:prompt=@string/feedbacktype android:layout_width=fill_parent android:entries=@array/currencytypelist /Spinner /LinearLayout LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/TextViewTitle android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/edittext2 android:textSize=10pt /TextView EditText android:id=@+id/EditTextEmail android:layout_height=wrap_content android:hint=@string/feedbackemail android:inputType=textEmailAddress android:layout_width=wrap_content /EditText /LinearLayout LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/TextViewTitle android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/edittext3 android:textSize=10pt /TextView EditText android:id=@+id/EditTextFeedbackBody android:layout_height=wrap_content android:hint=@string/feedbackbody android:inputType=textPersonName android:layout_width=wrap_content /EditText /LinearLayout LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/TextViewTitle android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/edittext4 android:textSize=10pt /TextView EditText android:id=@+id/EditTextFeedbackBody android:layout_height=wrap_content android:hint=@string/feedbackbody android:inputType=textPersonName android:layout_width=wrap_content /EditText /LinearLayout LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/TextViewTitle android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/edittext5 android:textSize=10pt /TextView /LinearLayout CheckBox android:id=@+id/CheckBoxResponse android:layout_height=wrap_content android:text=@string/feedbackresponse android:layout_width=wrap_content /CheckBox LinearLayout android:id=@+id/Button4 android:layout_width=fill_parent android:layout_height=wrap_content android:layout_alignParentBottom=true android:orientation=horizontal !-- wrap_content, to have more than one buttons in the same line -- !-- moved the button here-- Button android:id=@+id/Buttonsubmit android:layout_width=fill_parent android:layout_height=wrap_content android:text=Submit/ /LinearLayout /LinearLayout /ScrollView -- 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] divider for forms
Hello all, I was following this tutorial to make a simple form and I could make the form but I am wondering if someone has insights into how I can put a line divider between each line( row) http://mobile.tutsplus.com/tutorials/android/android-sdk-creating-forms/ Here is the preview to the final form I got and I am wondering if someone can help me with some xml attribute which can help the field one from field 2? Below is the xml file as well. http://www.flickr.com/photos/34403...@n02/5079751640/ ?xml version=1.0 encoding=utf-8? ScrollView xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/ScrollView01 android:layout_width=wrap_content android:layout_height=wrap_content android:scrollbars=vertical LinearLayout android:layout_width=fill_parent android:orientation=vertical android:layout_height=fill_parent !--Put form controls here-- LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/TextViewTitle android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/edittext1 android:textSize=10pt /TextView EditText android:id=@+id/EditTextName android:layout_height=wrap_content android:hint=@string/feedbackname android:inputType=textPersonName android:singleLine=true android:layout_width=wrap_content /EditText Spinner android:id=@+id/Spinnercurrency android:layout_height=wrap_content android:prompt=@string/feedbacktype android:layout_width=fill_parent android:entries=@array/currencytypelist /Spinner /LinearLayout LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/TextViewTitle android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/edittext2 android:textSize=10pt /TextView EditText android:id=@+id/EditTextEmail android:layout_height=wrap_content android:hint=@string/feedbackemail android:inputType=textEmailAddress android:layout_width=wrap_content /EditText /LinearLayout LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/TextViewTitle android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/edittext3 android:textSize=10pt /TextView EditText android:id=@+id/EditTextFeedbackBody android:layout_height=wrap_content android:hint=@string/feedbackbody android:inputType=textPersonName android:layout_width=wrap_content /EditText /LinearLayout LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/TextViewTitle android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/edittext4 android:textSize=10pt /TextView EditText android:id=@+id/EditTextFeedbackBody android:layout_height=wrap_content android:hint=@string/feedbackbody android:inputType=textPersonName android:layout_width=wrap_content /EditText /LinearLayout LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal TextView android:id=@+id/TextViewTitle android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/edittext5 android:textSize=10pt /TextView /LinearLayout CheckBox android:id=@+id/CheckBoxResponse android:layout_height=wrap_content android:text=@string/feedbackresponse android:layout_width=wrap_content /CheckBox LinearLayout android:id=@+id/Button4 android:layout_width=fill_parent android:layout_height=wrap_content android:layout_alignParentBottom=true android:orientation=horizontal !-- wrap_content, to have more than one buttons in the same line -- !-- moved the button here-- Button android:id=@+id/Buttonsubmit android:layout_width=fill_parent android:layout_height=wrap_content android:text=Submit/ /LinearLayout /LinearLayout /ScrollView -- 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] new screen on button click
Hello, I am trying to follow a tutorial to learn how to get to a new screen on a button click. The issue I feel I am facing is that in this tutorial they have a file named main.java, firstly I don't have such a file. I think I named the file as name1.java and on this screen i have everything going on including this button I am trying to make. So I m really confused as in this article below they have the main.java file and from that file they are moving to screen 1 and screen 2. Is it so important to have a main.java from where we branch the two activities? So tired and confused, please help http://www.barebonescoder.com/2010/05/android-development-adding-screens-button-handlers/ -- 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: new screen on button click
Hello all, I figured out the issue. I went through this tutorial over and over again without worrying for my project and then suddenly realized there was nothing wrong except that I was not replacing a xml file. Sorry I know it was not very smart of me. Thanks all @king - I agree with you. I am actually learning Java and Android side by side. It's something I had been delaying for a long while. I am picking up Java as I progress, I bought a book on Java recently( Learning Java for android development) and I am able to figure out some of the things related to Java. This post was probably something I could have avoided, just that I wasn't sure if having the application name same as the activity name is a good idea. Thanks a lot for the help. On Oct 12, 1:16 pm, TreKing treking...@gmail.com wrote: On Tue, Oct 12, 2010 at 3:06 PM, Varun Khanduja varunkhand...@gmail.comwrote: So tired and confused, please help Varun, based on this and your previous posts, it seems as though you don't yet have a solid grasp on Java. Forgive me if that's the wrong assumption. If not though, I would highly suggest you take a step back from Android and learn you some vanilla Java until you get a solid understanding of the language before continuing working in Android. Otherwise you're going to continue to be tired and confused over mundane stuff like this. --- -- 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] opening new screen help
Hello all, I was just wondering if someone can me understand how we can make a new screen work in a existing code. I tried this tutorial but the part which I don't understand very well is where should I put that piece of java code in my existing code. Rest of it is fairly simple. Some help please. Thanks package com.varun.HelloListView; import java.util.ArrayList; import java.util.HashMap; import android.app.ListActivity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.SimpleAdapter; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; ArrayListHashMapString, String list1 = new ArrayListHashMapString, String(); SimpleAdapter smipleAdapter1; ArrayListHashMapString, String list2 = new ArrayListHashMapString, String(); SimpleAdapter smipleAdapter2; ArrayListHashMapString, String bottom= new ArrayListHashMapString, String(); SimpleAdapter simpleAdapter3; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); smipleAdapter1 = new SimpleAdapter(this, list1, R.layout.list_item, new String[] {line1, line2}, new int[] {R.id.label1, R.id.label2}); smipleAdapter2 = new SimpleAdapter(this, list2, R.layout.list_item, new String[] {line1, line2}, new int[] {R.id.label1, R.id.label2}); //pupulate the lists addItems(); this.setListAdapter(smipleAdapter1); // button click Button next1 = (Button) findViewById(R.id.Button1); next1.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { setListAdapter(smipleAdapter1); smipleAdapter1.notifyDataSetChanged(); } } ); this.setListAdapter(smipleAdapter2); Button next2 = (Button) findViewById(R.id.Button2); next2.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { setListAdapter(smipleAdapter2); smipleAdapter2.notifyDataSetChanged(); } } ); } private void addItems() { long ts = System.currentTimeMillis(); int lastDigit = (int)( ts % 10 ); for(int i = 0; i AndroidPhones1.length; i++) { HashMapString,String item = new HashMapString,String(); item.put( line1, AndroidPhones1[i] ); item.put( line2, lastDigit: +Integer.toString( lastDigit ) ); list1.add( item ); smipleAdapter1.notifyDataSetChanged(); } for(int i = 0; i AndroidPhones2.length; i++) { HashMapString,String item = new HashMapString,String(); item.put( line1, AndroidPhones2[i] ); item.put( line2, varun1 ); list2.add( item ); smipleAdapter2.notifyDataSetChanged(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, Settings.ENTER_FOOD, 0, Enter Food); menu.add(0, Settings.ANALYZE_FOOD, 0, Analyze Food); menu.add(0, Settings.SETTINGS, 0, Settings); return true; } static final String[] AndroidPhones1 = new String[] { HTC Evo 1G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally }; static final
[android-developers] Re: opening new screen help
; } static final String[] AndroidPhones1 = new String[] { HTC Evo 1G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally }; static final String[] AndroidPhones2 = new String[] { HTC Evo 2G, Google Nexus One, Motorola Devour, Motorola 2LIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally }; static final String[] AndroidPhones3 = new String[] { HTC Evo 3G, Google One, Motorola Devour, Motorola 2LIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; static final String[] AndroidPhones4 = new String[] { HTC Evo 4G, Google Nexus hello, Motorola Devour, Motorola 2LIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally }; } i followed your suggestion. Thanks On Oct 11, 11:41 am, Kumar Bibek coomar@gmail.com wrote: You need to set a listener to the ListView. setOnItemClickListener and launch your new screen/activity from there... On Tue, Oct 12, 2010 at 12:07 AM, Varun Khanduja varunkhand...@gmail.comwrote: Hello all, I was just wondering if someone can me understand how we can make a new screen work in a existing code. I tried this tutorial but the part which I don't understand very well is where should I put that piece of java code in my existing code. Rest of it is fairly simple. Some help please. Thanks package com.varun.HelloListView; import java.util.ArrayList; import java.util.HashMap; import android.app.ListActivity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.SimpleAdapter; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; ArrayListHashMapString, String list1 = new ArrayListHashMapString, String(); SimpleAdapter smipleAdapter1; ArrayListHashMapString, String list2 = new ArrayListHashMapString, String(); SimpleAdapter smipleAdapter2; ArrayListHashMapString, String bottom= new ArrayListHashMapString, String(); SimpleAdapter simpleAdapter3; �...@override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); smipleAdapter1 = new SimpleAdapter(this, list1, R.layout.list_item, new String[] {line1, line2}, new int[] {R.id.label1, R.id.label2}); smipleAdapter2 = new SimpleAdapter(this, list2, R.layout.list_item, new String[] {line1, line2}, new int[] {R.id.label1, R.id.label2}); //pupulate the lists addItems(); this.setListAdapter(smipleAdapter1); // button click Button next1 = (Button) findViewById(R.id.Button1); next1.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { setListAdapter(smipleAdapter1); smipleAdapter1.notifyDataSetChanged(); } } ); this.setListAdapter(smipleAdapter2); Button next2 = (Button) findViewById(R.id.Button2); next2.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { setListAdapter(smipleAdapter2); smipleAdapter2.notifyDataSetChanged(); } } ); } private void addItems() { long ts = System.currentTimeMillis(); int lastDigit = (int)( ts % 10 ); for(int i = 0; i AndroidPhones1.length; i++) { HashMapString,String item = new HashMapString,String(); item.put( line1, AndroidPhones1[i] ); item.put( line2, lastDigit: +Integer.toString( lastDigit
[android-developers] opening new screen help
Hi all, I thought of asking for some more guidance. So basically i am not able to open the a new screen from a button click. I followed some tutorials and basically they take you from scratch how to make a new page working, whereas in my case there is a part of code which is there and being a novice java learner i am sort of confused how I can make the new page working on this button click. Here are the two screenshots of the problem i am facing. I understand that my class Hellolistview is alaerdy defined but I am not able to understand what should be the replacment for that class when it comes to this error i am facing. My activity name itself is hello list view so I don't understand why this is creating problem? Should I have a different activity name than the name of the class? http://www.flickr.com/photos/34403...@n02/5073068252/in/photostream/ http://www.flickr.com/photos/34403...@n02/5073071490/in/photostream/ Here is the complete code package com.varun.HelloListView; import java.util.ArrayList; import java.util.HashMap; import android.app.Activity; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.SimpleAdapter; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; ArrayListHashMapString, String list1 = new ArrayListHashMapString, String(); SimpleAdapter smipleAdapter1; ArrayListHashMapString, String list2 = new ArrayListHashMapString, String(); SimpleAdapter smipleAdapter2; ArrayListHashMapString, String bottom= new ArrayListHashMapString, String(); SimpleAdapter simpleAdapter3; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); smipleAdapter1 = new SimpleAdapter(this, list1, R.layout.list_item, new String[] {line1, line2}, new int[] {R.id.label1, R.id.label2}); smipleAdapter2 = new SimpleAdapter(this, list2, R.layout.list_item, new String[] {line1, line2}, new int[] {R.id.label1, R.id.label2}); //pupulate the lists addItems(); this.setListAdapter(smipleAdapter1); // button click Button next1 = (Button) findViewById(R.id.Button1); next1.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { setListAdapter(smipleAdapter1); smipleAdapter1.notifyDataSetChanged(); } } ); this.setListAdapter(smipleAdapter2); Button next2 = (Button) findViewById(R.id.Button2); next2.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { setListAdapter(smipleAdapter2); smipleAdapter2.notifyDataSetChanged(); } } ); } private void addItems() { long ts = System.currentTimeMillis(); int lastDigit = (int)( ts % 10 ); for(int i = 0; i AndroidPhones1.length; i++) { HashMapString,String item = new HashMapString,String(); item.put( line1, AndroidPhones1[i] ); item.put( line2, lastDigit: +Integer.toString( lastDigit ) ); list1.add( item ); smipleAdapter1.notifyDataSetChanged(); } for(int i = 0; i AndroidPhones2.length; i++) { HashMapString,String item = new HashMapString,String(); item.put( line1, AndroidPhones2[i] ); item.put( line2, varun1 ); list2.add( item ); smipleAdapter2.notifyDataSetChanged(); } } @Override
[android-developers] Re: button placement problem
The button at the bottom of the picture in the tutorial is somethign I am trying to achieve. http://blog.maxaller.name/2010/05/attaching-a-sticky-headerfooter-to-an-android-listview/ On Oct 8, 5:33 am, TreKing treking...@gmail.com wrote: On Thu, Oct 7, 2010 at 6:13 PM, Varun Khanduja varunkhand...@gmail.comwrote: I am trying to get a button at bottom of a screen having a list view. Could you add more detail to the problem you're having and the outcome you're trying to achieve? A picture of each case would help as well if you have it. --- -- 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: second column list view not properly aligned
Option a worked. Had the width set to 100px and everything fell in line. Just curious do we normally use px, dip or sp for size declarations? On Oct 7, 5:17 am, TreKing treking...@gmail.com wrote: On Wed, Oct 6, 2010 at 11:16 PM, Varun Khanduja varunkhand...@gmail.comwrote: I have been getting opinions that I should have gone for table layout Probably, if alignment of each column was important. could someone please save me from doing the work from scratch. I really dont want to do everything again. You may have to bite the bullet and just redo it correctly. Anything you do from here is going to be mostly a hack. If you insist, two things that come to mind are to either a) figure out which two of those columns are going to be a fixed width and set them all to be that width, letting the third take up the rest, or b) programmatically calculating the width(s) and applying them uniformly to all items in the list, which begins to get complicated. Thanks and sorry for the posts. Trust me this problem is different than last one. Thanks Didn't mean to give you crap in your last post - just sometimes it seems people don't listen (or read, as the case may be). =) --- -- 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] 2 columns 2 rows list view
I am trying to make a list view having 2 columns and within these columns each element of list view is having two rows. I figured out how to get two columns, one of the column is having 2 rows perfectly but another column is not able to get the second row at all. I am not sure whats the issue, does someone minds looking at my code and suggesting possible issues? package com.varun.HelloListView; import java.util.ArrayList; import java.util.HashMap; import android.app.ListActivity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.SimpleAdapter; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; ArrayListHashMapString, String list1 = new ArrayListHashMapString, String(); SimpleAdapter smipleAdapter1; ArrayListHashMapString, String list2 = new ArrayListHashMapString, String(); SimpleAdapter smipleAdapter2; ArrayListHashMapString, Stringlist3 = new ArrayListHashMapString, String(); SimpleAdapter simpleAdapter3; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); smipleAdapter1 = new SimpleAdapter(this, list1, R.layout.list_item, new String[] {line1, line2}, new int[] {R.id.label1, R.id.label2}); smipleAdapter2 = new SimpleAdapter(this, list2, R.layout.list_item, new String[] {line1, line2}, new int[] {R.id.label1, R.id.label2}); simpleAdapter3 = new SimpleAdapter(this, list3, R.layout.list_item, new String[] {line3, line4}, new int[]{R.id.label3, R.id.label4}); //pupulate the lists addItems(); this.setListAdapter(smipleAdapter1); // button click Button next1 = (Button) findViewById(R.id.Button1); next1.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { setListAdapter(smipleAdapter1); smipleAdapter1.notifyDataSetChanged(); } } ); this.setListAdapter(smipleAdapter2); Button next2 = (Button) findViewById(R.id.Button2); next2.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { setListAdapter(smipleAdapter2); smipleAdapter2.notifyDataSetChanged(); } } ); this.setListAdapter(simpleAdapter3); Button next3 = (Button) findViewById(R.id.Button3); next3.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { setListAdapter(simpleAdapter3); simpleAdapter3.notifyDataSetChanged(); } } ); } private void addItems() { long ts = System.currentTimeMillis(); int lastDigit = (int)( ts % 10 ); for(int i = 0; i AndroidPhones1.length; i++) { HashMapString,String item = new HashMapString,String(); item.put( line1, AndroidPhones1[i] ); item.put( line2, lastDigit: +Integer.toString( lastDigit ) ); list1.add( item ); smipleAdapter1.notifyDataSetChanged(); } for(int i = 0; i AndroidPhones2.length; i++) { HashMapString,String
[android-developers] button placement problem
Hey guys, I am trying to get a button at bottom of a screen having a list view. This button is non-scrollable and the list view slips below the button if it is larger than the size of the button. Could someone please help me get the right xml properties. Tried layout_gravity and other things but it doesnt seems to be displaying. Here is the main.xml file ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent TextView android:id=@+id/textViewHello android:layout_width=fill_parent android:layout_height=wrap_content android:text=@string/hello / LinearLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal Button android:id=@+id/Button1 android:layout_height=wrap_content android:layout_width=wrap_content android:layout_alignParentLeft=true android:textSize=15sp android:typeface=monospace android:textColor=#ffFFffFF android:text=@string/Button1 /Button Button android:id=@+id/Button2 android:layout_height=wrap_content android:layout_width=wrap_content android:layout_alignParentRight=true android:textSize=15sp android:typeface=monospace android:textColor=#ffFFffFF android:text=@string/Button2 /Button Button android:id=@+id/Button3 android:layout_height=wrap_content android:layout_width=wrap_content android:layout_alignParentRight=true android:textSize=15sp android:typeface=monospace android:textColor=#ffFFffFF android:text=@string/Button3 /Button Button android:id=@+id/Button4 android:layout_height=wrap_content android:layout_width=wrap_content android:layout_alignParentRight=true android:textSize=15sp android:typeface=monospace android:textColor=#ffFFffFF android:text=@string/Button4 /Button /LinearLayout ListView android:id=@android:id/list android:layout_width=wrap_content android:layout_height=wrap_content android:drawSelectorOnTop=false / Button android:layout_width=fill_parent android:layout_height=wrap_content android:id=@+id/Button4 android:text=@string/hello android:layout_gravity=bottom android:isScrollContainer=false / /LinearLayout Here is the list xml file. ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android= http://schemas.android.com/apk/res/android; android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal ImageView android:id=@+id/icon android:layout_width=22px android:paddingLeft=2px android:paddingRight=2px android:paddingTop=2px android:layout_height=wrap_content android:src=@drawable/icon/ LinearLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=vertical TextView android:id=@+id/label1 android:layout_width=100px android:layout_height=wrap_content android:textSize=10sp/ TextView android:id=@+id/label2 android:layout_width=100px android:layout_height=wrap_content android:textSize=10sp/ /LinearLayout TextView android:id=@+id/label3 android:layout_width=100px android:layout_height=wrap_content android:layout_marginLeft=40px android:textSize=15sp android:text=hello / ImageView android:id=@+id/icon android:layout_width=22px android:paddingLeft=2px android:paddingRight=2px android:paddingTop=2px android:layout_height=wrap_content android:src=@drawable/icon android:layout_gravity=right/ /LinearLayout Thank you, Varun -- 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] list view two columns
Hello all, I am trying to see if someone can help me with a simple list view I am tying to make. I am specifically facing problem trying to introduce a new column in this list view. Label 3 in xml code below is the new column I m trying to make. Should I have a new linear layout and wrap two text views in it or is there some other option? ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android= http://schemas.android.com/apk/res/android; android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal ImageView android:id=@+id/icon android:layout_width=22px android:paddingLeft=2px android:paddingRight=2px android:paddingTop=2px android:layout_height=wrap_content android:src=@drawable/icon/ LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=vertical TextView android:id=@+id/label1 android:layout_width=wrap_content android:layout_height=wrap_content android:textSize=24sp/ TextView android:id=@+id/label2 android:layout_width=wrap_content android:layout_height=wrap_content android:textSize=24sp/ TextView android:id=@+id/label3 android:layout_height=wrap_content android:layout_width=wrap_content android:layout_toRightOf=@+id/label1 android:textColor=#ffFFffFF android:layout_marginRight=25dip android:text=score / /LinearLayout /LinearLayout -- 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] multi column list view help
Hello, I am trying to get a multiple column list view. The hello in the picture is the second column i m trying to achieve. Here is the link to picture. http://www.flickr.com/photos/34403...@n02/5057967965/ Here is my xml code, if someone can help me with xml properties for label 3 it would be quite helpful. ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android= http://schemas.android.com/apk/res/android; android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal ImageView android:id=@+id/icon android:layout_width=22px android:paddingLeft=2px android:paddingRight=2px android:paddingTop=2px android:layout_height=wrap_content android:src=@drawable/icon/ LinearLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=vertical TextView android:id=@+id/label1 android:layout_width=wrap_content android:layout_height=wrap_content android:textSize=24sp/ TextView android:id=@+id/label2 android:layout_width=wrap_content android:layout_height=wrap_content android:textSize=24sp/ TextView android:id=@+id/label3 android:layout_width=wrap_content android:layout_height=wrap_content android:textSize=24sp android:paddingLeft=200px android:text=hello / /LinearLayout /LinearLayout -- 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: multi column list view help
Ok. I just thought I should provide you with a picture since that is another thing you said might be important to show for clarity :) Thanks On Oct 6, 6:52 pm, TreKing treking...@gmail.com wrote: On Wed, Oct 6, 2010 at 6:47 PM, Varun Khanduja varunkhand...@gmail.comwrote: Here is my xml code, if someone can help me with xml properties for label 3 it would be quite helpful. As I said in your previous post: add the new TextView after the inner LinearLayout. That should be all you need. --- -- 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: multi column list view help
It's done. Thanks. Good night On Oct 6, 6:57 pm, Varun Khanduja varunkhand...@gmail.com wrote: Ok. I just thought I should provide you with a picture since that is another thing you said might be important to show for clarity :) Thanks On Oct 6, 6:52 pm, TreKing treking...@gmail.com wrote: On Wed, Oct 6, 2010 at 6:47 PM, Varun Khanduja varunkhand...@gmail.comwrote: Here is my xml code, if someone can help me with xml properties for label 3 it would be quite helpful. As I said in your previous post: add the new TextView after the inner LinearLayout. That should be all you need. --- -- 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] second column list view not properly aligned
Hello, Sorry for the redundant posts. I did get the issue of how to get second column resolved by your help. Now I am not able to understand how to get the word hello which is the second column horizontally aligned in a straight line. http://www.flickr.com/photos/34403...@n02/5058549047/ Here is my xml code ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android= http://schemas.android.com/apk/res/android; android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal ImageView android:id=@+id/icon android:layout_width=22px android:paddingLeft=2px android:paddingRight=2px android:paddingTop=2px android:layout_height=wrap_content android:src=@drawable/icon/ LinearLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=vertical TextView android:id=@+id/label1 android:layout_width=wrap_content android:layout_height=wrap_content android:textSize=10sp/ TextView android:id=@+id/label2 android:layout_width=wrap_content android:layout_height=wrap_content android:textSize=10sp/ /LinearLayout TextView android:id=@+id/label3 android:layout_width=fill_parent android:layout_height=wrap_content android:textSize=15sp android:layout_marginLeft=50px android:text=hello / /LinearLayout I have been getting opinions that I should have gone for table layout could someone please save me from doing the work from scratch. I really dont want to do everything again. Thanks and sorry for the posts. Trust me this problem is different than last one. Thanks -- 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] two lines in a row list view
Hello all, I am trying to get two lines in the same row in a list view and I looked at some things online but found it hard to apply to what I am trying to achieve. Could anyone look at my code please and suggest me how I can make it possible. Thanks package com.varun.HelloListView; import android.app.ListActivity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Adapter; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; ArrayAdapter a1=null; ArrayAdapter a2=null; ArrayAdapter a3=null; ArrayAdapter a4=null; ArrayAdapter a5=null; ArrayAdapter a6=null; ArrayAdapter a7=null; ArrayAdapter a8=null; ListActivity myActivity = null; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); a1 = new ArrayAdapter(this, R.layout.two_line_list_item, R.id.text1,AndroidPhones1); a2 = new ArrayAdapter(this, R.layout.two_line_list_item, R.id.text1,AndroidPhones2); a3 = new ArrayAdapter(this, R.layout.two_line_list_item, R.id.text1,AndroidPhones3); a4 = new ArrayAdapter(this, R.layout.two_line_list_item, R.id.text1,AndroidPhones4); a5 = new ArrayAdapter(this, R.layout.two_line_list_item, R.id.text2,line2); a6 = new ArrayAdapter(this, R.layout.two_line_list_item, R.id.text2,line2); a7 = new ArrayAdapter(this, R.layout.two_line_list_item, R.id.text2,line2); a8 = new ArrayAdapter(this, R.layout.two_line_list_item, R.id.text2,line2); setContentView(R.layout.main); setListAdapter(a1); setListAdapter(a5); myActivity = this; Button next1 = (Button) findViewById(R.id.Button1); next1.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { myActivity.setListAdapter(a1); myActivity.setListAdapter(a5); a1.notifyDataSetChanged(); a5.notifyDataSetChanged(); } } ); //setListAdapter(a2); //myActivity = this; Button next2 = (Button) findViewById(R.id.Button2); next2.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { myActivity.setListAdapter(a2); a2.notifyDataSetChanged(); } } ); //setListAdapter(a3); //myActivity = this; Button next3 = (Button) findViewById(R.id.Button3); next3.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { myActivity.setListAdapter(a3); a3.notifyDataSetChanged(); } } ); //setListAdapter(a4); //myActivity = this; Button next4 = (Button) findViewById(R.id.Button4); next4.setOnClickListener( new View.OnClickListener() { public void onClick(View view4) { myActivity.setListAdapter(a4); a4.notifyDataSetChanged(); } } ); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, Settings.ENTER_FOOD, 0, Enter Food); menu.add(0, Settings.ANALYZE_FOOD, 0, Analyze Food); menu.add(0, Settings.SETTINGS, 0, Settings); return true; } static final String[] AndroidPhones1 = new String[] { HTC Evo 1G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; static final String[] AndroidPhones2 = new String[] { HTC Evo 2G, Google Nexus One, Motorola Devour, Motorola 2LIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola
[android-developers] Re: two lines in a row list view
(); } } ); //setListAdapter(a4); //myActivity = this; Button next4 = (Button) findViewById(R.id.Button4); next4.setOnClickListener( new View.OnClickListener() { public void onClick(View view4) { myActivity.setListAdapter(a4); a4.notifyDataSetChanged(); } } ); */ } private void addItems() { long ts = System.currentTimeMillis(); int lastDigit = (int)( ts % 10 ); for(int i = 0; i AndroidPhones1.length; i++) { HashMapString,String item = new HashMapString,String(); item.put( line1, AndroidPhones1[i] ); item.put( line2, lastDigit: +Integer.toString( lastDigit ) ); list1.add( item ); smipleAdapter1.notifyDataSetChanged(); } for(int i = 0; i AndroidPhones2.length; i++) { HashMapString,String item = new HashMapString,String(); item.put( line1, AndroidPhones2[i] ); item.put( line2, lastDigit: +Integer.toString( lastDigit ) ); list2.add( item ); smipleAdapter1.notifyDataSetChanged(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, Settings.ENTER_FOOD, 0, Enter Food); menu.add(0, Settings.ANALYZE_FOOD, 0, Analyze Food); menu.add(0, Settings.SETTINGS, 0, Settings); return true; } static final String[] AndroidPhones1 = new String[] { HTC Evo 1G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; static final String[] AndroidPhones2 = new String[] { HTC Evo 2G, Google Nexus One, Motorola Devour, Motorola 2LIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; static final String[] AndroidPhones3 = new String[] { HTC Evo 3G, Google One, Motorola Devour, Motorola 2LIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; static final String[] AndroidPhones4 = new String[] { HTC Evo 4G, Google Nexus hello, Motorola Devour, Motorola 2LIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; } On Oct 5, 4:30 pm, TreKing treking...@gmail.com wrote: On Tue, Oct 5, 2010 at 3:56 PM, Varun Khanduja varunkhand...@gmail.comwrote: I am trying to get two lines in the same row in a list view and I looked at some things online but found it hard to apply to what I am trying to achieve. What are you trying to achieve? What's not working thus far? --- -- 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: two lines in a row list view
I tried to understand why there are multiple list adapters, I think the answer is my other objective is for the list views to change with click of the 4 buttons on the top. I do have the text views defined in the xml file but I can't seem to understand how is that I can have a string declared like I have Android phone 1, 2, 3 etc and display it in the second line of this text view. Thanks On Oct 5, 4:51 pm, TreKing treking...@gmail.com wrote: On Tue, Oct 5, 2010 at 6:43 PM, Varun Khanduja varunkhand...@gmail.comwrote: I am trying to make a list view with two rows and two columns in each element of the list view. The code I have so far I am trying to achieve the first task i.e. two rows inside a single list view item. OK, so far so good. I saw some online tutorial, and I formed a text view which I inflated in the java file. It works but it's not exactly what i want, I guess instead of the last digit which is displayed presently in the list view, I would like to know how to hard code text 1, text 2, text 3 etc.These text 1 , 2, 3 are basically locations. Is my description comprehensible? You lost me here. However, if you want the first part, one element of the list view with two lines, then you only really need one adapter (you seem to have multiple in your code) which returns a layout (probably linear in this simple case) containing the two text views in question. Once you have that working, it's just a matter of updating that same layout to have four text views instead of two. --- -- 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: two lines in a row list view
Although my issue is resolved now. but i m wondering if someone can help me understand if there is a way for me to pull up the present geographic location. Is there a small command or method i have to implement to have the current location as a part of text view in a list view? Thanks On Oct 5, 7:53 pm, Varun Khanduja varunkhand...@gmail.com wrote: I tried to understand why there are multiple list adapters, I think the answer is my other objective is for the list views to change with click of the 4 buttons on the top. I do have the text views defined in the xml file but I can't seem to understand how is that I can have a string declared like I have Android phone 1, 2, 3 etc and display it in the second line of this text view. Thanks On Oct 5, 4:51 pm, TreKing treking...@gmail.com wrote: On Tue, Oct 5, 2010 at 6:43 PM, Varun Khanduja varunkhand...@gmail.comwrote: I am trying to make a list view with two rows and two columns in each element of the list view. The code I have so far I am trying to achieve the first task i.e. two rows inside a single list view item. OK, so far so good. I saw some online tutorial, and I formed a text view which I inflated in the java file. It works but it's not exactly what i want, I guess instead of the last digit which is displayed presently in the list view, I would like to know how to hard code text 1, text 2, text 3 etc.These text 1 , 2, 3 are basically locations. Is my description comprehensible? You lost me here. However, if you want the first part, one element of the list view with two lines, then you only really need one adapter (you seem to have multiple in your code) which returns a layout (probably linear in this simple case) containing the two text views in question. Once you have that working, it's just a matter of updating that same layout to have four text views instead of two. --- -- 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: Weird problem with ListView
Hi John, Although I don't have solution to your problem but I am trying to learn how to make a list view similar to what you have done. I am basically not able to understand how I can get that extra line below the first line in each list item. Do you think you could share sample code or help me out? Thanks On Sep 28, 6:51 pm, John Gaby jg...@gabysoft.com wrote: I have a ListView which presents a table of items. The table is supposed to look like: http://gabytest.com/images/good.png but if I scroll around a bit, I sometimes see: http://gabytest.com/images/bug.png Now this only seems to happen when I run the program on an actual device (Motorola Droid with Android 2.2). I have never seen this happen on the emulator. Has anyone ever seen anything like this? Does anyone have any suggestions about what I might look for? Thanks. -- 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: separate views list view
, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; } On Sep 29, 1:34 pm, Olivier Goutet olivier.gou...@gmail.com wrote: I don't know if you can read French but there is a very good post on this French blog:http://android.cyrilmottier.com/?p=232 It explain how to build a custom adapter (BaseAdapter in fact) to manage 2 different types of cells on a list view. I hope the source source code will be enough for you. The ArrayAdapter you are using is just a very simple way to display text cells on a listview. To display your 4 different types of items, you will need to create 4 layout (1 for each cell type) and then inflate them in the base adapter (as explained in the blog). On Sep 29, 4:43 pm, TreKing treking...@gmail.com wrote: On Tue, Sep 28, 2010 at 8:40 PM, Varun Khanduja varunkhand...@gmail.comwrote: If anyone has time please try to help me out. Thanks, I looked into some examples but really found it hard to see how I can have the custom adapter runnning. The custom part of an adapter is basically returning the View you want to show in your list for a given item. Currently you have the default ArrayAdapter that works on Strings. Since you want something more complicated, all you have to do is create a class that extends ArrayAdapter and override the getView() method to return the layouts you want (as you described) based on the state of your list. So the first thing to do is create your custom ArrayAdapter, override getView, then set it as the adapter to your list and verify your views show up as expected. --- -- 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: separate views list view
Thank you everyone. My problem is still not solved but I am trying to do things. You guys have been of great help. -- 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] separate views list view
Hello, I was trying to see if anyone could guide me about some keywords or approach I should take to achieve a certain task on Android. I have 4 buttons, below these buttons is a list view. This list view is having 4 different formats and when the user clicks on any of the 4 buttons they get the formats they had requested. I am not sure how I can have 4 different list views. Should I declare 4 different strings or how should one go about it? Thanks -- 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: separate views list view
Hi Kumar, Thanks for the response. I think I am using custom adapter. Do you have an example or some resource where i can see how to define this method? Do you think I need on click event handlers? Was sort of confused when checking google documentation. Thanks for guidance. package com.varun.HelloListView; import android.app.ListActivity; import android.os.Bundle; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); setListAdapter(new ArrayAdapter(this, R.layout.list_item, R.id.label,AndroidPhones)); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, Settings.ENTER_FOOD, 0, Enter Food); menu.add(0, Settings.ANALYZE_FOOD, 0, Analyze Food); menu.add(0, Settings.SETTINGS, 0, Settings); return true; } static final String[] AndroidPhones = new String[] { HTC Evo 4G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; } On Sep 28, 11:29 am, Kumar Bibek coomar@gmail.com wrote: If you are using a custom adapter, you can have a method wherein you specify a method to change the format of the ListView. Through this event, you can change the dataset of the ListView and ask the list view to reload all these items. Thats should serve the purpose. -Kumar Bibekhttp://kbeanie.com On Sep 28, 11:02 pm, Varun Khanduja varunkhand...@gmail.com wrote: Hello, I was trying to see if anyone could guide me about some keywords or approach I should take to achieve a certain task on Android. I have 4 buttons, below these buttons is a list view. This list view is having 4 different formats and when the user clicks on any of the 4 buttons they get the formats they had requested. I am not sure how I can have 4 different list views. Should I declare 4 different strings or how should one go about it? Thanks -- 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: separate views list view
Sorry this may sound silly, but I am not really sure what you mean by which format I am trying to use? Thanks On Sep 28, 11:48 am, Kumar Bibek coomar@gmail.com wrote: You are using the ArrayAdapter here. You have to use a custom adapter which extends the ArrayAdapter or the BaseAdapter. Also, what format are you trying to change? If you can give me an example, I can help you with that. -Kumar Bibekhttp://techdroid.kbeanie.com On Sep 28, 11:39 pm, Varun Khanduja varunkhand...@gmail.com wrote: Hi Kumar, Thanks for the response. I think I am using custom adapter. Do you have an example or some resource where i can see how to define this method? Do you think I need on click event handlers? Was sort of confused when checking google documentation. Thanks for guidance. package com.varun.HelloListView; import android.app.ListActivity; import android.os.Bundle; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); setListAdapter(new ArrayAdapter(this, R.layout.list_item, R.id.label,AndroidPhones)); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, Settings.ENTER_FOOD, 0, Enter Food); menu.add(0, Settings.ANALYZE_FOOD, 0, Analyze Food); menu.add(0, Settings.SETTINGS, 0, Settings); return true; } static final String[] AndroidPhones = new String[] { HTC Evo 4G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; } On Sep 28, 11:29 am, Kumar Bibek coomar@gmail.com wrote: If you are using a custom adapter, you can have a method wherein you specify a method to change the format of the ListView. Through this event, you can change the dataset of the ListView and ask the list view to reload all these items. Thats should serve the purpose. -Kumar Bibekhttp://kbeanie.com On Sep 28, 11:02 pm, Varun Khanduja varunkhand...@gmail.com wrote: Hello, I was trying to see if anyone could guide me about some keywords or approach I should take to achieve a certain task on Android. I have 4 buttons, below these buttons is a list view. This list view is having 4 different formats and when the user clicks on any of the 4 buttons they get the formats they had requested. I am not sure how I can have 4 different list views. Should I declare 4 different strings or how should one go about it? Thanks -- 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: separate views list view
Ohh ok.Thanks. the format is changing in the sense that one of the format is having a header to the same list items, another format is having check boxes on left and another format is having two lines in the same row for every list item. Thanks On Sep 28, 12:32 pm, Kumar Bibek coomar@gmail.com wrote: 4 different formats and when the user clicks on any of the 4 buttons they get the formats they had requested. On Sep 29, 12:28 am, Varun Khanduja varunkhand...@gmail.com wrote: Sorry this may sound silly, but I am not really sure what you mean by which format I am trying to use? Thanks On Sep 28, 11:48 am, Kumar Bibek coomar@gmail.com wrote: You are using the ArrayAdapter here. You have to use a custom adapter which extends the ArrayAdapter or the BaseAdapter. Also, what format are you trying to change? If you can give me an example, I can help you with that. -Kumar Bibekhttp://techdroid.kbeanie.com On Sep 28, 11:39 pm, Varun Khanduja varunkhand...@gmail.com wrote: Hi Kumar, Thanks for the response. I think I am using custom adapter. Do you have an example or some resource where i can see how to define this method? Do you think I need on click event handlers? Was sort of confused when checking google documentation. Thanks for guidance. package com.varun.HelloListView; import android.app.ListActivity; import android.os.Bundle; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); setListAdapter(new ArrayAdapter(this, R.layout.list_item, R.id.label,AndroidPhones)); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, Settings.ENTER_FOOD, 0, Enter Food); menu.add(0, Settings.ANALYZE_FOOD, 0, Analyze Food); menu.add(0, Settings.SETTINGS, 0, Settings); return true; } static final String[] AndroidPhones = new String[] { HTC Evo 4G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; } On Sep 28, 11:29 am, Kumar Bibek coomar@gmail.com wrote: If you are using a custom adapter, you can have a method wherein you specify a method to change the format of the ListView. Through this event, you can change the dataset of the ListView and ask the list view to reload all these items. Thats should serve the purpose. -Kumar Bibekhttp://kbeanie.com On Sep 28, 11:02 pm, Varun Khanduja varunkhand...@gmail.com wrote: Hello, I was trying to see if anyone could guide me about some keywords or approach I should take to achieve a certain task on Android. I have 4 buttons, below these buttons is a list view. This list view is having 4 different formats and when the user clicks on any of the 4 buttons they get the formats they had requested. I am not sure how I can have 4 different list views. Should I declare 4 different strings or how should one go about it? Thanks -- 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: separate views list view
If anyone has time please try to help me out. Thanks, I looked into some examples but really found it hard to see how I can have the custom adapter runnning. Thanks On Sep 28, 12:42 pm, Varun Khanduja varunkhand...@gmail.com wrote: Ohh ok.Thanks. the format is changing in the sense that one of the format is having a header to the same list items, another format is having check boxes on left and another format is having two lines in the same row for every list item. Thanks On Sep 28, 12:32 pm, Kumar Bibek coomar@gmail.com wrote: 4 different formats and when the user clicks on any of the 4 buttons they get the formats they had requested. On Sep 29, 12:28 am, Varun Khanduja varunkhand...@gmail.com wrote: Sorry this may sound silly, but I am not really sure what you mean by which format I am trying to use? Thanks On Sep 28, 11:48 am, Kumar Bibek coomar@gmail.com wrote: You are using the ArrayAdapter here. You have to use a custom adapter which extends the ArrayAdapter or the BaseAdapter. Also, what format are you trying to change? If you can give me an example, I can help you with that. -Kumar Bibekhttp://techdroid.kbeanie.com On Sep 28, 11:39 pm, Varun Khanduja varunkhand...@gmail.com wrote: Hi Kumar, Thanks for the response. I think I am using custom adapter. Do you have an example or some resource where i can see how to define this method? Do you think I need on click event handlers? Was sort of confused when checking google documentation. Thanks for guidance. package com.varun.HelloListView; import android.app.ListActivity; import android.os.Bundle; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); setListAdapter(new ArrayAdapter(this, R.layout.list_item, R.id.label,AndroidPhones)); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, Settings.ENTER_FOOD, 0, Enter Food); menu.add(0, Settings.ANALYZE_FOOD, 0, Analyze Food); menu.add(0, Settings.SETTINGS, 0, Settings); return true; } static final String[] AndroidPhones = new String[] { HTC Evo 4G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; } On Sep 28, 11:29 am, Kumar Bibek coomar@gmail.com wrote: If you are using a custom adapter, you can have a method wherein you specify a method to change the format of the ListView. Through this event, you can change the dataset of the ListView and ask the list view to reload all these items. Thats should serve the purpose. -Kumar Bibekhttp://kbeanie.com On Sep 28, 11:02 pm, Varun Khanduja varunkhand...@gmail.com wrote: Hello, I was trying to see if anyone could guide me about some keywords or approach I should take to achieve a certain task on Android. I have 4 buttons, below these buttons is a list view. This list view is having 4 different formats and when the user clicks on any of the 4 buttons they get the formats they had requested. I am not sure how I can have 4 different list views. Should I declare 4 different strings or how should one go about it? Thanks -- 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] Android multiple heading list view
Hi, I am trying to get multiple heading in the same list view. These headings are clickable to give a different view of the same list to the user. Firstly I was sucesfull in getting one heading which was clickable on top but i am not able to get multiple headings. Any idea how I can set it right. package com.varun.HelloListView; import java.util.Arrays; import java.util.Collections; import java.util.List; import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); getListView().addHeaderView(buildHeader()); setListAdapter(new ArrayAdapter(this, R.layout.list_item, R.id.label,AndroidPhones)); selection=(TextView)findViewById(R.id.textViewHello); } public void onListItemClick(ListView parent, View v, int position,long id) { selection.setText(AndroidPhones[position]); } private View buildHeader() { Button btn=new Button(this); Button btn1=new Button(this); btn.setText(Randomize!); btn1.setText(Hello); btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { ListString list=Arrays.asList(AndroidPhones); setListAdapter(new ArrayAdapterString(HelloListView.this, android.R.layout.simple_list_item_1, list)); } }); return(btn); } static final String[] AndroidPhones = new String[] { HTC Evo 4G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; } -- 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: Android multiple heading list view
Multiple headings in my work are possibly buttons which help a list to be sorted. I am not allowed to use a tab view. So 4 buttons on top of the list view and each button having seperate view( 4 views) of the same list. On Sep 27, 12:58 pm, TreKing treking...@gmail.com wrote: On Mon, Sep 27, 2010 at 2:43 PM, Varun Khanduja varunkhand...@gmail.comwrote: I am trying to get multiple heading in the same list view. First - what do you mean my multiple headings? --- -- 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: Android multiple heading list view
Yes the contents change in the sense the icons are replaced by check boxes. Is there some resource you can suggest me which I can append to my existing code? I had been trying to use certain list view adapters but was not succesful. If you have some online resource which may be a good starting point I would appreciate the link. Searching through google with what I want has been a pain considering I am not very sure of the keywords. Thanks On Sep 27, 1:12 pm, TreKing treking...@gmail.com wrote: On Mon, Sep 27, 2010 at 3:03 PM, Varun Khanduja varunkhand...@gmail.comwrote: Multiple headings in my work are possibly buttons which help a list to be sorted. OK. You probably just need a custom view that has your 4 buttons and set that as the header. So 4 buttons on top of the list view and each button having seperate view( 4 views) of the same list. Are you saying on clicking the buttons the list view contents will change? --- -- 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: Android multiple heading list view
Thanks a lot Mr King. I was in Chicago last week for design 4 mobile conference, is there by any chance you were one of the attendee's? On Sep 27, 1:32 pm, TreKing treking...@gmail.com wrote: On Mon, Sep 27, 2010 at 3:25 PM, Varun Khanduja varunkhand...@gmail.comwrote: Yes the contents change in the sense the icons are replaced by check boxes. You could accomplish this by either tracking the current state in the adapter and having it return the correct view, or swapping out the adapters completely, depending on how different your multiple states are from a UI perspective. Is there some resource you can suggest me which I can append to my existing code? Not really, but I would look at the documentation and samples for customizing a list view adapter and having it return the appropriate view. Post back with more specific questions if you get stuck. --- -- 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: Android multiple heading list view
Here is something i have been attempting but failing. I am trying to declare two seperate buttons but only one of the buttons comes visible. I m sure my programming inepxereince is causing these silly errors but some guidance would be helpful. package com.varun.HelloListView; import java.util.Arrays; import java.util.Collections; import java.util.List; import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); getListView().addHeaderView(buildHeader()); setListAdapter(new ArrayAdapter(this, R.layout.list_item, R.id.label,AndroidPhones)); selection=(TextView)findViewById(R.id.textViewHello); } public void onListItemClick(ListView parent, View v, int position,long id) { selection.setText(AndroidPhones[position]); } private View buildHeader() { Button btn=new Button(this); btn.setText(Randomize!); btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { ListString list=Arrays.asList(AndroidPhones); setListAdapter(new ArrayAdapterString(HelloListView.this, android.R.layout.simple_list_item_1, list)); } }); return(btn); } private View buildHeader2() { Button btn1=new Button(this); btn1.setText(Hello); btn1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { ListString list=Arrays.asList(AndroidPhones); setListAdapter(new ArrayAdapterString(HelloListView.this, android.R.layout.simple_list_item_1, list)); } }); return(btn1); } static final String[] AndroidPhones = new String[] { HTC Evo 4G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; } On Sep 27, 2:01 pm, TreKing treking...@gmail.com wrote: On Mon, Sep 27, 2010 at 3:47 PM, Varun Khanduja varunkhand...@gmail.comwrote: Thanks a lot Mr King. LOL, I like that :-P I was in Chicago last week for design 4 mobile conference, is there by any chance you were one of the attendee's? Nope - was not even aware. I should probably keep with this kind of stuff ... --- -- 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: Android multiple heading list view
Thank you. i think I sort of got the results but I am probably not able to understand which property I should modify in the main.xml file to get the buttons properly aligned on the top. I am presently getting the 4 buttons but after several attempts of changing properties in xml file either they come vertically aligned or some other distortion happens. I am trying to make them equally sized with horizontal alignment. Help would be highly appreciated. Thanks Here is how i modified the java code. package com.varun.HelloListView; import java.util.Arrays; import java.util.Collections; import java.util.List; import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); setListAdapter(new ArrayAdapter(this, R.layout.list_item, R.id.label,AndroidPhones)); } static final String[] AndroidPhones = new String[] { HTC Evo 4G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; } Here is my main.xml code where the buttons are declared, ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent TextView android:id=@+id/textViewHello android:layout_width=fill_parent android:layout_height=wrap_content android:text=@string/hello / Button android:id=@+id/button_previous android:layout_height=wrap_content android:layout_width=110px android:layout_alignParentLeft=true android:textSize=15sp android:typeface=monospace android:textColor=#ffFFffFF android:text=@string/PreviousButton /Button Button android:id=@+id/button_next android:layout_height=wrap_content android:layout_width=110px android:layout_alignParentRight=true android:textSize=15sp android:typeface=monospace android:textColor=#ffFFffFF android:text=@string/NextButton /Button ListView android:id=@android:id/list android:layout_width=fill_parent android:layout_height=fill_parent android:drawSelectorOnTop=false / /LinearLayout On Sep 27, 2:23 pm, TreKing treking...@gmail.com wrote: On Mon, Sep 27, 2010 at 4:15 PM, Varun Khanduja varunkhand...@gmail.comwrote: I am trying to declare two seperate buttons but only one of the buttons comes visible. ListView takes one header view, AFAIK. Each function you have there returns one button. Assuming you're calling listView.setHeader(buildHeader()) then listView.setHeader(buildHeader2()), then the second call will overwrite the first. You should create a linear or relative layout that contains both buttons then set THAT as the header view. --- -- 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: Android multiple heading list view
It's done. Sorry it took hours to figure out how I can have some buttons along with the linear layout. Thanks again Mr King. lols. I wish how to address you :) On Sep 27, 4:50 pm, Varun Khanduja varunkhand...@gmail.com wrote: Thank you. i think I sort of got the results but I am probably not able to understand which property I should modify in the main.xml file to get the buttons properly aligned on the top. I am presently getting the 4 buttons but after several attempts of changing properties in xml file either they come vertically aligned or some other distortion happens. I am trying to make them equally sized with horizontal alignment. Help would be highly appreciated. Thanks Here is how i modified the java code. package com.varun.HelloListView; import java.util.Arrays; import java.util.Collections; import java.util.List; import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; public class HelloListView extends ListActivity { TextView selection; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); setListAdapter(new ArrayAdapter(this, R.layout.list_item, R.id.label,AndroidPhones)); } static final String[] AndroidPhones = new String[] { HTC Evo 4G, Google Nexus One, Motorola Devour, Motorola CLIQ, Samsung Galaxy S, Motorola Droid, myTouch 3G Slide, Droid Eris, Motorola Backflip, Motorola i1, HTC Hero, myTouch 3G Fender, HTC Droid Incredible, Samsung Moment, LG Ally , }; } Here is my main.xml code where the buttons are declared, ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent TextView android:id=@+id/textViewHello android:layout_width=fill_parent android:layout_height=wrap_content android:text=@string/hello / Button android:id=@+id/button_previous android:layout_height=wrap_content android:layout_width=110px android:layout_alignParentLeft=true android:textSize=15sp android:typeface=monospace android:textColor=#ffFFffFF android:text=@string/PreviousButton /Button Button android:id=@+id/button_next android:layout_height=wrap_content android:layout_width=110px android:layout_alignParentRight=true android:textSize=15sp android:typeface=monospace android:textColor=#ffFFffFF android:text=@string/NextButton /Button ListView android:id=@android:id/list android:layout_width=fill_parent android:layout_height=fill_parent android:drawSelectorOnTop=false / /LinearLayout On Sep 27, 2:23 pm, TreKing treking...@gmail.com wrote: On Mon, Sep 27, 2010 at 4:15 PM, Varun Khanduja varunkhand...@gmail.comwrote: I am trying to declare two seperate buttons but only one of the buttons comes visible. ListView takes one header view, AFAIK. Each function you have there returns one button. Assuming you're calling listView.setHeader(buildHeader()) then listView.setHeader(buildHeader2()), then the second call will overwrite the first. You should create a linear or relative layout that contains both buttons then set THAT as the header view. --- -- 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] Table layout or list view?
Hello, I am looking for some opinion and advice from the group members will be very helpful. I have a page having tab view, in this tab view every tab is having certain number of rows, these rows are categorized with a heading. Now these number of rows could be variable. Is it best to direct my resources towards using list view for such a page or table layout is the approach which will be most efficient. Thank you -- 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