[android-developers] pixel to dpi and scaling question

2010-09-07 Thread jerryfan2000
Hi,
I was reading multiple screen support page on SDK doc for solving a
pixel to dpi scaling problem in my app. In the doc, it says
// Convert the dips to pixels
final float scale =
getContext().getResources().getDisplayMetrics().density;
mGestureThreshold = (int) (GESTURE_THRESHOLD_DIP * scale + 0.5f);

My question is why we have to add 0.5f at the end? It indeed works
great on high density screen but failed to match the result on medium
density screen. For medium density screen, I have to remove the +0.5f.
In addition. according to the doc, px - dpi conversion works like px =
dpi x (density/160) and there is no mentioning of adding additional
0.5 at the end. Does anybody know why and how it works? 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] ConvertView and super.getView, difference?

2010-08-30 Thread jerryfan2000
Hi,
A question in Android adapter has confused me for a long time. I have
a code spinet like below

 public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
View sv = super.getGroupView(groupPosition, isExpanded,
convertView, parent);

V.S

 public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
 if(ConvertView == null) {
LayoutInflater inflater = (LayoutInflater)
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
sv = inflater.inflate(R.layout.labelrowgroup, parent,
false);
}

Does anyone know the difference between them?

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


[android-developers] Re: How to store a drawable in database?

2010-08-03 Thread jerryfan2000
I want to store all install app's icons in a database so that I don't
need to query from lengthy package manager query every time after
reboot.

On Aug 3, 1:53 am, Matty busbus...@gmail.com wrote:
 I can't help but wonder why you would want to do this?

 On Aug 1, 9:12 am, Jerry Fan jerryfan1...@gmail.com wrote:

  Hi folks,
  is there anyway that I can store drawables into database?

-- 
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] ExpandableListView crash when the list starts empty

2009-11-02 Thread jerryfan2000
Hi,
I have a problem with ExpandableListView crash. When an
ExpaldableListView first starts with empty cursor (cursor without data
row) and later on change a cursor with data row. There is 100% chance
the ExpandableListView will crash when expand mainGroup item. I am not
sure is it a bug in Android because I can't find any bug in my code.
Below is the step i used to reproduce the crash

(1) In onCreate, create simpleCursorTreeAdapter and make sure the data
set returned is empty.
(2) In onCreate, add the simpleCursorTreeAdapter to an
ExpandableListView
(3) when button add is clickked, i will do myAdapter.getCursor
().reQuery();   myAdapter.notifyDataSetChanged()
(4) At this point, there will be a newly added and the only row in
ExpandableListAdapter.
(5) Click on the item to make the list expand. Then my program will
crash.

Note: It doesn't matter if there is child row under the group i
clicked. it will just crash.


Logcat report
  5971 AndroidRuntime  E
java.lang.NullPointerException
  5971 AndroidRuntime  Eat
android.widget.SimpleCursorTreeAdapter.bindView
(SimpleCursorTreeAdapter.java:200)
  5971 AndroidRuntime  Eat
android.widget.SimpleCursorTreeAdapter.bindChildView
(SimpleCursorTreeAdapter.java:218)
  5971 AndroidRuntime  Eat
android.widget.CursorTreeAdapter.getChildView(CursorTreeAdapter.java:
250)
  5971 AndroidRuntime  Eat
com.smart.expense.expense2$myMainExpandableListAdapter.getChildView
(expense2.java:578)
  5971 AndroidRuntime  Eat
android.widget.ExpandableListConnector.getView
(ExpandableListConnector.java:451)
  5971 AndroidRuntime  Eat
android.widget.AbsListView.obtainView(AbsListView.java:
1272)
  5971 AndroidRuntime  Eat
android.widget.ListView.measureHeightOfChildren(ListView.java:
1142)
  5971 AndroidRuntime  Eat
android.widget.ListView.onMeasure(ListView.java:1055)
  5971 AndroidRuntime  Eat android.view.View.measure
(View.java:7117)
  5971 AndroidRuntime  Eat
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
  5971 AndroidRuntime  Eat
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:
888)
  5971 AndroidRuntime  Eat
android.widget.LinearLayout.measureVertical(LinearLayout.java:350)
  5971 AndroidRuntime  Eat
android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
  5971 AndroidRuntime  Eat android.view.View.measure
