[android-developers] ListView problem

2009-10-15 Thread 楊健

Dears,
When I try to show a list with items and labels,I create item and
labels with different layout by inflater.
The problem is when i scroll the list ,part of the items use the wrong
layout.
Why the layout changes when i scroll the list.
Any hint?
Best regards!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] ListView problem

2011-12-15 Thread Killer_Instinct
This is the context:
I have a TabActivity with three tabs,|Contacts|History|Caller| in the
tab on contacts,
I have another TabActivity. In this TacActvity I have set the
tabwidget invisible and I use a personal layout on the top to change
among tabs: |Server|Agenda|Directory| basically i use the onClick
event to setCurrentTab in the TabHost.
If I set a normal Activity on a TabContent its OK, the problem is when
I set a ListActivity with a ListView as the TabContent,in that case
the lisview hide the 3 buttons on the on the top, so I can no longer
interact with those buttons. As you can see on the image Any ideas of
why or how to solve this?

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


[android-developers] listview problem

2011-10-20 Thread vani reddy
Hi friends,

I have 2 edittexts ,ontouch of the first edittext it should  a particular
listview  and ontouch  of second edittext it should show a different
listview in android.
I have used the below code


   View currentView = linflater.inflate(R.layout.listview, null);
 list1 =(ListView)currentView.findViewById(R.id.list);

  ViewpreviousView = linflater.inflate(R.layout.listview1, null);

 list2 =(ListView)previousView.findViewById(R.id.list);





 edit1.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
 list1.setVisibility(View.VISIBLE);
list2.setVisibility(View.INVISIBLE);

listView.removeView(currentView);
  linearlayout.removeView(previousView);
linearlayout.removeView(previousView);

String[] names = new String[] { "Linux", "Windows7",
"Eclipse", "Suse",
"Ubuntu", "Solaris", "Android", "iPhone"};
// Create an ArrayAdapter, that will actually make the
Strings above
// appear in the ListView
list1.setAdapter(new ArrayAdapter(SearchClass.this,
android.R.layout.simple_list_item_1, names));
   linearlayout.addView(currentView);

return false;
}
});




 edit1.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {


list1.setVisibility(View.INVISIBLE);
linearlayout.removeView(previousView);
  linearlayout.removeView(currentView);

 list2.setVisibility(View.VISIBLE);
String[] names1 = new String[] { "LOCATION ", "",
"Eclipse", "Suse",
"cc", "", "",
"iPhone"};
list2.setAdapter(new
ArrayAdapter(SearchClass.this, android.R.layout.simple_list_item_1,
namesLOCATIOn));
 linearlayout.addView(previousView);

return false;
}
});

But after executing it is showing list with names1 content on touch of both
edittexts.

How to resolve this problem..Please reply
-- 
Regards,
Vani Reddy

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

[android-developers] ListView Problem

2011-08-01 Thread vaibhav mahajan
Hi Dear All,

I am facing some issues in the developement of my app.
I have created a list in which i want to add buttons and textswitcher.
But if i do so i can able to delete the items in my list - as either
the buttons in the list would work or list without the buttons would
work.
I tried to create a fragment which includes the buttons and add the
fragment in the listview but i guess i could not able to get the
success!
Can ny1 suggest me some clue on this issue?

Reply awaited!!

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


[android-developers] ListView problem

2010-10-01 Thread sisko
In following a tutorial from "SAMS Android Application Development in
24 hours" I hit a problem with my first ListView example.

Basically, my java code is firing according to log messages I set but
my ListView does not display when I execute my app. The App runs fine
without crashing so syntactically all seems to be well.

Since I can't attach documents, please bear with me as I paste some
code but you can download the entire sample app from
http://www.icerge.com/android-sample-app-download

My layout file is called Menu.xml and is as below:

http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">






















The java file is called QuizMenuActivity.java and is as follows:
package com.androidbook.triviaquiz;

import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class QuizMenuActivity extends QuizActivity {
private final String LOGID  =   "Track";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);

