[android-developers] use big size Bitmap in AppWidget

2012-07-31 Thread Ethan Gao
hi all:
   
 I am attempting to create an android Widget application which display 
more than 10 images in ListView. The image size depends on screen 
resolution, so the image might be 300*300 pixel on some high resolution 
devices. When scrolling the listview Widget, the widget looks laggy and 
choppy. However, this laggy problem only happens on some high resolution 
device. I looked into android source code, and find out that there is a 
cache in RemoteViewsAdapter whose size is fixed to 2MB. 2MB is enough in 
most device, but not in high resolution devices. 
Is there anyone see this problem as well? Any help would be 
appreciated.   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

Re: [android-developers] Update single item in Collection in an AppWidget

2012-07-11 Thread Ethan Gao
It does not work.
But the latest android 4.1 emulator, I don't see this problem any more. 
So I think this is an android bug under 4.1 version.
But still want to know here that is it possible in application side to fix 
this problem?


On Thursday, May 3, 2012 7:17:38 PM UTC+8, Kostya Vasilyev wrote:

 Have you tried returning true 
 from RemoteViewsService.RemoteViewsFactory.html#hasStableIds()?

 2012/5/2 fabfour lombi...@googlemail.com

 Hi all,

 I want to update a single item in a collection (in my case ListView)
 without updating the whole collection. If i use the
 AppWidgetManager.notifyAppWidgetViewDataChanged the whole collection
 is redrawn and the scroll position resets. Does someone know another
 possibility to update a single item?

 Best regards, Fabio

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




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

[android-developers] IndexOutofBoundsException thrown from getViewAt() in RemoteViewFactory

2012-06-14 Thread Ethan Gao
I am attempting to create a widget for android 4.0 phone. But the widget 
might crash after user clicks the clear data button in application's 
setting view. I looked into logcat, it saysIndexOutofBoundsException in 
getViewat() method. 
This is super weird in my eyes, since I put log in both getCount() and 
getViewat() methods. Firstly, getCount() methods return 1, but the 
consequence getViewat() is still trying to get view at position 1 and 2. 
Is there anyone see this problem before? any thoughts would be appreciated, 
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

Re: [android-developers] IndexOutofBoundsException thrown from getViewAt() in RemoteViewFactory

2012-06-14 Thread Ethan Gao
I didn't ask for getViewAt(index=1), this method is called by android 
framework(I think it's called by RemoteViewsAdater). 

I can not figure out the reason RemoteViewsAdatper is calling 
getViewAt(index=1) after it called getCount() which returns 1.

I suspect that this is an android bug, since I didn't do anything wrong 
according the docs.

On Thursday, June 14, 2012 6:57:17 PM UTC+8, Harri Smått wrote:

 On Jun 14, 2012, at 1:37 PM, Ethan Gao wrote: 
  Firstly, getCount() methods return 1, but the consequence getViewat() is 
 still trying to get view at position 1 and 2. 

 If getCount() returns 1, you shouldn't ask for getViewAt(index) where 
 index = 1. It's your responsibility to make sure you do not exceed 
 getCount() limits (at least usually). 

 -- 
 H

-- 
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] How to monitor disabling an app in android 4.0

2012-06-07 Thread Ethan Gao
hi all:

  There is a new feature in android 4.0 which is that user is able
to disable pre-install applications. Is there an Intent that android
system will sent out when disabling an application?

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] items in listview can not get focused correctly.

2011-09-22 Thread Ethan Gao
Hi:
 I created a view whose layout like:
  TextViewButtonButton
 ListView
 Everything works fine at touch mode. But weird thing happens when
I try to focus the listview item using trackball. The items in
listView can not be focused. I post my layout file and code, you can
try it on device or emulator.  Is there anyone can help me to figure
out where I am doing wrong?   thanks a lot in advance.

   Here is my xml file:
   ?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent

LinearLayout android:layout_width=fill_parent
android:layout_height=wrap_content
TextView
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_gravity=left
android:text=@string/hello
/
Button
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_gravity=right
android:text=@string/hello
android:id=@+id/button1
/
Button
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_gravity=right
android:text=@string/hello
android:id=@+id/button2
/
/LinearLayout
ListView
android:layout_width=fill_parent
android:layout_height=wrap_content
android:id=@+id/listviewId/
/LinearLayout

And my code is below:
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

ListView listView = (ListView) findViewById(R.id.listviewId);
Button headerBtn = new Button(this);
headerBtn.setWidth(LayoutParams.FILL_PARENT);
headerBtn.setHeight(LayoutParams.WRAP_CONTENT);
headerBtn.setText(ListView Header);
listView.addHeaderView(headerBtn);

Button button1 = (Button)findViewById(R.id.button1);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, Button1, 
2000).show();
}
});
Button button2 = (Button)findViewById(R.id.button2);
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, Button2, 
2000).show();
}
});

ArrayAdapterString adapter = new ArrayAdapterString(this,
android.R.layout.simple_list_item_1);
for (int i = 0; i  20; ++i) {
adapter.add(value + i);
}
listView.setAdapter(adapter);
listView.setItemsCanFocus(true);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView? arg0, View arg1, 
int arg2,
long arg3) {
Toast.makeText(MainActivity.this, Value + 
arg2, 2000).show();
}
});
}
}

You can t

-- 
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] how to highlight and select a button in listview item

2011-08-01 Thread Ethan Gao
Hi everyone:

 I am working on an app which contains a listView to display the
products user is interested. And for each product at the listview, we
have a delete button to delete the product from list.  I can
hightlight the product in listview using trackball, but can not
highlight the delete button. Is there anyone who know how to resolve
this?  thanks a lot in advance~

-- 
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] webview can not display twitter page

2011-07-29 Thread Ethan Gao
I am developing an app with twitter sharing feature. User can
share information via twitter. After user click the twitter image in
app view, a webView is brought up with a twitter share url. But the
webview is always a blank page.
Only twitter url does not work, facebook url works very well. It
looks like webview does not support redirecting, right?

PS: I've set the javascript enable of webview, still do not work
for twitter share url.

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