(View.java:7117)
  5971 AndroidRuntime  Eat
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
  5971 AndroidRuntime  Eat
android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
  5971 AndroidRuntime  Eat android.view.View.measure
(View.java:7117)
  5971 AndroidRuntime  Eat
android.widget.LinearLayout.measureVertical(LinearLayout.java:464)
  5971 AndroidRuntime  Eat
android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
  5971 AndroidRuntime  Eat android.view.View.measure
(View.java:7117)
  5971 AndroidRuntime  Eat
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
  5971 AndroidRuntime  Eat
android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
  5971 AndroidRuntime  Eat android.view.View.measure
(View.java:7117)
  5971 AndroidRuntime  Eat
android.view.ViewRoot.performTraversals(ViewRoot.java:713)
  5971 AndroidRuntime  Eat
android.view.ViewRoot.handleMessage(ViewRoot.java:1504)
  5971 AndroidRuntime  Eat
android.os.Handler.dispatchMessage(Handler.java:99)
  5971 AndroidRuntime  Eat android.os.Looper.loop
(Looper.java:123)
  5971 AndroidRuntime  Eat
android.app.ActivityThread.main(ActivityThread.java:3948)
  5971 AndroidRuntime  Eat
java.lang.reflect.Method.invokeNative(Native Method)
  5971 AndroidRuntime  Eat
java.lang.reflect.Method.invoke(Method.java:521)
  5971 AndroidRuntime  Eat
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:782)
  5971 AndroidRuntime  Eat
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
  5971 AndroidRuntime  Eat
dalvik.system.NativeStart.main(Native Method)

-- 
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] any good uml creation tool for android?

2009-11-01 Thread jerryfan2000
Hi,
Is there any free or opensource Eclipce plug in avaliable for UML
diagram auto generation for Android?

-- 
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 setViewText in SimpleCursorTreeAdapter?

2009-10-22 Thread jerryfan2000

Hi,

I want to do some Local based number formatting. However, I cannot
find function similar to setViewText in SimpleCursorTreeAdapter. So I
am wondering is there any alternative solution to do manual text view
binding in SimpleCursorTreeAdapter? 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] help with rawQuery statement

2009-09-29 Thread jerryfan2000

Hi,
I have a very simple statement like below

return conn.rawQuery(select date, sum(amount) from entries where
(date='+start+' and date='+end+') group by date,null);

This statement works flawlessly in sqlite3 command line. However, it
returns nothing if I use it within rawQuery method. Is it a bug or I
am misusing rawQuery? 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] do i need to close cursor?

2009-09-10 Thread jerryfan2000

Hi,
Just wondering is it necessary to close cursor when an activity is
stopped or pause?
--~--~-~--~~~---~--~~
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 focus out of order when click rapidly

2009-09-01 Thread jerryfan2000

Hi,
I noticed that when item in in a list is clicked rapidly, there is
chance that item in other row becomes dark. Especially when you click
turn on/off bluetooth in system setting quickly. Has anyone noticed it
and is there fix for this? 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] is it possible to display a multi column list ?

2009-07-28 Thread jerryfan2000

Hi,
I am looking for a way to create a Microsoft data grid style list in
android. But I am wondering is there any available built in component
capable of doing this job such as listview? Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: is it possible to display a multi column list ?

2009-07-28 Thread jerryfan2000

is there any workaround to simulate similar function?

On Jul 29, 4:29 am, Jack Ha jack...@t-mobile.com wrote:
 There's no built-in data grid component.

 --
 Jack Ha
 Open Source Development Center
 ・T・ ・ ・Mobile・ stick together

 The views, opinions and statements in this email are those of
 the author solely in their individual capacity, and do not
 necessarily represent those of T-Mobile USA, Inc.

 On Jul 28, 7:37 am, jerryfan2000 jerryfan1...@gmail.com wrote:

  Hi,
  I am looking for a way to create a Microsoft data grid style list in
  android. But I am wondering is there any available built in component
  capable of doing this job such as listview? Thanks


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



[android-developers] Re: autostart a service by editing init.rc after apk installation

2009-07-22 Thread jerryfan2000