Log.i(LOGID, "Begining!");

ListView menuList   =   (ListView)
findViewById(R.id.ListView_Menu);
/*String[] items=
{ getResources().getString(R.string.menu_item_play),

getResources().getString(R.string.menu_item_scores),

getResources().getString(R.string.menu_item_settings),

getResources().getString(R.string.menu_item_help) };*/
String[] items  ={"test#1","test#2","test3","test#4"} ;
ArrayAdapter adapt  =   new ArrayAdapter(this,
android.R.layout.simple_list_item_1, items);
menuList.setAdapter(adapt);


Log.i(LOGID, "Reaching this point!");
}
}

Finally, there is a Menu_item.xml which defines my TextView that the
java file above attempts to write array data to. It is as follows:
http://schemas.android.com/apk/res/android";
android:layout_width="match_parent"
android:text="testing testing"
android:layout_gravity="center_horizontal"
android:shadowRadius="5"
android:gravity="center"
android:textColor="@color/listview_items_color"
android:shadowDx="3"
android:shadowDy="3"
android:textSize="@dimen/menuxml_item_size"
android:shadowColor="@color/listview_items_color_glow">


As I don't want to overwhelm you with code you will have to take my
word for it that all the resources are in place and are not the
problem.


Can anyone offer some insight? Please download the app from
http://www.icerge.com/android-sample-app-download to examine the code
better and see what I mean.

Thanks.

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


[android-developers] listView Problem

2010-06-08 Thread android is good
Hi this  is kishor i am new   to android   i have query   i am using
listView. in this lisyview i have  to textViews  like and comment .if
iam  clicking  on the  comment i have to show on Edit Text and Button.
right i can able to see the  Edit Text and Button   but  not  in the
same listview i want  toshow in the  same listview. and another query
is  i f i tried to enter into the EditText that Edit Text and  Buttin
s are going to invisible state.

 please help me  in this  case.

-- 
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] listview problem

2011-10-22 Thread vani reddy
Hi,
Then how do i resolve this, i used onFocusChangedListener also, its not
working.
It is showing the same list in both the views

On Fri, Oct 21, 2011 at 1:11 AM, TreKing  wrote:

> The fact that you're doing this twice might be a problem:
>
> *edit1.setOnTouchListener(new View.OnTouchListener() {*
>
>
> -
> 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




-- 
Regards,
Vani Reddy

-- 
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] listview problem

2011-10-22 Thread vani reddy
Thanks i got it :)


On Sat, Oct 22, 2011 at 3:01 PM, vani reddy wrote:

