[android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Hello

The getView() call for arrayadapter is blank.  Is there a document
which describes how it works?

I have overridden it in order to change the text color of items in a
list view.  So far, I can't find any code which works.

I've tried this:

public class MyAdapterT extends ArrayAdapterT {

public MyAdapter(Context context, int textViewResourceId, T[] objects) {
super(context, textViewResourceId, objects);
}
// context, int, T[]

@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View row;
row = super.getView(position, convertView, parent);
TextView text;
text = (TextView) row.findViewById(R.id.listView1);
text.setTextColor(0x64788e);
return row;
}
}


I don't know if I am supposed to call getView in the main code or not,
but this will most certain crash the app.
The super.getView call seems to get a row in the list.  It seems  that
you then need to get the view associated with that row.  I have no
idea how to do that. I don't have resource id's for the individual row
items.  Here, I tried to use the  resource id of the list itself.
There is not a View.getChild() like call.
-- 
John F. Davis

独树一帜

-- 
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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Kostya Vasilyev
1:

http://developer.android.com/reference/android/widget/Adapter.html#getView(int,
android.view.View, android.view.ViewGroup)

2:

Yes, you're supposed to call the base class in your case, the ArrayAdapter
will be doing most of the work for you, inflating new or reusing existing
row layouts.

3:

Use view ids that are relevant to (used inside) your actual row item layout.

I very much doubt that R.id.listView1 is it.

4:

view.findViewById() is the getChild call you're looking for, using an id to
locate the view. Use correct id value and it should work.

-- Kostya

5 января 2012 г. 20:31 пользователь John Davis davi...@gmail.com написал:

 Hello

 The getView() call for arrayadapter is blank.  Is there a document
 which describes how it works?

 I have overridden it in order to change the text color of items in a
 list view.  So far, I can't find any code which works.

 I've tried this:

 public class MyAdapterT extends ArrayAdapterT {

public MyAdapter(Context context, int textViewResourceId, T[]
 objects) {
super(context, textViewResourceId, objects);
}
// context, int, T[]

@Override
public View getView(int position, View convertView, ViewGroup
 parent) {
// TODO Auto-generated method stub
View row;
row = super.getView(position, convertView, parent);
TextView text;
text = (TextView) row.findViewById(R.id.listView1);
text.setTextColor(0x64788e);
return row;
}
 }


 I don't know if I am supposed to call getView in the main code or not,
 but this will most certain crash the app.
 The super.getView call seems to get a row in the list.  It seems  that
 you then need to get the view associated with that row.  I have no
 idea how to do that. I don't have resource id's for the individual row
 items.  Here, I tried to use the  resource id of the list itself.
 There is not a View.getChild() like call.
 --
 John F. Davis

 独树一帜

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

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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread TreKing
2012/1/5 John Davis davi...@gmail.com

 The getView() call for arrayadapter is blank.  Is there a document which
 describes how it works?


The docs are your friend:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List4.html


 I don't know if I am supposed to call getView in the main code or not


You're not.

but this will most certain crash the app.


When this happens, debug your app.


 The super.getView call seems to get a row in the list.


Nope.


 It seems  that you then need to get the view associated with that row.


Yup.


 I have no idea how to do that.


You make it or re-use convertView.


 I don't have resource id's for the individual row items.


You should, it's your project.


 Here, I tried to use the  resource id of the list itself.


That makes no sense.


  There is not a View.getChild() like call.


I don't know what that means.

-
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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Hello Kostya,

Thanks for the reply.

On Thu, Jan 5, 2012 at 11:39 AM, Kostya Vasilyev kmans...@gmail.com wrote:

 2:

 Yes, you're supposed to call the base class in your case, the ArrayAdapter
 will be doing most of the work for you, inflating new or reusing existing
 row layouts.

Ok. I think I am doing what you say.


 3:

 Use view ids that are relevant to (used inside) your actual row item layout.

 I very much doubt that R.id.listView1 is it.

The listview is created using that id.  I did not create any resources
for the individual items. I don't know how to do that.  The example
code I used simply created a listview in xml.


 4:

 view.findViewById() is the getChild call you're looking for, using an id to
 locate the view. Use correct id value and it should work.

Super. I am glad you confimed I need ot do that.  However, as I said,
I don't know what would be the id of the row items since they are not
defined.


 -- Kostya

 5 января 2012 г. 20:31 пользователь John Davis davi...@gmail.com написал:

 Hello

 The getView() call for arrayadapter is blank.  Is there a document
 which describes how it works?

 I have overridden it in order to change the text color of items in a
 list view.  So far, I can't find any code which works.

 I've tried this:

 public class MyAdapterT extends ArrayAdapterT {

        public MyAdapter(Context context, int textViewResourceId, T[]
 objects) {
                super(context, textViewResourceId, objects);
        }
        // context, int, T[]

        @Override
        public View getView(int position, View convertView, ViewGroup
 parent) {
                // TODO Auto-generated method stub
                View row;
            row = super.getView(position, convertView, parent);
            TextView text;
            text = (TextView) row.findViewById(R.id.listView1);
            text.setTextColor(0x64788e);
                return row;
        }
 }


 I don't know if I am supposed to call getView in the main code or not,
 but this will most certain crash the app.
 The super.getView call seems to get a row in the list.  It seems  that
 you then need to get the view associated with that row.  I have no
 idea how to do that. I don't have resource id's for the individual row
 items.  Here, I tried to use the  resource id of the list itself.
 There is not a View.getChild() like call.
 --
 John F. Davis

 独树一帜

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


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



-- 
John F. Davis

独树一帜

-- 
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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Hello

 I don't have resource id's for the individual row items.


 You should, it's your project.



Super. That might help, but this example
http://developer.android.com/resources/tutorials/views/hello-listview.html
does not use id's for the individual list items.  How would I do that?

John

-- 
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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Kostya Vasilyev
Just to clarify 2:

I meant calling super.getView from your adapter's getView, assuming it's  a
subclass of ArrayAdapter.

Do not call adapter.getView from outside the adapter's code, that's
meaningless.

Now the view ids What layout id do you use to initialize the adapter?
Perhaps android.R.layout.something?

A side note: my suggestions here are just to patch up things based on the
route you've already headed down (using ArrayAdapter).

One day, as your knowledge grows, you'll want to throw away the
three-wheeled bicycle (ArrayAdapter) and create your own, perhaps by
extending BaseAdapter.

-- Kostya

5 января 2012 г. 20:47 пользователь John Davis davi...@gmail.com написал:

 Hello Kostya,

 Thanks for the reply.

 On Thu, Jan 5, 2012 at 11:39 AM, Kostya Vasilyev kmans...@gmail.com
 wrote:
 
  2:
 
  Yes, you're supposed to call the base class in your case, the
 ArrayAdapter
  will be doing most of the work for you, inflating new or reusing existing
  row layouts.

 Ok. I think I am doing what you say.

 
  3:
 
  Use view ids that are relevant to (used inside) your actual row item
 layout.
 
  I very much doubt that R.id.listView1 is it.

 The listview is created using that id.  I did not create any resources
 for the individual items. I don't know how to do that.  The example
 code I used simply created a listview in xml.

 
  4:
 
  view.findViewById() is the getChild call you're looking for, using an id
 to
  locate the view. Use correct id value and it should work.

 Super. I am glad you confimed I need ot do that.  However, as I said,
 I don't know what would be the id of the row items since they are not
 defined.

 
  -- Kostya
 
  5 января 2012 г. 20:31 пользователь John Davis davi...@gmail.com
 написал:
 
  Hello
 
  The getView() call for arrayadapter is blank.  Is there a document
  which describes how it works?
 
  I have overridden it in order to change the text color of items in a
  list view.  So far, I can't find any code which works.
 
  I've tried this:
 
  public class MyAdapterT extends ArrayAdapterT {
 
 public MyAdapter(Context context, int textViewResourceId, T[]
  objects) {
 super(context, textViewResourceId, objects);
 }
 // context, int, T[]
 
 @Override
 public View getView(int position, View convertView, ViewGroup
  parent) {
 // TODO Auto-generated method stub
 View row;
 row = super.getView(position, convertView, parent);
 TextView text;
 text = (TextView) row.findViewById(R.id.listView1);
 text.setTextColor(0x64788e);
 return row;
 }
  }
 
 
  I don't know if I am supposed to call getView in the main code or not,
  but this will most certain crash the app.
  The super.getView call seems to get a row in the list.  It seems  that
  you then need to get the view associated with that row.  I have no
  idea how to do that. I don't have resource id's for the individual row
  items.  Here, I tried to use the  resource id of the list itself.
  There is not a View.getChild() like call.
  --
  John F. Davis
 
  独树一帜
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to
 android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en



 --
 John F. Davis

 独树一帜

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


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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread TreKing
On Thu, Jan 5, 2012 at 10:49 AM, John Davis davi...@gmail.com wrote:

 Super. That might help, but this example
 http://developer.android.com/resources/tutorials/views/hello-listview.html
 does not use id's for the individual list items.  How would I do that?


http://developer.android.com/guide/topics/ui/declaring-layout.html

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

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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Hello

On Thu, Jan 5, 2012 at 11:53 AM, Kostya Vasilyev kmans...@gmail.com wrote:
 Just to clarify 2:

 I meant calling super.getView from your adapter's getView, assuming it's  a
 subclass of ArrayAdapter.

 Do not call adapter.getView from outside the adapter's code, that's
 meaningless.

That makes sense. Thanks.


 Now the view ids What layout id do you use to initialize the adapter?
 Perhaps android.R.layout.something?