Hi Hackborn,
If all I want to do is  to autostart an APK I wrote when system is up,
is modifying init.rc the only way? Or there is other way to do it?
Thanks.
On Jul 21, 2:22 pm, Dianne Hackborn hack...@android.com wrote:
 Hi, this is very out of the scope of the SDK.  If you are building a device,
 you may be able to get help in android-porting.  (Fwiw, init.rc is way way
 down the stack from launching .apks.)

 On Mon, Jul 20, 2009 at 10:30 PM, jerryfan2000 jerryfan1...@gmail.comwrote:



  Hi all,
  I want to modify init.rc to make one of notification service in my app
  to autostart when phone is up. However, as far as I know, modifying
  init.rc requires root access. So If I want to achieve this, is there
  anyway to do it? Thanks.

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.
--~--~-~--~~~---~--~~
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] autostart a service by editing init.rc after apk installation

2009-07-20 Thread jerryfan2000

Hi all,
I want to modify init.rc to make one of notification service in my app
to autostart when phone is up. However, as far as I know, modifying
init.rc requires root access. So If I want to achieve this, is there
anyway to do it? Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Browser doesn't respond to trackball click event (on certain webpage), touch screen click ok

2009-06-11 Thread jerryfan2000

We found a way to reproduce it.

Version: Android 1.5
Application: Browser
Reproduce procedure:
(1) Open Browser
(2)Goto URL www.baidu.com
(3) type nothing in the text field but click (with trackball) the
button directly

Sympton:
Clicking submit button in pure CGI form based web page without typing
text, there is fail rate that Browser will fail to respond to track
ball click.

On 6月11日, 下午1時51分, jerryfan2000 jerryfan1...@gmail.com wrote:
 Hi,
  We encountered a strange problem in Browser. When browsing certain
 web page with CGI form, browser doesnt respond to trackball click
 event unless we play around the UI ormove cursor around or switch
 between application. However, tocuh screen works all the time. I can't
 give an example of problem making web site yet. Just wodering is it an
 isolated case to me.

 Thanks,
 Jerry Fan
--~--~-~--~~~---~--~~
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] Browser doesn't respond to trackball click event (on certain webpage), touch screen click ok

2009-06-10 Thread jerryfan2000

Hi,
 We encountered a strange problem in Browser. When browsing certain
web page with CGI form, browser doesnt respond to trackball click
event unless we play around the UI ormove cursor around or switch
between application. However, tocuh screen works all the time. I can't
give an example of problem making web site yet. Just wodering is it an
isolated case to me.


Thanks,
Jerry Fan
--~--~-~--~~~---~--~~
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 convert Picture object to Bitmap object?

2009-06-04 Thread jerryfan2000

Hi ,
I am trying to figure out how to do convertion of Picture object
generated by webView to Bitmap for later JPEG encoding and saving to
local f/s. I tried to create a bitmap from pre created Picture object
by BitmapFactory.decodeStream and failed. Seems like Picture object is
unreconginzed format by Bitmap factory. Just wondering is there any
method to do the convertion?
--~--~-~--~~~---~--~~
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] Can I use Picture.writeToStream to save picture to filesystem as png or jpeg format?

2009-06-03 Thread jerryfan2000

Hi folks,
I am trying to capture screen from WebView and save the picture into
either JPEG or PNG formats on android local filesystem. However,
documentation of Picture.writeToStream doesn't mention anything about
what format it stores or supports. So I am wondering is it possible to
do what I want to do in android?
--~--~-~--~~~---~--~~
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] what is the picture format for Picture.WriteToStream?

2009-06-03 Thread jerryfan2000

Hi,
What format of picture will I get by using Picture.WriteToStream?
--~--~-~--~~~---~--~~
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: How to click a web link and display in my WebView app

2009-05-13 Thread jerryfan2000

Hi,
I am trying to add a webview in my app to display a web page. However,
every time I click link on the web page, Browser will be launched to
display content in that link. I understand it is something about
intent but I am still wondering is there any simpler method to ask
webview to display link content within its View ? 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] Calendar fail to launch in Cupcake 1.5

2009-03-24 Thread jerryfan2000

Hi,
Is there anyone know why Calendar in Cupcake 1.5 fails to launch? I
googled and found nothing about this issue. Is it. In addition, I got
some error msg with logcat saying superclass of
CalendarAppWidgetProvider was unable to resolve. However, I can't find
CalendarAppWidgetProvider class from source code nor can I find it by
googling the web at all. Hope someone can help. 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
-~--~~~~--~~--~--~---