> Hi,
> Then how do i resolve this, i used onFocusChangedListener also, its not
> working.
> It is showing the same list in both the views
>
>
> On Fri, Oct 21, 2011 at 1:11 AM, TreKing  wrote:
>
>> The fact that you're doing this twice might be a problem:
>>
>> *edit1.setOnTouchListener(new View.OnTouchListener() {*
>>
>>
>> -
>> 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
>
>
>
>
> --
> Regards,
> Vani Reddy
>
>


-- 
Regards,
Vani Reddy

-- 
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] listview problem

2011-10-20 Thread TreKing
The fact that you're doing this twice might be a problem:

*edit1.setOnTouchListener(new View.OnTouchListener() {*

-
TreKing  - Chicago
transit tracking app for Android-powered devices

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

[android-developers] ListView problem is back.

2009-11-13 Thread Sergey Vasilinets
Hello,
I have a error "11-14 01:23:23.204: ERROR/AndroidRuntime(730):
java.lang.IllegalStateException: The content of the adapter has
changed but ListView did not receive a notification. Make sure the
content of your adapter is not modified from a background thread, but
only from the UI thread.
".  This error was discussed earlier here. I took the advices given
there, but they didn't solve problem completely.
My ListView fills in without exception. But if I've begun to click
(frequently) on elements of listview , while it is filling in, i see
that error.
I'm  using the ListView + Cursor , and  I'm sure that the cursor is
updated from the main thread (via AsyncTask, also I tried Handlers
with post() , but it works the same)

I wrote specially simple project to show my problem, and it's here :
http://listexample.googlecode.com/

I'm looking forward to your answers to know what I'm doing wrong.

PS Sorry for my bad english.

Sergey Vasilinets.

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


[android-developers] ListView problem while scrolling

2012-09-01 Thread LiTTle
Hi everyone,

I am trying 4 days to solve this problem. I am trying to create the 
following feature:
I have a ListView that the user can select an item. When the user selects 
the item the text will turn to pink. The ListView shows 6 items at once. 
You have to scroll to see other 6 and go on.
But there is a problem:
When i scroll the ListView the item No8, No15,... are pink too! 
Any help, ideas (even if you think you are wrong) are welcomed. I am 
freaking out more and more every day.
Thanks a lot for your time spent reading my issue!

Here is the code inside for my adapter:

public class MyListAdapter extends ArrayAdapter {

private Context ctx;
private String[] values;
private ArrayList mData =new ArrayList();
private ViewHolder holder=null;
private LayoutInflater inflater;
 public MyListAdapter(Context context, int textViewResourceId, String[] 
values) {
super(context, textViewResourceId, values);

ctx = context;
inflater = (LayoutInflater) ctx
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.values = values;
for (int i = 0; i < values.length; i++) {
addItem(values[i]);
}
}
 public void addItem(final String item) {
mData.add(item);
notifyDataSetChanged();
}
 @Override
public String getItem(int position) {
return mData.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public int getCount() {
// TODO Auto-generated method stub
return mData.size();
}

/* (non-Javadoc)
 * @see android.widget.ArrayAdapter#getView(int, android.view.View, 
android.view.ViewGroup)
 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {
 
if(convertView==null){
convertView = inflater.inflate(R.layout.list_item, parent, false);
holder = new ViewHolder();
holder.textView = 
(TextView)convertView.findViewById(R.id.item_textView);
convertView.setTag(holder);
 }
else{
holder = (ViewHolder)convertView.getTag();
}
holder.textView.setText(mData.get(position));
holder.textView.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View view) {
for(int i=0; ihttp://groups.google.com/group/android-developers?hl=en

Re: [android-developers] ListView problem is back.

2009-11-13 Thread Dan Dumont
I'm pretty sure that if the size of the adapter changes while the layout is
being calculated you will get this exception.

All additions, deletions, and data updates should be done in the UI thread I
think.
Using an AsyncTask is one way to do this.   Make sure that each piece of
data your background process produces is added to the adapter in the safe
methods of the AsyncTask.

On Fri, Nov 13, 2009 at 5:43 PM, Sergey Vasilinets <
sergey.vasilin...@googlemail.com> wrote:

> Hello,
> I have a error "11-14 01:23:23.204: ERROR/AndroidRuntime(730):
> java.lang.IllegalStateException: The content of the adapter has
> changed but ListView did not receive a notification. Make sure the
> content of your adapter is not modified from a background thread, but
> only from the UI thread.
> ".  This error was discussed earlier here. I took the advices given
> there, but they didn't solve problem completely.
> My ListView fills in without exception. But if I've begun to click
> (frequently) on elements of listview , while it is filling in, i see
> that error.
> I'm  using the ListView + Cursor , and  I'm sure that the cursor is
> updated from the main thread (via AsyncTask, also I tried Handlers
> with post() , but it works the same)
>
> I wrote specially simple project to show my problem, and it's here :
> http://listexample.googlecode.com/
>
> I'm looking forward to your answers to know what I'm doing wrong.
>
> PS Sorry for my bad english.
>
> Sergey Vasilinets.
>
> --
> 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] ListView problem while scrolling

2012-09-01 Thread Mark Murphy
You only ever setting the color to be pink. You need to set the color
to be not-pink as well, for cases where the row is recycled, was pink,
and now no longer is supposed to be pink.

On Sat, Sep 1, 2012 at 7:10 AM, LiTTle  wrote:
> Hi everyone,
>
> I am trying 4 days to solve this problem. I am trying to create the
> following feature:
> I have a ListView that the user can select an item. When the user selects
> the item the text will turn to pink. The ListView shows 6 items at once. You
> have to scroll to see other 6 and go on.
> But there is a problem:
> When i scroll the ListView the item No8, No15,... are pink too!
> Any help, ideas (even if you think you are wrong) are welcomed. I am
> freaking out more and more every day.
> Thanks a lot for your time spent reading my issue!
>
> Here is the code inside for my adapter:
> 
> public class MyListAdapter extends ArrayAdapter {
>
> private Context ctx;
> private String[] values;
> private ArrayList mData =new ArrayList();
> private ViewHolder holder=null;
> private LayoutInflater inflater;
> public MyListAdapter(Context context, int textViewResourceId, String[]
> values) {
> super(context, textViewResourceId, values);
>
> ctx = context;
> inflater = (LayoutInflater) ctx
> .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
> this.values = values;
> for (int i = 0; i < values.length; i++) {
> addItem(values[i]);
> }
> }
> public void addItem(final String item) {
> mData.add(item);
> notifyDataSetChanged();
> }
> @Override
> public String getItem(int position) {
> return mData.get(position);
> }
>
> @Override
> public long getItemId(int position) {
> return position;
> }
>
> @Override
> public int getCount() {
> // TODO Auto-generated method stub
> return mData.size();
> }
>
> /* (non-Javadoc)
> * @see android.widget.ArrayAdapter#getView(int, android.view.View,
> android.view.ViewGroup)
> */
> @Override
> public View getView(int position, View convertView, ViewGroup parent) {
>
> if(convertView==null){
> convertView = inflater.inflate(R.layout.list_item, parent, false);
> holder = new ViewHolder();
> holder.textView =
> (TextView)convertView.findViewById(R.id.item_textView);
> convertView.setTag(holder);
> }
> else{
> holder = (ViewHolder)convertView.getTag();
> }
> holder.textView.setText(mData.get(position));
> holder.textView.setOnClickListener(new OnClickListener() {
>
> @Override
> public void onClick(View view) {
> for(int i=0; i }
> ((ViewHolder)view.getTag()).textView.setTextColor(ctx.getResources().
> getColor(R.color.pink));
> }
> });
> return convertView;
> }
> public static class ViewHolder {
> public TextView textView;
> }
>
> }
> ///
>
> --
> 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



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

_The Busy Coder's Guide to Android Development_ Version 4.1 Available!

-- 
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] ListView problem while scrolling

2012-09-01 Thread LiTTle
I cannot believe it that is was a simple line! Thank you very much. I feel 
much more relaxed now.

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

[android-developers] ListView problem - items are shrank when while scrolling the view

2010-06-08 Thread zohar lerman
Hi,

I found strange behavior in ListView.
I have ListView of TextView except from one entry that contains
ImageView.
when i on of the items is touched and scroll up and down the image is
re-sized to about 2/3 its original size! Usually, the image remains in
this smaller size when the user lifts his finger and stops scrolling.
The original size can be restored by tapping your finger on any of the
empty list cells.

any idea?

http://schemas.android.com/apk/res/
android"
xmlns:app="http://schemas.android.com/apk/res/com.jumptap.test";
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>




ListView lv = (ListView)findViewById(R.id.myList);
lv.setAdapter(new BaseAdapter() {

@Override
public View getView(int position, View convertView, 
ViewGroup
parent) {

if (position==5) {
return imgView;
} else {
TextView tv = new 
TextView(TestActivity.this);
tv.setText("Entry #"+position);
tv.setMinimumHeight(50);
tv.setBackgroundColor(Color.DKGRAY);
return tv;
}
}

@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}

@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}

@Override
public int getCount() {
return 15;
}
});


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