I did :
MyAdapterString adapter = new
MyAdapterString(this,android.R.layout.simple_list_item_1, values);


 A side note: my suggestions here are just to patch up things based on the
 route you've already headed down (using ArrayAdapter).


For what it is worth, I can do this:
 public View getView(int position, View convertView, ViewGroup parent) {
 TextView text = new TextView(getContext());
 text.setText(Hi, I am position  + position);
 text.setTextColor(Color.parseColor(#64788e));
 return  text;
}
That will set the text color to blue, but it will also change the text
I put in the list.


 One day, as your knowledge grows, you'll want to throw away the
 three-wheeled bicycle (ArrayAdapter) and create your own, perhaps by
 extending BaseAdapter.



Is this example
http://developer.android.com/resources/tutorials/views/hello-listview.html
impossible to manipulate the color of individual list items?  Or, is
there a way to patch up this code to do what I want?  It seems pretty
trivial to do. I don't understand why the hooks do not exist for what
i want to do.
 -- Kostya

 5 января 2012 г. 20:47 пользователь John Davis davi...@gmail.com написал:

 Hello Kostya,

 Thanks for the reply.

 On Thu, Jan 5, 2012 at 11:39 AM, Kostya Vasilyev kmans...@gmail.com
 wrote:
 
  2:
 
  Yes, you're supposed to call the base class in your case, the
  ArrayAdapter
  will be doing most of the work for you, inflating new or reusing
  existing
  row layouts.

 Ok. I think I am doing what you say.

 
  3:
 
  Use view ids that are relevant to (used inside) your actual row item
  layout.
 
  I very much doubt that R.id.listView1 is it.

 The listview is created using that id.  I did not create any resources
 for the individual items. I don't know how to do that.  The example
 code I used simply created a listview in xml.

 
  4:
 
  view.findViewById() is the getChild call you're looking for, using an id
  to
  locate the view. Use correct id value and it should work.

 Super. I am glad you confimed I need ot do that.  However, as I said,
 I don't know what would be the id of the row items since they are not
 defined.

 
  -- Kostya
 
  5 января 2012 г. 20:31 пользователь John Davis davi...@gmail.com
  написал:
 
  Hello
 
  The getView() call for arrayadapter is blank.  Is there a document
  which describes how it works?
 
  I have overridden it in order to change the text color of items in a
  list view.  So far, I can't find any code which works.
 
  I've tried this:
 
  public class MyAdapterT extends ArrayAdapterT {
 
         public MyAdapter(Context context, int textViewResourceId, T[]
  objects) {
                 super(context, textViewResourceId, objects);
         }
         // context, int, T[]
 
         @Override
         public View getView(int position, View convertView, ViewGroup
  parent) {
                 // TODO Auto-generated method stub
                 View row;
             row = super.getView(position, convertView, parent);
             TextView text;
             text = (TextView) row.findViewById(R.id.listView1);
             text.setTextColor(0x64788e);
                 return row;
         }
  }
 
 
  I don't know if I am supposed to call getView in the main code or not,
  but this will most certain crash the app.
  The super.getView call seems to get a row in the list.  It seems  that
  you then need to get the view associated with that row.  I have no
  idea how to do that. I don't have resource id's for the individual row
  items.  Here, I tried to use the  resource id of the list itself.
  There is not a View.getChild() like call.
  --
  John F. Davis
 
  独树一帜
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to
  android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en



 --
 John F. Davis

 独树一帜

 --
 You received this message because you are subscribed to the 

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Mark Murphy
On Thu, Jan 5, 2012 at 12:04 PM, John Davis davi...@gmail.com wrote:
 Now the view ids What layout id do you use to initialize the adapter?
 Perhaps android.R.layout.something?

 I did :
                MyAdapterString adapter = new
 MyAdapterString(this,android.R.layout.simple_list_item_1, values);

You will notice that this is android.R.layout.simple_list_item_1. You
did not write this layout. Usually, if you are going to go to the
trouble of overriding getView(), you will use your own layout file for
the rows, so you have greater control. For example, if you use your
own layout file for the rows, then you are the one responsible for
setting your own view IDs.

 For what it is worth, I can do this:
         public View getView(int position, View convertView, ViewGroup parent) 
 {
         TextView text = new TextView(getContext());
         text.setText(Hi, I am position  + position);
         text.setTextColor(Color.parseColor(#64788e));
         return  text;
        }
 That will set the text color to blue, but it will also change the text
 I put in the list.

You are welcome to replace Hi, I am position  + position with your
actual data associated with that position. In this case, you are
telling Android not to bother inflating
android.R.layout.simple_list_item_1, but instead set the rows to be
what you are specifying here.

This is all covered in that excerpt that I linked to in the previous thread:

http://commonsware.com/Android/excerpt.pdf

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 
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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread TreKing
On Thu, Jan 5, 2012 at 11:04 AM, John Davis davi...@gmail.com wrote:

 Or, is there a way to patch up this code to do what I want?


Yes.


 It seems pretty trivial to do.


It is once you get the hang of it.


  I don't understand why the hooks do not exist for what i want to do.


They do, but your hanging the wrong things on the hooks =).



Here's the general process for binding your data to a list view.

Create a custom class that is your data model that will be represented in
your UI. It has the properties you care about displaying in the list. In
this case, the text and color.

class MyType
{
 String Text;
 int Color;
}

Your ListAdapter is typed using your custom class.

ArrayAdapterMyType adapter = new ArrayAdapterMyType();

Then in your getView():

MyType selection = getItem(position);
CustomViewToReturn view = convertview != null convertView :
inflateFromXML(my_view_layout);
populateViewWithSelection(selection, view); // Set text and color on the
view using your object's state
return 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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Kostya Vasilyev
Aha!

android.R.layout.simple_list_item_1 is defined in the platform, you can
find it under your Android sdk
directory/platforms/platform-version/data/res/layout (that data/res is
very useful to look up things):

The whole layout is a TextView, and its id is @android:id/text1, which,
on the Java side of things, is android.R.id.text1.

So you'd do something like.

   @Override
   public View getView(int position, View convertView, ViewGroup
parent) {
   View row = super.getView(position, convertView, parent);
*   TextView text = (TextView) row.findViewById(android.R.id.text1);
*   text.setTextColor(0x64788e);
   return row;
   }

Or just this, knowing that the layout is just one TextView:

*TextView text = (TextView) row;*

The direct typecast should work for the hello-listview sample, as that also
uses a row layout containing a single TextView with no children (and no id,
so findViewById won't work here).

-- Kostya

5 января 2012 г. 21:04 пользователь John Davis davi...@gmail.com написал:

 Hello

 On Thu, Jan 5, 2012 at 11:53 AM, Kostya Vasilyev kmans...@gmail.com
 wrote:
  Just to clarify 2:
 
  I meant calling super.getView from your adapter's getView, assuming it's
  a
  subclass of ArrayAdapter.
 
  Do not call adapter.getView from outside the adapter's code, that's
  meaningless.

 That makes sense. Thanks.

 
  Now the view ids What layout id do you use to initialize the adapter?
  Perhaps android.R.layout.something?

 I did :
MyAdapterString adapter = new
 MyAdapterString(this,android.R.layout.simple_list_item_1, values);

 
  A side note: my suggestions here are just to patch up things based on the
  route you've already headed down (using ArrayAdapter).


 For what it is worth, I can do this:
  public View getView(int position, View convertView, ViewGroup
 parent) {
  TextView text = new TextView(getContext());
 text.setText(Hi, I am position  + position);
 text.setTextColor(Color.parseColor(#64788e));
 return  text;
}
 That will set the text color to blue, but it will also change the text
 I put in the list.

 
  One day, as your knowledge grows, you'll want to throw away the
  three-wheeled bicycle (ArrayAdapter) and create your own, perhaps by
  extending BaseAdapter.
 


 Is this example
 http://developer.android.com/resources/tutorials/views/hello-listview.html
 impossible to manipulate the color of individual list items?  Or, is
 there a way to patch up this code to do what I want?  It seems pretty
 trivial to do. I don't understand why the hooks do not exist for what
 i want to do.
  -- Kostya
 
  5 января 2012 г. 20:47 пользователь John Davis davi...@gmail.com
 написал:
 
  Hello Kostya,
 
  Thanks for the reply.
 
  On Thu, Jan 5, 2012 at 11:39 AM, Kostya Vasilyev kmans...@gmail.com
  wrote:
  
   2:
  
   Yes, you're supposed to call the base class in your case, the
   ArrayAdapter
   will be doing most of the work for you, inflating new or reusing
   existing
   row layouts.
 
  Ok. I think I am doing what you say.
 
  
   3:
  
   Use view ids that are relevant to (used inside) your actual row item
   layout.
  
   I very much doubt that R.id.listView1 is it.
 
  The listview is created using that id.  I did not create any resources
  for the individual items. I don't know how to do that.  The example
  code I used simply created a listview in xml.
 
  
   4:
  
   view.findViewById() is the getChild call you're looking for, using an
 id
   to
   locate the view. Use correct id value and it should work.
 
  Super. I am glad you confimed I need ot do that.  However, as I said,
  I don't know what would be the id of the row items since they are not
  defined.
 
  
   -- Kostya
  
   5 января 2012 г. 20:31 пользователь John Davis davi...@gmail.com
   написал:
  
   Hello
  
   The getView() call for arrayadapter is blank.  Is there a document
   which describes how it works?
  
   I have overridden it in order to change the text color of items in a
   list view.  So far, I can't find any code which works.
  
   I've tried this:
  
   public class MyAdapterT extends ArrayAdapterT {
  
  public MyAdapter(Context context, int textViewResourceId, T[]
   objects) {
  super(context, textViewResourceId, objects);
  }
  // context, int, T[]
  
  @Override
  public View getView(int position, View convertView, ViewGroup
   parent) {
  // TODO Auto-generated method stub
  View row;
  row = super.getView(position, convertView, parent);
  TextView text;
  text = (TextView) row.findViewById(R.id.listView1);
  text.setTextColor(0x64788e);
  return row;
  }
   }
  
  
   I don't know if I am supposed to call getView in the main code or
 not,
   but this will most certain crash the app.
   The super.getView call seems to get a 

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Kostya,

Tip of the hat to you.  That worked.  It will set all the items to
blue text. I appreciate your help a lot.

Now, is there a simple way to do this selectively?  I saw you could
tag items and then look based upon a tag.  Perhaps that will work?  I
would prefer that the class which creates the array adapter and list
view set the tag for the color and the array adapter to draw the line
items in blue or red based upon this tag.

John

On Thu, Jan 5, 2012 at 12:13 PM, Kostya Vasilyev kmans...@gmail.com wrote:
 Aha!

 android.R.layout.simple_list_item_1 is defined in the platform, you can find
 it under your Android sdk
 directory/platforms/platform-version/data/res/layout (that data/res is
 very useful to look up things):

 The whole layout is a TextView, and its id is @android:id/text1, which, on
 the Java side of things, is android.R.id.text1.

 So you'd do something like.

        @Override
        public View getView(int position, View convertView, ViewGroup parent)
 {
                View row = super.getView(position, convertView, parent);
            TextView text = (TextView) row.findViewById(android.R.id.text1);
            text.setTextColor(0x64788e);
                return row;
        }

 Or just this, knowing that the layout is just one TextView:

 TextView text = (TextView) row;

 The direct typecast should work for the hello-listview sample, as that also
 uses a row layout containing a single TextView with no children (and no id,
 so findViewById won't work here).

 -- Kostya

 5 января 2012 г. 21:04 пользователь John Davis davi...@gmail.com написал:

 Hello

 On Thu, Jan 5, 2012 at 11:53 AM, Kostya Vasilyev kmans...@gmail.com
 wrote:
  Just to clarify 2:
 
  I meant calling super.getView from your adapter's getView, assuming it's
   a
  subclass of ArrayAdapter.
 
  Do not call adapter.getView from outside the adapter's code, that's
  meaningless.

 That makes sense. Thanks.

 
  Now the view ids What layout id do you use to initialize the
  adapter?
  Perhaps android.R.layout.something?

 I did :
                MyAdapterString adapter = new
 MyAdapterString(this,android.R.layout.simple_list_item_1, values);

 
  A side note: my suggestions here are just to patch up things based on
  the
  route you've already headed down (using ArrayAdapter).


 For what it is worth, I can do this:
         public View getView(int position, View convertView, ViewGroup
 parent) {
         TextView text = new TextView(getContext());
         text.setText(Hi, I am position  + position);
         text.setTextColor(Color.parseColor(#64788e));
         return  text;
        }
 That will set the text color to blue, but it will also change the text
 I put in the list.

 
  One day, as your knowledge grows, you'll want to throw away the
  three-wheeled bicycle (ArrayAdapter) and create your own, perhaps by
  extending BaseAdapter.
 


 Is this example
 http://developer.android.com/resources/tutorials/views/hello-listview.html
 impossible to manipulate the color of individual list items?  Or, is
 there a way to patch up this code to do what I want?  It seems pretty
 trivial to do. I don't understand why the hooks do not exist for what
 i want to do.
  -- Kostya
 
  5 января 2012 г. 20:47 пользователь John Davis davi...@gmail.com
  написал:
 
  Hello Kostya,
 
  Thanks for the reply.
 
  On Thu, Jan 5, 2012 at 11:39 AM, Kostya Vasilyev kmans...@gmail.com
  wrote:
  
   2:
  
   Yes, you're supposed to call the base class in your case, the
   ArrayAdapter
   will be doing most of the work for you, inflating new or reusing
   existing
   row layouts.
 
  Ok. I think I am doing what you say.
 
  
   3:
  
   Use view ids that are relevant to (used inside) your actual row item
   layout.
  
   I very much doubt that R.id.listView1 is it.
 
  The listview is created using that id.  I did not create any resources
  for the individual items. I don't know how to do that.  The example
  code I used simply created a listview in xml.
 
  
   4:
  
   view.findViewById() is the getChild call you're looking for, using an
   id
   to
   locate the view. Use correct id value and it should work.
 
  Super. I am glad you confimed I need ot do that.  However, as I said,
  I don't know what would be the id of the row items since they are not
  defined.
 
  
   -- Kostya
  
   5 января 2012 г. 20:31 пользователь John Davis davi...@gmail.com
   написал:
  
   Hello
  
   The getView() call for arrayadapter is blank.  Is there a document
   which describes how it works?
  
   I have overridden it in order to change the text color of items in a
   list view.  So far, I can't find any code which works.
  
   I've tried this:
  
   public class MyAdapterT extends ArrayAdapterT {
  
          public MyAdapter(Context context, int textViewResourceId, T[]
   objects) {
                  super(context, textViewResourceId, objects);
          }
          // context, int, T[]
  
          @Override
          public View getView(int 

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Kostya Vasilyev
Ok, great.

One simple thing you can do is to check the item's position, e.g. set odd
items to blue and even items to red (just to pick an example).

Beyond that, consider creating a proper data item class.

The adapter's getView would then examine the data item at the requested
position and make the decision on how to present it, based on its field
values (e.g. names starting with A are red, starting with B are green,
the rest are blue).

Also consider extending BaseAdapter rather than ArrayAdapter - it's just a
little bit more work, but should really clarify things for you.

The links posted by TreKing are Mark are good.

-- Kostya

5 января 2012 г. 21:31 пользователь John Davis davi...@gmail.com написал:

 Kostya,

 Tip of the hat to you.  That worked.  It will set all the items to
 blue text. I appreciate your help a lot.

 Now, is there a simple way to do this selectively?  I saw you could
 tag items and then look based upon a tag.  Perhaps that will work?  I
 would prefer that the class which creates the array adapter and list
 view set the tag for the color and the array adapter to draw the line
 items in blue or red based upon this tag.

 John

 On Thu, Jan 5, 2012 at 12:13 PM, Kostya Vasilyev kmans...@gmail.com
 wrote:
  Aha!
 
  android.R.layout.simple_list_item_1 is defined in the platform, you can
 find
  it under your Android sdk
  directory/platforms/platform-version/data/res/layout (that data/res is
  very useful to look up things):
 
  The whole layout is a TextView, and its id is @android:id/text1,
 which, on
  the Java side of things, is android.R.id.text1.
 
  So you'd do something like.
 
 @Override
 public View getView(int position, View convertView, ViewGroup
 parent)
  {
 View row = super.getView(position, convertView, parent);
 TextView text = (TextView)
 row.findViewById(android.R.id.text1);
 text.setTextColor(0x64788e);
 return row;
 }
 
  Or just this, knowing that the layout is just one TextView:
 
  TextView text = (TextView) row;
 
  The direct typecast should work for the hello-listview sample, as that
 also
  uses a row layout containing a single TextView with no children (and no
 id,
  so findViewById won't work here).
 
  -- Kostya
 
  5 января 2012 г. 21:04 пользователь John Davis davi...@gmail.com
 написал:
 
  Hello
 
  On Thu, Jan 5, 2012 at 11:53 AM, Kostya Vasilyev kmans...@gmail.com
  wrote:
   Just to clarify 2:
  
   I meant calling super.getView from your adapter's getView, assuming
 it's
a
   subclass of ArrayAdapter.
  
   Do not call adapter.getView from outside the adapter's code, that's
   meaningless.
 
  That makes sense. Thanks.
 
  
   Now the view ids What layout id do you use to initialize the
   adapter?
   Perhaps android.R.layout.something?
 
  I did :
 MyAdapterString adapter = new
  MyAdapterString(this,android.R.layout.simple_list_item_1, values);
 
  
   A side note: my suggestions here are just to patch up things based on
   the
   route you've already headed down (using ArrayAdapter).
 
 
  For what it is worth, I can do this:
  public View getView(int position, View convertView, ViewGroup
  parent) {
  TextView text = new TextView(getContext());
  text.setText(Hi, I am position  + position);
  text.setTextColor(Color.parseColor(#64788e));
  return  text;
 }
  That will set the text color to blue, but it will also change the text
  I put in the list.
 
  
   One day, as your knowledge grows, you'll want to throw away the
   three-wheeled bicycle (ArrayAdapter) and create your own, perhaps by
   extending BaseAdapter.
  
 
 
  Is this example
 
 http://developer.android.com/resources/tutorials/views/hello-listview.html
  impossible to manipulate the color of individual list items?  Or, is
  there a way to patch up this code to do what I want?  It seems pretty
  trivial to do. I don't understand why the hooks do not exist for what
  i want to do.
   -- Kostya
  
   5 января 2012 г. 20:47 пользователь John Davis davi...@gmail.com
   написал:
  
   Hello Kostya,
  
   Thanks for the reply.
  
   On Thu, Jan 5, 2012 at 11:39 AM, Kostya Vasilyev kmans...@gmail.com
 
   wrote:
   
2:
   
Yes, you're supposed to call the base class in your case, the
ArrayAdapter
will be doing most of the work for you, inflating new or reusing
existing
row layouts.
  
   Ok. I think I am doing what you say.
  
   
3:
   
Use view ids that are relevant to (used inside) your actual row
 item
layout.
   
I very much doubt that R.id.listView1 is it.
  
   The listview is created using that id.  I did not create any
 resources
   for the individual items. I don't know how to do that.  The example
   code I used simply created a listview in xml.
  
   
4:
   
view.findViewById() is the getChild call you're looking for, using
 an
id
to
locate the view. Use correct id 

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
On Thu, Jan 5, 2012 at 12:44 PM, Kostya Vasilyev kmans...@gmail.com wrote:
 Ok, great.

 One simple thing you can do is to check the item's position, e.g. set odd
 items to blue and even items to red (just to pick an example).

The only logic which knows the desired color is the main view which
populated the list view.  It seems that android can not do what I
desire.


 Beyond that, consider creating a proper data item class.

 The adapter's getView would then examine the data item at the requested
 position and make the decision on how to present it, based on its field
 values (e.g. names starting with A are red, starting with B are green,
 the rest are blue).

 Also consider extending BaseAdapter rather than ArrayAdapter - it's just a
 little bit more work, but should really clarify things for you.

 The links posted by TreKing are Mark are good.

 -- Kostya

 5 января 2012 г. 21:31 пользователь John Davis davi...@gmail.com написал:

 Kostya,

 Tip of the hat to you.  That worked.  It will set all the items to
 blue text. I appreciate your help a lot.

 Now, is there a simple way to do this selectively?  I saw you could
 tag items and then look based upon a tag.  Perhaps that will work?  I
 would prefer that the class which creates the array adapter and list
 view set the tag for the color and the array adapter to draw the line
 items in blue or red based upon this tag.

 John

 On Thu, Jan 5, 2012 at 12:13 PM, Kostya Vasilyev kmans...@gmail.com
 wrote:
  Aha!
 
  android.R.layout.simple_list_item_1 is defined in the platform, you can
  find
  it under your Android sdk
  directory/platforms/platform-version/data/res/layout (that data/res
  is
  very useful to look up things):
 
  The whole layout is a TextView, and its id is @android:id/text1,
  which, on
  the Java side of things, is android.R.id.text1.
 
  So you'd do something like.
 
         @Override
         public View getView(int position, View convertView, ViewGroup
  parent)
  {
                 View row = super.getView(position, convertView, parent);
             TextView text = (TextView)
  row.findViewById(android.R.id.text1);
             text.setTextColor(0x64788e);
                 return row;
         }
 
  Or just this, knowing that the layout is just one TextView:
 
  TextView text = (TextView) row;
 
  The direct typecast should work for the hello-listview sample, as that
  also
  uses a row layout containing a single TextView with no children (and no
  id,
  so findViewById won't work here).
 
  -- Kostya
 
  5 января 2012 г. 21:04 пользователь John Davis davi...@gmail.com
  написал:
 
  Hello
 
  On Thu, Jan 5, 2012 at 11:53 AM, Kostya Vasilyev kmans...@gmail.com
  wrote:
   Just to clarify 2:
  
   I meant calling super.getView from your adapter's getView, assuming
   it's
    a
   subclass of ArrayAdapter.
  
   Do not call adapter.getView from outside the adapter's code, that's
   meaningless.
 
  That makes sense. Thanks.
 
  
   Now the view ids What layout id do you use to initialize the
   adapter?
   Perhaps android.R.layout.something?
 
  I did :
                 MyAdapterString adapter = new
  MyAdapterString(this,android.R.layout.simple_list_item_1, values);
 
  
   A side note: my suggestions here are just to patch up things based on
   the
   route you've already headed down (using ArrayAdapter).
 
 
  For what it is worth, I can do this:
          public View getView(int position, View convertView, ViewGroup
  parent) {
          TextView text = new TextView(getContext());
          text.setText(Hi, I am position  + position);
          text.setTextColor(Color.parseColor(#64788e));
          return  text;
         }
  That will set the text color to blue, but it will also change the text
  I put in the list.
 
  
   One day, as your knowledge grows, you'll want to throw away the
   three-wheeled bicycle (ArrayAdapter) and create your own, perhaps by
   extending BaseAdapter.
  
 
 
  Is this example
 
  http://developer.android.com/resources/tutorials/views/hello-listview.html
  impossible to manipulate the color of individual list items?  Or, is
  there a way to patch up this code to do what I want?  It seems pretty
  trivial to do. I don't understand why the hooks do not exist for what
  i want to do.
   -- Kostya
  
   5 января 2012 г. 20:47 пользователь John Davis davi...@gmail.com
   написал:
  
   Hello Kostya,
  
   Thanks for the reply.
  
   On Thu, Jan 5, 2012 at 11:39 AM, Kostya Vasilyev
   kmans...@gmail.com
   wrote:
   
2:
   
Yes, you're supposed to call the base class in your case, the
ArrayAdapter
will be doing most of the work for you, inflating new or reusing
existing
row layouts.
  
   Ok. I think I am doing what you say.
  
   
3:
   
Use view ids that are relevant to (used inside) your actual row
item
layout.
   
I very much doubt that R.id.listView1 is it.
  
   The listview is created using that id.  I did not create any
   resources
   for the 

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread TreKing
On Thu, Jan 5, 2012 at 12:43 PM, John Davis davi...@gmail.com wrote:

 The only logic which knows the desired color is the main view
 which populated the list view.


Then pass the information along as you populate your views.


  It seems that android can not do what I desire.


More likely, you don't know how to do what you desire. I assure you
Android can set different colors on TextViews in a list.

-
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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Kostya Vasilyev
Correct.

Since Android is not true Java, you can't call methods of one object from
another object.

An unfortunate limitation that is hopefully fixed some day (version 19.0?
Peppermint Pattie?)

/tongue firmly planted in cheek

You can call some methods of the activity from the adapter, or you can pass
some information from the activity into the adapter, or come up with some
other way.

I assure you, styling list view items based on some logic is definitely
possible. Just look at the Gmail app on your phone, for a start.

-- Kostya

5 января 2012 г. 22:43 пользователь John Davis davi...@gmail.com написал:

 On Thu, Jan 5, 2012 at 12:44 PM, Kostya Vasilyev kmans...@gmail.com
 wrote:
  Ok, great.
 
  One simple thing you can do is to check the item's position, e.g. set odd
  items to blue and even items to red (just to pick an example).

 The only logic which knows the desired color is the main view which
 populated the list view.  It seems that android can not do what I
 desire.



-- 
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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Yes, I would think it is possible, but not in this version. Its
possible to set all line items to the same value.  However, its not
possible to set the colors on a case by case value using the provided
api.

This code will set all the line items to blue:

public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View row;
row = super.getView(position, convertView, parent);
TextView text;
//  text = (TextView) row.findViewWithTag(2);
text = (TextView) row.findViewById(android.R.id.text1);
text.setTextColor(Color.parseColor(#64788e));
return row;
}

I tweaked it to use the tag like so:
public View getView(int position, View convertView, ViewGroup parent) {

  View row = super.getView(position, convertView, parent);
  TextView text = (TextView) row.findViewWithTag(99);
  // if this row has been tagged with the marker, set the color to blue
  if (null != text) {
text.setTextColor(Color.parseColor(#64788e)); 
  }
  // This will set all row items to be blue.
//  text = (TextView) row.findViewById(android.R.id.text1);
  return row;
}

But the api does not allow you to set a tag outside this code so that
the routine can change the text color based on the tag.

ie.

View rowView;
int listCount;
View fooView;
listCount = adapter.getCount();  // this says 6 items in array
int count = -1;
count = theList.getCount();  // this also says 6 items in teh view
for (int i=0;inumRows;i++) {
// If it is the 2nd or 5th item, tag it so that it will be
displayed in blue.
if (i==2 || i==5) {
fooView = (View) theList.getItemAtPosition(i);  // this 
line
has a bug and will not work as described.
fooView.setTag(99);
}   
 }

public Object getItemAtPosition (int position)

Since: API Level 1
Gets the data associated with the specified position in the list.
Parameters

positionWhich data to get
Returns

The data associated with the specified position in the list

If you try to get this data, it raises an exception.

-- 
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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Kostya Vasilyev
Yes it is possible to set colors on a case by case basis using the provided
API.

It's just that the provided API is not structured the way you expect.

Create a data item class with fields to base the logic on
Extend BaseAdapter
Override getView
Check the data item fields and make the decision
Optionally, delegate to a method in the activity, an appearance manager
object, or make the decision in some other way.

-- Kostya

5 января 2012 г. 23:07 пользователь John Davis davi...@gmail.com написал:

 Yes, I would think it is possible, but not in this version. Its
 possible to set all line items to the same value.  However, its not
 possible to set the colors on a case by case value using the provided
 api.



-- 
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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread TreKing
On Thu, Jan 5, 2012 at 1:07 PM, John Davis davi...@gmail.com wrote:

 Yes, I would think it is possible, but not in this version. Its possible
 to set all line items to the same value.  However, its not possible to set
 the colors on a case by case value using the provided api.


Yes it is. Please stop blaming the platform for your lack of understanding
it. I already explained how you can create a data-model that holds the
unique color per item that you then set on the View.

But the api does not allow you to set a tag outside this code so that the
 routine can change the text color based on the tag.


Yes it does. But using the Tag property to achieve this is overkill and
ugly anyway.


 If you try to get this data, it raises an exception.


No, if you don't know how to use this function and use it incorrectly, then
it raises an exception.

At this point I have to suggest to you that you take a step back, get
yourself a good book, and review the documentation thoroughly and go
through the samples. You are apparently confused about a number of things
with how the adapters work and are not going to get anywhere until you
understand what they are and how they work.

Good luck.

-
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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Sadly I appreciate your help, but I don't think it will work. I've
already done an override of the getview call.  The higher level logic
which knows which items can specify the draw color can not communicate
it to the lower level.  The code samples, i have seen set all the
colors in a list. I don't see any which set colors on a line by line
basis.  Probably the gmail example you gave uses private api calls
since the code is not online anywhere.

2012/1/5 Kostya Vasilyev kmans...@gmail.com:
 Yes it is possible to set colors on a case by case basis using the provided
 API.

 It's just that the provided API is not structured the way you expect.

 Create a data item class with fields to base the logic on
 Extend BaseAdapter
 Override getView
 Check the data item fields and make the decision
 Optionally, delegate to a method in the activity, an appearance manager
 object, or make the decision in some other way.

 -- Kostya

 5 января 2012 г. 23:07 пользователь John Davis davi...@gmail.com написал:

 Yes, I would think it is possible, but not in this version. Its
 possible to set all line items to the same value.  However, its not
 possible to set the colors on a case by case value using the provided
 api.

 --
 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



-- 
John F. Davis

独树一帜

-- 
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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Hello Treking,

On Thu, Jan 5, 2012 at 2:17 PM, TreKing treking...@gmail.com wrote:
 On Thu, Jan 5, 2012 at 1:07 PM, John Davis davi...@gmail.com wrote:

 Yes, I would think it is possible, but not in this version. Its possible
 to set all line items to the same value.  However, its not possible to set
 the colors on a case by case value using the provided api.


 Yes it is. Please stop blaming the platform for your lack of understanding
 it. I already explained how you can create a data-model that holds the
 unique color per item that you then set on the View.


I'm not blaming anyone or the api. I am simply saying it has a bug.
Someone might want to look into it.


 But the api does not allow you to set a tag outside this code so that the
 routine can change the text color based on the tag.


 Yes it does. But using the Tag property to achieve this is overkill and ugly
 anyway.

Sorry, but it is the only thing provided by the api and its not the
settag which raises the exception.  It is the getitematpostion call.
It says it gets the data at position x.  When this call is made it
raises and exception.  That is the bug. It should return null if it
does not exist. Raising an exception sounds like a bug.



 If you try to get this data, it raises an exception.


 No, if you don't know how to use this function and use it incorrectly, then
 it raises an exception.



I am not using the data from the call and getting an exception.  I am
making the call and getting an exception.



 At this point I have to suggest to you that you take a step back, get
 yourself a good book, and review the documentation thoroughly and go through
 the samples. You are apparently confused about a number of things with how
 the adapters work and are not going to get anywhere until you understand
 what they are and how they work.

 Good luck.


 -
 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



-- 
John F. Davis

独树一帜

-- 
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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Romain Guy
Please post the full stack trace of your exception.

On Thu, Jan 5, 2012 at 11:28 AM, John Davis davi...@gmail.com wrote:
 Hello Treking,

 On Thu, Jan 5, 2012 at 2:17 PM, TreKing treking...@gmail.com wrote:
 On Thu, Jan 5, 2012 at 1:07 PM, John Davis davi...@gmail.com wrote:

 Yes, I would think it is possible, but not in this version. Its possible
 to set all line items to the same value.  However, its not possible to set
 the colors on a case by case value using the provided api.


 Yes it is. Please stop blaming the platform for your lack of understanding
 it. I already explained how you can create a data-model that holds the
 unique color per item that you then set on the View.


 I'm not blaming anyone or the api. I am simply saying it has a bug.
 Someone might want to look into it.


 But the api does not allow you to set a tag outside this code so that the
 routine can change the text color based on the tag.


 Yes it does. But using the Tag property to achieve this is overkill and ugly
 anyway.

 Sorry, but it is the only thing provided by the api and its not the
 settag which raises the exception.  It is the getitematpostion call.
 It says it gets the data at position x.  When this call is made it
 raises and exception.  That is the bug. It should return null if it
 does not exist. Raising an exception sounds like a bug.



 If you try to get this data, it raises an exception.


 No, if you don't know how to use this function and use it incorrectly, then
 it raises an exception.



 I am not using the data from the call and getting an exception.  I am
 making the call and getting an exception.



 At this point I have to suggest to you that you take a step back, get
 yourself a good book, and review the documentation thoroughly and go through
 the samples. You are apparently confused about a number of things with how
 the adapters work and are not going to get anywhere until you understand
 what they are and how they work.

 Good luck.


 -
 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



 --
 John F. Davis

 独树一帜

 --
 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



-- 
Romain Guy
Android framework engineer
romain...@android.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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread TreKing
On Thu, Jan 5, 2012 at 1:24 PM, John Davis davi...@gmail.com wrote:

 The higher level logic which knows which items can specify the draw color
 can not communicate it to the lower level.


Yes it can. Unless this is a specific design restriction you've imposed,
there is nothing in the language or API preventing you from passing this
information down, one way or the other.


 The code samples, i have seen set all the colors in a list. I don't see
 any which set colors on a line by line basis.  Probably the gmail example
 you gave uses private api calls since the code is not online anywhere.


You can't find an example, therefore it's a private api? You've got to be
shitting me. Look up any todo app - almost all of them allow you to label /
color items differently based on what tags / lists / priorities / whatever
is associated with them. So you believe all of these apps must be employing
private apis because you can't figure out how to do it?


If you truly believe this is impossible, just abandon your app - it's only
going to get worse from here out.

-
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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Hello Romain Guy,

How would I post the full stack trace?  The logcat output?

John

On Thu, Jan 5, 2012 at 2:30 PM, Romain Guy romain...@android.com wrote:
 Please post the full stack trace of your exception.

 On Thu, Jan 5, 2012 at 11:28 AM, John Davis davi...@gmail.com wrote:
 Hello Treking,

 On Thu, Jan 5, 2012 at 2:17 PM, TreKing treking...@gmail.com wrote:
 On Thu, Jan 5, 2012 at 1:07 PM, John Davis davi...@gmail.com wrote:

 Yes, I would think it is possible, but not in this version. Its possible
 to set all line items to the same value.  However, its not possible to set
 the colors on a case by case value using the provided api.


 Yes it is. Please stop blaming the platform for your lack of understanding
 it. I already explained how you can create a data-model that holds the
 unique color per item that you then set on the View.


 I'm not blaming anyone or the api. I am simply saying it has a bug.
 Someone might want to look into it.


 But the api does not allow you to set a tag outside this code so that the
 routine can change the text color based on the tag.


 Yes it does. But using the Tag property to achieve this is overkill and ugly
 anyway.

 Sorry, but it is the only thing provided by the api and its not the
 settag which raises the exception.  It is the getitematpostion call.
 It says it gets the data at position x.  When this call is made it
 raises and exception.  That is the bug. It should return null if it
 does not exist. Raising an exception sounds like a bug.



 If you try to get this data, it raises an exception.


 No, if you don't know how to use this function and use it incorrectly, then
 it raises an exception.



 I am not using the data from the call and getting an exception.  I am
 making the call and getting an exception.



 At this point I have to suggest to you that you take a step back, get
 yourself a good book, and review the documentation thoroughly and go through
 the samples. You are apparently confused about a number of things with how
 the adapters work and are not going to get anywhere until you understand
 what they are and how they work.

 Good luck.


 -
 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



 --
 John F. Davis

 独树一帜

 --
 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



 --
 Romain Guy
 Android framework engineer
 romain...@android.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



-- 
John F. Davis

独树一帜

-- 
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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
This is from the debug window in the call stack output.

Thread [1 main] (Suspended (exception RuntimeException))  
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord,
Intent) line: 2663
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord,
Intent) line: 2679
ActivityThread.access$2300(ActivityThread,
ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033  
ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
Looper.loop() line: 123 
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int,
boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521  
ZygoteInit$MethodAndArgsCaller.run() line: 868  
ZygoteInit.main(String[]) line: 626 
NativeStart.main(String[]) line: not available [native method]  


2012/1/5 John Davis davi...@gmail.com:
 Hello Romain Guy,

 How would I post the full stack trace?  The logcat output?

 John

 On Thu, Jan 5, 2012 at 2:30 PM, Romain Guy romain...@android.com wrote:
 Please post the full stack trace of your exception.

 On Thu, Jan 5, 2012 at 11:28 AM, John Davis davi...@gmail.com wrote:
 Hello Treking,

 On Thu, Jan 5, 2012 at 2:17 PM, TreKing treking...@gmail.com wrote:
 On Thu, Jan 5, 2012 at 1:07 PM, John Davis davi...@gmail.com wrote:

 Yes, I would think it is possible, but not in this version. Its possible
 to set all line items to the same value.  However, its not possible to set
 the colors on a case by case value using the provided api.


 Yes it is. Please stop blaming the platform for your lack of understanding
 it. I already explained how you can create a data-model that holds the
 unique color per item that you then set on the View.


 I'm not blaming anyone or the api. I am simply saying it has a bug.
 Someone might want to look into it.


 But the api does not allow you to set a tag outside this code so that the
 routine can change the text color based on the tag.


 Yes it does. But using the Tag property to achieve this is overkill and 
 ugly
 anyway.

 Sorry, but it is the only thing provided by the api and its not the
 settag which raises the exception.  It is the getitematpostion call.
 It says it gets the data at position x.  When this call is made it
 raises and exception.  That is the bug. It should return null if it
 does not exist. Raising an exception sounds like a bug.



 If you try to get this data, it raises an exception.


 No, if you don't know how to use this function and use it incorrectly, then
 it raises an exception.



 I am not using the data from the call and getting an exception.  I am
 making the call and getting an exception.



 At this point I have to suggest to you that you take a step back, get
 yourself a good book, and review the documentation thoroughly and go 
 through
 the samples. You are apparently confused about a number of things with how
 the adapters work and are not going to get anywhere until you understand
 what they are and how they work.

 Good luck.


 -
 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



 --
 John F. Davis

 独树一帜

 --
 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



 --
 Romain Guy
 Android framework engineer
 romain...@android.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



 --
 John F. Davis

 独树一帜



-- 
John F. Davis

独树一帜

-- 
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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Romain Guy
This is not the stack trace generated by the exception. Look at the
logs and find the complete stack trace with the type of exception
generated and we'll get a better understanding of what's going on.

On Thu, Jan 5, 2012 at 11:34 AM, John Davis davi...@gmail.com wrote:
 This is from the debug window in the call stack output.

 Thread [1 main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2663
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2679
ActivityThread.access$2300(ActivityThread,
 ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int,
 boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]


 2012/1/5 John Davis davi...@gmail.com:
 Hello Romain Guy,

 How would I post the full stack trace?  The logcat output?

 John

 On Thu, Jan 5, 2012 at 2:30 PM, Romain Guy romain...@android.com wrote:
 Please post the full stack trace of your exception.

 On Thu, Jan 5, 2012 at 11:28 AM, John Davis davi...@gmail.com wrote:
 Hello Treking,

 On Thu, Jan 5, 2012 at 2:17 PM, TreKing treking...@gmail.com wrote:
 On Thu, Jan 5, 2012 at 1:07 PM, John Davis davi...@gmail.com wrote:

 Yes, I would think it is possible, but not in this version. Its possible
 to set all line items to the same value.  However, its not possible to 
 set
 the colors on a case by case value using the provided api.


 Yes it is. Please stop blaming the platform for your lack of understanding
 it. I already explained how you can create a data-model that holds the
 unique color per item that you then set on the View.


 I'm not blaming anyone or the api. I am simply saying it has a bug.
 Someone might want to look into it.


 But the api does not allow you to set a tag outside this code so that the
 routine can change the text color based on the tag.


 Yes it does. But using the Tag property to achieve this is overkill and 
 ugly
 anyway.

 Sorry, but it is the only thing provided by the api and its not the
 settag which raises the exception.  It is the getitematpostion call.
 It says it gets the data at position x.  When this call is made it
 raises and exception.  That is the bug. It should return null if it
 does not exist. Raising an exception sounds like a bug.



 If you try to get this data, it raises an exception.


 No, if you don't know how to use this function and use it incorrectly, 
 then
 it raises an exception.



 I am not using the data from the call and getting an exception.  I am
 making the call and getting an exception.



 At this point I have to suggest to you that you take a step back, get
 yourself a good book, and review the documentation thoroughly and go 
 through
 the samples. You are apparently confused about a number of things with how
 the adapters work and are not going to get anywhere until you understand
 what they are and how they work.

 Good luck.


 -
 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



 --
 John F. Davis

 独树一帜

 --
 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



 --
 Romain Guy
 Android framework engineer
 romain...@android.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



 --
 John F. Davis

 独树一帜



 --
 John F. Davis

 独树一帜

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, 

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Mark Murphy
Please allow the exception to continue, then use LogCat to examine the
full stack trace. You will see two stanzas for the stack trace, the
second one prefixed by Caused by:. Your code will appear in the
Caused by: portion of the stack trace.

2012/1/5 John Davis davi...@gmail.com:
 This is from the debug window in the call stack output.

 Thread [1 main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2663
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2679
ActivityThread.access$2300(ActivityThread,
 ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int,
 boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]


 2012/1/5 John Davis davi...@gmail.com:
 Hello Romain Guy,

 How would I post the full stack trace?  The logcat output?

 John

 On Thu, Jan 5, 2012 at 2:30 PM, Romain Guy romain...@android.com wrote:
 Please post the full stack trace of your exception.

 On Thu, Jan 5, 2012 at 11:28 AM, John Davis davi...@gmail.com wrote:
 Hello Treking,

 On Thu, Jan 5, 2012 at 2:17 PM, TreKing treking...@gmail.com wrote:
 On Thu, Jan 5, 2012 at 1:07 PM, John Davis davi...@gmail.com wrote:

 Yes, I would think it is possible, but not in this version. Its possible
 to set all line items to the same value.  However, its not possible to 
 set
 the colors on a case by case value using the provided api.


 Yes it is. Please stop blaming the platform for your lack of understanding
 it. I already explained how you can create a data-model that holds the
 unique color per item that you then set on the View.


 I'm not blaming anyone or the api. I am simply saying it has a bug.
 Someone might want to look into it.


 But the api does not allow you to set a tag outside this code so that the
 routine can change the text color based on the tag.


 Yes it does. But using the Tag property to achieve this is overkill and 
 ugly
 anyway.

 Sorry, but it is the only thing provided by the api and its not the
 settag which raises the exception.  It is the getitematpostion call.
 It says it gets the data at position x.  When this call is made it
 raises and exception.  That is the bug. It should return null if it
 does not exist. Raising an exception sounds like a bug.



 If you try to get this data, it raises an exception.


 No, if you don't know how to use this function and use it incorrectly, 
 then
 it raises an exception.



 I am not using the data from the call and getting an exception.  I am
 making the call and getting an exception.



 At this point I have to suggest to you that you take a step back, get
 yourself a good book, and review the documentation thoroughly and go 
 through
 the samples. You are apparently confused about a number of things with how
 the adapters work and are not going to get anywhere until you understand
 what they are and how they work.

 Good luck.


 -
 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



 --
 John F. Davis

 独树一帜

 --
 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



 --
 Romain Guy
 Android framework engineer
 romain...@android.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



 --
 John F. Davis

 独树一帜



 --
 John F. Davis

 独树一帜

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to 

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread TreKing
2012/1/5 John Davis davi...@gmail.com

 This is from the debug window in the call stack output.


As you were told in your other thread, that is the wrong stack. Look for
Caused by...

-
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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread TreKing
2012/1/5 John Davis davi...@gmail.com

 I'm not blaming anyone or the api. I am simply saying it has a bug.
 Someone might want to look into it.


Jumping to the conclusion that it is a bug is blaming the API.

It crashed! Can't be my fault! It's a bug!

Did you even debug your issue?


  Yes it does. But using the Tag property to achieve this is overkill and
 ugly
  anyway.

 Sorry, but it is the only thing provided by the api


Um ... no .. it's not. Have you looked at the docs? Do you know what API
even means?


 I am not using the data from the call and getting an exception.  I
 am making the call and getting an exception.


You are making the call *and trying to cast it to the wrong thing* in the
same line.

-
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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Kostya Vasilyev
That's the debugger's stack trace, not the logcat stack trace.

Press F8 a few times until your device displays the application 
stopped unexpectedly.

Then check the logcat panel in Eclipse and post the entire stack trace,
especially the stuff after Caused by:

-- Kostya

5 января 2012 г. 23:34 пользователь John Davis davi...@gmail.com написал:

 This is from the debug window in the call stack output.

 Thread [1 main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2663
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2679
ActivityThread.access$2300(ActivityThread,
 ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int,
 boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]


 2012/1/5 John Davis davi...@gmail.com:
  Hello Romain Guy,
 
  How would I post the full stack trace?  The logcat output?
 
  John
 
  On Thu, Jan 5, 2012 at 2:30 PM, Romain Guy romain...@android.com
 wrote:
  Please post the full stack trace of your exception.
 
  On Thu, Jan 5, 2012 at 11:28 AM, John Davis davi...@gmail.com wrote:
  Hello Treking,
 
  On Thu, Jan 5, 2012 at 2:17 PM, TreKing treking...@gmail.com wrote:
  On Thu, Jan 5, 2012 at 1:07 PM, John Davis davi...@gmail.com wrote:
 
  Yes, I would think it is possible, but not in this version. Its
 possible
  to set all line items to the same value.  However, its not possible
 to set
  the colors on a case by case value using the provided api.
 
 
  Yes it is. Please stop blaming the platform for your lack of
 understanding
  it. I already explained how you can create a data-model that holds the
  unique color per item that you then set on the View.
 
 
  I'm not blaming anyone or the api. I am simply saying it has a bug.
  Someone might want to look into it.
 
 
  But the api does not allow you to set a tag outside this code so
 that the
  routine can change the text color based on the tag.
 
 
  Yes it does. But using the Tag property to achieve this is overkill
 and ugly
  anyway.
 
  Sorry, but it is the only thing provided by the api and its not the
  settag which raises the exception.  It is the getitematpostion call.
  It says it gets the data at position x.  When this call is made it
  raises and exception.  That is the bug. It should return null if it
  does not exist. Raising an exception sounds like a bug.
 
 
 
  If you try to get this data, it raises an exception.
 
 
  No, if you don't know how to use this function and use it
 incorrectly, then
  it raises an exception.
 
 
 
  I am not using the data from the call and getting an exception.  I am
  making the call and getting an exception.
 
 
 
  At this point I have to suggest to you that you take a step back, get
  yourself a good book, and review the documentation thoroughly and go
 through
  the samples. You are apparently confused about a number of things
 with how
  the adapters work and are not going to get anywhere until you
 understand
  what they are and how they work.
 
  Good luck.
 
 
 
 -
  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
 
 
 
  --
  John F. Davis
 
  独树一帜
 
  --
  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
 
 
 
  --
  Romain Guy
  Android framework engineer
  romain...@android.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
  

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Hello Treking, Kostya, Romain-Guy,

Ok, I removed the breakpoint, ran it, hit F8 until I got logcat
output. I selected all the red/orange text and exported to a textfile.
 This is the result.  (I hope I am giving you the answer you request)

01-05 14:57:39.163: W/dalvikvm(9183): threadid=1: thread exiting with
uncaught exception (group=0x40028890)
01-05 14:57:39.308: E/AndroidRuntime(9183): FATAL EXCEPTION: main
01-05 14:57:39.308: E/AndroidRuntime(9183):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{net.skink.swtor.companion/net.skink.swtor.companion.SwtorCompanionActivity}:
java.lang.ClassCastException: java.lang.String
01-05 14:57:39.308: E/AndroidRuntime(9183): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
android.os.Handler.dispatchMessage(Handler.java:99)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
android.os.Looper.loop(Looper.java:123)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
android.app.ActivityThread.main(ActivityThread.java:4627)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
java.lang.reflect.Method.invokeNative(Native Method)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
java.lang.reflect.Method.invoke(Method.java:521)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
dalvik.system.NativeStart.main(Native Method)
01-05 14:57:39.308: E/AndroidRuntime(9183): Caused by:
java.lang.ClassCastException: java.lang.String
01-05 14:57:39.308: E/AndroidRuntime(9183): at
net.skink.swtor.companion.SwtorCompanionActivity.setCompanions(SwtorCompanionActivity.java:118)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
net.skink.swtor.companion.SwtorCompanionActivity.onCreate(SwtorCompanionActivity.java:62)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-05 14:57:39.308: E/AndroidRuntime(9183): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
01-05 14:57:39.308: E/AndroidRuntime(9183): ... 11 more

This looks like the getItemAtPosition is returning a string instead of
a view.  Is this a list of views or a list of strings?

John

On Thu, Jan 5, 2012 at 2:40 PM, Kostya Vasilyev kmans...@gmail.com wrote:
 That's the debugger's stack trace, not the logcat stack trace.

 Press F8 a few times until your device displays the application 
 stopped unexpectedly.

 Then check the logcat panel in Eclipse and post the entire stack trace,
 especially the stuff after Caused by:

 -- Kostya

 5 января 2012 г. 23:34 пользователь John Davis davi...@gmail.com написал:

 This is from the debug window in the call stack output.

 Thread [1 main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2663
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2679
ActivityThread.access$2300(ActivityThread,
 ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int,
 boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]


 2012/1/5 John Davis davi...@gmail.com:
  Hello Romain Guy,
 
  How would I post the full stack trace?  The logcat output?
 
  John
 
  On Thu, Jan 5, 2012 at 2:30 PM, Romain Guy romain...@android.com
  wrote:
  Please post the full stack trace of your exception.
 
  On Thu, Jan 5, 2012 at 11:28 AM, John Davis davi...@gmail.com wrote:
  Hello Treking,
 
  On Thu, Jan 5, 2012 at 2:17 PM, TreKing treking...@gmail.com wrote:
  On Thu, Jan 5, 2012 at 1:07 PM, John Davis davi...@gmail.com wrote:
 
  Yes, I would think it is possible, but not in this version. Its
  possible
  to set all line items to the same value.  However, its not possible
  to set
  the colors on a case by case value using the provided api.
 
 
  Yes it is. Please stop blaming the platform for your lack of
  

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Kostya Vasilyev
6 января 2012 г. 0:02 пользователь John Davis davi...@gmail.com написал:

 Hello Treking, Kostya, Romain-Guy,

 01-05 14:57:39.308: E/AndroidRuntime(9183): Caused by:
 java.lang.ClassCastException: java.lang.String
 01-05 14:57:39.308: E/AndroidRuntime(9183): at

 net.skink.swtor.companion.SwtorCompanionActivity.setCompanions(SwtorCompanionActivity.java:118)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at

 net.skink.swtor.companion.SwtorCompanionActivity.onCreate(SwtorCompanionActivity.java:62)


net.skink.swtor.companion -- is this your code by any chance?



 This looks like the getItemAtPosition is returning a string instead of
 a view.  Is this a list of views or a list of strings?


getItemAtPosition returns the data object at the specified position by
calling the list view adapter's getItem(). It's a convenience method.

So yes, in your case the return value would be a String.

It does not return the view for that item (for one thing, it may be
scrolled off the screen and not exist at the time).

Um, and I think a few ppl already mentioned it in this thread.

-- Kostya




 John

 On Thu, Jan 5, 2012 at 2:40 PM, Kostya Vasilyev kmans...@gmail.com
 wrote:
  That's the debugger's stack trace, not the logcat stack trace.


-- 
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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Kristopher Micinski
Well it goes to the adapter, which will return Objects, which you then
must cast to the appropriate type, in your case it's obviously a
String.  As RomainGuy (whom you should listen to, right, as he is a
framework engineer) said in the previous thread, you get the actual
views from getChild, this simply delegates to the apater...

Kris

2012/1/5 John Davis davi...@gmail.com:
 Hello Treking, Kostya, Romain-Guy,

 Ok, I removed the breakpoint, ran it, hit F8 until I got logcat
 output. I selected all the red/orange text and exported to a textfile.
  This is the result.  (I hope I am giving you the answer you request)

 01-05 14:57:39.163: W/dalvikvm(9183): threadid=1: thread exiting with
 uncaught exception (group=0x40028890)
 01-05 14:57:39.308: E/AndroidRuntime(9183): FATAL EXCEPTION: main
 01-05 14:57:39.308: E/AndroidRuntime(9183):
 java.lang.RuntimeException: Unable to start activity
 ComponentInfo{net.skink.swtor.companion/net.skink.swtor.companion.SwtorCompanionActivity}:
 java.lang.ClassCastException: java.lang.String
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 android.app.ActivityThread.access$2300(ActivityThread.java:125)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 android.os.Handler.dispatchMessage(Handler.java:99)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 android.os.Looper.loop(Looper.java:123)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 android.app.ActivityThread.main(ActivityThread.java:4627)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 java.lang.reflect.Method.invokeNative(Native Method)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 java.lang.reflect.Method.invoke(Method.java:521)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 dalvik.system.NativeStart.main(Native Method)
 01-05 14:57:39.308: E/AndroidRuntime(9183): Caused by:
 java.lang.ClassCastException: java.lang.String
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 net.skink.swtor.companion.SwtorCompanionActivity.setCompanions(SwtorCompanionActivity.java:118)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 net.skink.swtor.companion.SwtorCompanionActivity.onCreate(SwtorCompanionActivity.java:62)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 01-05 14:57:39.308: E/AndroidRuntime(9183): at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
 01-05 14:57:39.308: E/AndroidRuntime(9183): ... 11 more

 This looks like the getItemAtPosition is returning a string instead of
 a view.  Is this a list of views or a list of strings?

 John

 On Thu, Jan 5, 2012 at 2:40 PM, Kostya Vasilyev kmans...@gmail.com wrote:
 That's the debugger's stack trace, not the logcat stack trace.

 Press F8 a few times until your device displays the application 
 stopped unexpectedly.

 Then check the logcat panel in Eclipse and post the entire stack trace,
 especially the stuff after Caused by:

 -- Kostya

 5 января 2012 г. 23:34 пользователь John Davis davi...@gmail.com написал:

 This is from the debug window in the call stack output.

 Thread [1 main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2663
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2679
ActivityThread.access$2300(ActivityThread,
 ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int,
 boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]


 2012/1/5 John Davis davi...@gmail.com:
  Hello Romain Guy,
 
  How would I post the full stack trace?  The logcat output?
 
  John
 
  On Thu, Jan 5, 2012 at 2:30 PM, Romain Guy romain...@android.com
  wrote:
  Please post the full stack trace of your exception.
 
  On Thu, Jan 5, 2012 at 11:28 AM, John Davis davi...@gmail.com wrote:
  Hello Treking,
 
 

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Romain Guy
Then the problem is exactly what others have described earlier in this
thread. Your list adapter contains strings (and you should know what
it contains since you created it) and you attempt to cast one of these
strings into a View.

On Thu, Jan 5, 2012 at 12:02 PM, John Davis davi...@gmail.com wrote:
 Hello Treking, Kostya, Romain-Guy,

 Ok, I removed the breakpoint, ran it, hit F8 until I got logcat
 output. I selected all the red/orange text and exported to a textfile.
  This is the result.  (I hope I am giving you the answer you request)

 01-05 14:57:39.163: W/dalvikvm(9183): threadid=1: thread exiting with
 uncaught exception (group=0x40028890)
 01-05 14:57:39.308: E/AndroidRuntime(9183): FATAL EXCEPTION: main
 01-05 14:57:39.308: E/AndroidRuntime(9183):
 java.lang.RuntimeException: Unable to start activity
 ComponentInfo{net.skink.swtor.companion/net.skink.swtor.companion.SwtorCompanionActivity}:
 java.lang.ClassCastException: java.lang.String
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 android.app.ActivityThread.access$2300(ActivityThread.java:125)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 android.os.Handler.dispatchMessage(Handler.java:99)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 android.os.Looper.loop(Looper.java:123)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 android.app.ActivityThread.main(ActivityThread.java:4627)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 java.lang.reflect.Method.invokeNative(Native Method)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 java.lang.reflect.Method.invoke(Method.java:521)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 dalvik.system.NativeStart.main(Native Method)
 01-05 14:57:39.308: E/AndroidRuntime(9183): Caused by:
 java.lang.ClassCastException: java.lang.String
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 net.skink.swtor.companion.SwtorCompanionActivity.setCompanions(SwtorCompanionActivity.java:118)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 net.skink.swtor.companion.SwtorCompanionActivity.onCreate(SwtorCompanionActivity.java:62)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
 01-05 14:57:39.308: E/AndroidRuntime(9183):     ... 11 more

 This looks like the getItemAtPosition is returning a string instead of
 a view.  Is this a list of views or a list of strings?

 John

 On Thu, Jan 5, 2012 at 2:40 PM, Kostya Vasilyev kmans...@gmail.com wrote:
 That's the debugger's stack trace, not the logcat stack trace.

 Press F8 a few times until your device displays the application 
 stopped unexpectedly.

 Then check the logcat panel in Eclipse and post the entire stack trace,
 especially the stuff after Caused by:

 -- Kostya

 5 января 2012 г. 23:34 пользователь John Davis davi...@gmail.com написал:

 This is from the debug window in the call stack output.

 Thread [1 main] (Suspended (exception RuntimeException))
        ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2663
        ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord,
 Intent) line: 2679
        ActivityThread.access$2300(ActivityThread,
 ActivityThread$ActivityRecord, Intent) line: 125
        ActivityThread$H.handleMessage(Message) line: 2033
        ActivityThread$H(Handler).dispatchMessage(Message) line: 99
        Looper.loop() line: 123
        ActivityThread.main(String[]) line: 4627
        Method.invokeNative(Object, Object[], Class, Class[], Class, int,
 boolean) line: not available [native method]
        Method.invoke(Object, Object...) line: 521
        ZygoteInit$MethodAndArgsCaller.run() line: 868
        ZygoteInit.main(String[]) line: 626
        NativeStart.main(String[]) line: not available [native method]


 2012/1/5 John Davis davi...@gmail.com:
  Hello Romain Guy,
 
  How would I post the full stack trace?  The logcat output?
 
  John
 
  On Thu, Jan 5, 2012 at 2:30 PM, Romain Guy romain...@android.com
  wrote:
  Please post the full stack trace of your exception.
 
  On Thu, Jan 5, 2012 at 11:28 AM, John Davis davi...@gmail.com wrote:
  Hello Treking,
 
  On Thu, Jan 5, 2012 at 2:17 PM, TreKing treking...@gmail.com wrote:
  On 

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Hello

Ok. So I appreciate the help.  Here is the summary:

for (int i=0;icount;i++) {
// If it is the 2nd or 5th item, tag it so that it will be
displayed in blue.
if (i==2 || i==5) {
listCount = adapter.getCount();
count = theList.getCount();
fooString = (String) theList.getItemAtPosition(i);
Log.d(TAG, position +i+has string + 
fooString);
//  fooView = (TextView) theList.getChildAt(i);
//  Log.d(TAG, position +i+has  view id 
+fooView.getId());

//  fooView.setTag(99);
}

This code will work.  The stuff that is commented out pertaining to
getChildAt does not.  I'll try to get that working.  I suspect it will
not work since the view is not up and running yet.  As it is now, it
will crash when the getChild call is made.

Thanks for the help, this is becoming more clear. Pity the docs were
not more clear. returns the data is so generic.

-- 
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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Kristopher Micinski
On Thu, Jan 5, 2012 at 2:18 PM, John Davis davi...@gmail.com wrote:
 Hello

 Ok. So I appreciate the help.  Here is the summary:

            for (int i=0;icount;i++) {
                // If it is the 2nd or 5th item, tag it so that it will be
 displayed in blue.
                if (i==2 || i==5) {
                        listCount = adapter.getCount();
                        count = theList.getCount();
                        fooString = (String) theList.getItemAtPosition(i);
                                Log.d(TAG, position +i+has string + 
 fooString);
 //                      fooView = (TextView) theList.getChildAt(i);
 //                              Log.d(TAG, position +i+has  view id 
 +fooView.getId());

 //                      fooView.setTag(99);
                }

 This code will work.  The stuff that is commented out pertaining to
 getChildAt does not.  I'll try to get that working.  I suspect it will
 not work since the view is not up and running yet.  As it is now, it
 will crash when the getChild call is made.

 Thanks for the help, this is becoming more clear. Pity the docs were
 not more clear. returns the data is so generic.


That might be your interpretation too.  I think most people would
argue (since most people realize that the list is an adapter backed
view) that indeed 'the data' would make much more sense as the thing
in the adapter, preferring to call the GUI object 'the view.'

I have actually found that -- while necessarily incomplete (to the
extent that it's impossible logistically to document everything)  --
the Android API documentation is extremely high quality: assuming you
have some knowledge of how the framework fits together.  (Which is why
the documentation is simply that, a reference rather than a tutorial.)

kris

-- 
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


Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread John Davis
Hello Kris,

Yes, that is a good way to put it.  Thanks for the info.

John

On Thu, Jan 5, 2012 at 3:37 PM, Kristopher Micinski krismicin...@gmail.com
wrote:
 On Thu, Jan 5, 2012 at 2:18 PM, John Davis davi...@gmail.com wrote:
 Hello

 Ok. So I appreciate the help.  Here is the summary:

for (int i=0;icount;i++) {
// If it is the 2nd or 5th item, tag it so that it will be
 displayed in blue.
if (i==2 || i==5) {
listCount = adapter.getCount();
count = theList.getCount();
fooString = (String) theList.getItemAtPosition(i);
Log.d(TAG, position +i+has string +
fooString);
 //  fooView = (TextView) theList.getChildAt(i);
 //  Log.d(TAG, position +i+has  view id
+fooView.getId());

 //  fooView.setTag(99);
}

 This code will work.  The stuff that is commented out pertaining to
 getChildAt does not.  I'll try to get that working.  I suspect it will
 not work since the view is not up and running yet.  As it is now, it
 will crash when the getChild call is made.

 Thanks for the help, this is becoming more clear. Pity the docs were
 not more clear. returns the data is so generic.


 That might be your interpretation too.  I think most people would
 argue (since most people realize that the list is an adapter backed
 view) that indeed 'the data' would make much more sense as the thing
 in the adapter, preferring to call the GUI object 'the view.'

 I have actually found that -- while necessarily incomplete (to the
 extent that it's impossible logistically to document everything)  --
 the Android API documentation is extremely high quality: assuming you
 have some knowledge of how the framework fits together.  (Which is why
 the documentation is simply that, a reference rather than a tutorial.)

 kris

 --
 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



-- 
John F. Davis

独树一帜

-- 
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

Re: [android-developers] Is there a docment on getView()?

2012-01-05 Thread Kostya Vasilyev
In fact, the docs page for Adapter:

http://developer.android.com/reference/android/widget/Adapter.html

... says this:

An Adapter object acts as a bridge between an
AdapterViewhttp://developer.android.com/reference/android/widget/AdapterView.html
and
the underlying data for that view. The Adapter provides access to the data
items. The Adapter is also responsible for making a
Viewhttp://developer.android.com/reference/android/view/View.html
 for each item in the data set.

So the concept of underlying data is present right away, and so is the
notion that an adapter is what connects the UI to that data.

-- Kostya

6 января 2012 г. 0:53 пользователь John Davis davi...@gmail.com написал:

 Hello Kris,

 Yes, that is a good way to put it.  Thanks for the info.

 John


 On Thu, Jan 5, 2012 at 3:37 PM, Kristopher Micinski 
 krismicin...@gmail.com wrote:
  On Thu, Jan 5, 2012 at 2:18 PM, John Davis davi...@gmail.com wrote:
  Hello
 
  Ok. So I appreciate the help.  Here is the summary:
 
 for (int i=0;icount;i++) {
 // If it is the 2nd or 5th item, tag it so that it will
 be
  displayed in blue.
 if (i==2 || i==5) {
 listCount = adapter.getCount();
 count = theList.getCount();
 fooString = (String)
 theList.getItemAtPosition(i);
 Log.d(TAG, position +i+has string +
 fooString);
  //  fooView = (TextView) theList.getChildAt(i);
  //  Log.d(TAG, position +i+has  view id
 +fooView.getId());
 
  //  fooView.setTag(99);
 }
 
  This code will work.  The stuff that is commented out pertaining to
  getChildAt does not.  I'll try to get that working.  I suspect it will
  not work since the view is not up and running yet.  As it is now, it
  will crash when the getChild call is made.
 
  Thanks for the help, this is becoming more clear. Pity the docs were
  not more clear. returns the data is so generic.
 
 
  That might be your interpretation too.  I think most people would
  argue (since most people realize that the list is an adapter backed
  view) that indeed 'the data' would make much more sense as the thing
  in the adapter, preferring to call the GUI object 'the view.'
 
  I have actually found that -- while necessarily incomplete (to the
  extent that it's impossible logistically to document everything)  --
  the Android API documentation is extremely high quality: assuming you
  have some knowledge of how the framework fits together.  (Which is why
  the documentation is simply that, a reference rather than a tutorial.)
 
  kris
 
  --
  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



 --
 John F. Davis

 独树一帜



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


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