[android-developers] Android5.0 TextView gravity center not working Correctly

2014-12-12 Thread Gavin Qin
 

LinearLayout

android:layout_width=match_parent

android:layout_height=wrap_content

android:orientation=horizontal 


TextView

android:layout_width=0dp

android:layout_height=wrap_content

android:layout_weight=1

android:gravity=center

android:singleLine=true

android:text=Access control

android:textSize=20sp /


TextView

android:layout_width=0dp

android:layout_height=wrap_content

android:layout_weight=1

android:gravity=center

android:singleLine=true

android:text=Access control

android:textSize=20sp /


TextView

android:layout_width=0dp

android:layout_height=wrap_content

android:layout_weight=1

android:gravity=center

android:singleLine=true

android:text=Access control

android:textSize=20sp /


TextView

android:layout_width=0dp

android:layout_height=wrap_content

android:layout_weight=1

android:gravity=center

android:singleLine=true

android:text=Access control

android:textSize=20sp /

/LinearLayout

in android api 21 and android api20, it looks like the attachment.

why in android api21 ,the textview gravity not working Correctly.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] android5.0 Textview gravity center not working correctly.

2014-12-12 Thread Gavin Qin
LinearLayout

android:layout_width=match_parent

android:layout_height=wrap_content

android:orientation=horizontal 



TextView

android:layout_width=0dp

android:layout_height=wrap_content

android:layout_weight=1

android:gravity=center

android:singleLine=true

android:text=Access control

android:textSize=20sp /



TextView

android:layout_width=0dp

android:layout_height=wrap_content

android:layout_weight=1

android:gravity=center

android:singleLine=true

android:text=Access control

android:textSize=20sp /



TextView

android:layout_width=0dp

android:layout_height=wrap_content

android:layout_weight=1

android:gravity=center

android:singleLine=true

android:text=Access control

android:textSize=20sp /



TextView

android:layout_width=0dp

android:layout_height=wrap_content

android:layout_weight=1

android:gravity=center

android:singleLine=true

android:text=Access control

android:textSize=20sp /

/LinearLayout

in android api 21 and android api20, it looks like the attachment.

why in android api21 ,the textview gravity not working Correctly.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] HLS Stream with Discontinuities reports incorrect position (4.0.x)

2012-11-12 Thread Rick Gavin
When using an HLS playlist with multiple segments of content spliced 
together ( separated by EXT-X-DISCONTINUITY tags ), 
MediaPlayer.getCurrentPosition() doesn't return the correct position.  In 
this scenario, each piece of content has its timestamps starting from zero. 
  So for example, if at the 4 minute mark, there is a Discontinuity flag 
followed by a new piece of content, getCurrentPosition() reports the time 
as going back to 00:00 instead of 04:01  

Does anyone know a work around?   

Just a note that MediaPlayer.getDuration() does correctly return the full 
duration of all the content combined.

-- 
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] Best Practices for releasing Views controlled by Adapter

2012-11-08 Thread Rick Gavin
Hi All,
when a Fragment is being closed, what is the correct way to clean up the 
memory that is being used by a GridView that is being supplied data by an 
Adapter subclass.   

The GridView items are layouts that include an ImageView and a text label.

in the Fragment's onDestroyView, do you simply set the GridView's adapter 
to null or should you be doing any other specifics to expunge memory, in 
either the Adapter subclass or at the Fragment level?

thanks for any pointers, I'm trying to track down an OutOfMemory bomb after 
switching tabs a number of times.

-- 
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] XVID support by Mediaplayer, MediaRecorder class

2012-03-16 Thread Gavin Fang
Hi, Android develops:
I have a plan to porting the mediaplayer wich decode/encode with Xvid
and Divx format to Android. But I am NOT sure whether Mediaplayer,
MediaRecorder support Xvid or DivX format?
Thanks a lot!

BR
Gavin Fang

-- 
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] Disable CPU frequency scaling from APP?

2011-08-29 Thread Gavin
Hi all,

I want do some multimedia work on android, but I found that cpu can't
be kept on a high frequency. This makes the result of the player not
so good.
Is there any solution to disable the frequency scaling feature when my
app is running?

-- 
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: Serious bug in 3.2 ResolverActivity

2011-08-17 Thread Gavin
It was fixed at latest version.

-- 
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] when drag view, the view blink

2010-09-16 Thread Gavin Qin
Hello, everyone.
 I have a problem about the view drag. when i drag the view, it will
blink. The code like below:
HorizontalScrollView android:id=@+id/HorizontalScrollView01
android:layout_below=@id/bomb_l
android:layout_width=wrap_content
android:layout_height=wrap_content 
android:scrollbars=none
android:layout_marginBottom=20dip
android:layout_marginTop=10dip
TableLayout android:id=@+id/TableLayout01
android:layout_width=wrap_content
android:layout_height=wrap_content
TableRow android:id=@+id/TableRow01
android:layout_width=wrap_content
android:layout_height=wrap_content
AbsoluteLayout 
android:id=@+id/answerSheet

android:layout_width=wrap_content
android:layout_height=wrap_content
 TextView 
android:text=@+id/TextView01 android:id=@+id/
TextView01


android:layout_width=wrap_content
android:layout_height=wrap_content /TextView
/AbsoluteLayout
/TableRow
/TableLayout
/HorizontalScrollView

when i want to drag  TextView01, the view will blink
@SuppressWarnings(deprecation)
@Override
public boolean onTouchEvent(MotionEvent event) {

if (isShowPress) {
int action = event.getAction();
switch (action  MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:

return super.onTouchEvent(event);
case MotionEvent.ACTION_MOVE:
curX = event.getX();
curY = event.getY();


AbsoluteLayout.LayoutParams params = new
AbsoluteLayout.LayoutParams(
135, 200, (int) curX, (int) 
curY);
this.setLayoutParams(params);

break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
AbsoluteLayout.LayoutParams p = new 
AbsoluteLayout.LayoutParams(
135, 200, 135, 0);
this.setLayoutParams(p);

break;
default:
break;
}
}


return true;
}


how can solve this problem.
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] when drag view, the view blink

2010-09-16 Thread Gavin Qin
Hello, everyone.
 I have a problem about the view drag. when i drag the view, it will
blink. The code like below:
HorizontalScrollView android:id=@+id/HorizontalScrollView01
android:layout_below=@id/bomb_l
android:layout_width=wrap_content
android:layout_height=wrap_content 
android:scrollbars=none
android:layout_marginBottom=20dip
android:layout_marginTop=10dip
TableLayout android:id=@+id/TableLayout01
android:layout_width=wrap_content
android:layout_height=wrap_content
TableRow android:id=@+id/TableRow01
android:layout_width=wrap_content
android:layout_height=wrap_content
AbsoluteLayout 
android:id=@+id/answerSheet

android:layout_width=wrap_content
android:layout_height=wrap_content
 TextView 
android:text=@+id/TextView01 android:id=@+id/
TextView01


android:layout_width=wrap_content
android:layout_height=wrap_content /TextView
/AbsoluteLayout
/TableRow
/TableLayout
/HorizontalScrollView

when i want to drag  TextView01, the view will blink
@SuppressWarnings(deprecation)
@Override
public boolean onTouchEvent(MotionEvent event) {

if (isShowPress) {
int action = event.getAction();
switch (action  MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:

return super.onTouchEvent(event);
case MotionEvent.ACTION_MOVE:
curX = event.getX();
curY = event.getY();


AbsoluteLayout.LayoutParams params = new
AbsoluteLayout.LayoutParams(
135, 200, (int) curX, (int) 
curY);
this.setLayoutParams(params);

break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
AbsoluteLayout.LayoutParams p = new 
AbsoluteLayout.LayoutParams(
135, 200, 135, 0);
this.setLayoutParams(p);

break;
default:
break;
}
}


return true;
}


how can solve this problem.
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] Re: How to make a multi-player game on Android

2010-03-05 Thread Gavin Aiken
Bluetooth is just for close quarters, you want two players on two phones
within 10 feet?

On Fri, Mar 5, 2010 at 1:41 PM, Maxood maqs...@salsoft.net wrote:

 Let's say it is simply a turn based game then do i have to use a
 Bluetooth API for that? I precisely want a game app that can be played
 by 2 players on 2 android supported smartphones.
 Thanks

 On Mar 5, 5:14 am, Gav gav.ai...@googlemail.com wrote:
  You can do this over Http or using TCP (or UDP) directly. It depends
  on if you want a turn based game and if you plan to build other
  clients (Borwser based?) etc.
 
  On Mar 5, 12:58 pm, Maxood maqs...@salsoft.net wrote:
 
 
 
   Wonder how can we make a multi-player game in android. Lets say for 2
   players like Chess, Scrabble, Draughts, etc.
   Can anyone guide me on this please? Thank you.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@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] Re: How to make a multi-player game on Android

2010-03-05 Thread Gavin Aiken
Yes it's possible, read up on Sockets in Java, you'll have to implement a
server to match players based on location.

Feel free to come back with some more specific questions when you have done
some reading and played around with android a bit.

On Fri, Mar 5, 2010 at 2:11 PM, Maxood maqs...@salsoft.net wrote:

 I want these players to receive game invitation though this app and
 then they should be able to play it ...like Chess or Checkers. And
 they can be anywhere in the world. Is it possible? Whats the
 feasibility? Wonder if a player can invite another player who lives in
 the locality? Please comment

 On Mar 5, 5:38 am, Yahel kaye...@gmail.com wrote:
   Wonder how can we make a multi-player game in android. Lets say for 2
   players like Chess, Scrabble, Draughts, etc.
 
  You need to be a lot more specific : Multiplayer on the same phone,
  multiplayer over the internet, mass multiplayer ?
 
  Beside, what is it you don't know how to do ?
 
  Tell us more and we'll do our best.
 
  Yahel

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@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] Sharing a view among several activities

2009-11-04 Thread Gavin Bong
I want to create a little widget which displays a green bulb if there
is network connectivity and a red bulb if there is none.

Design:

a) register a BroadcastReceiver to listen for network connectivity
events
b) If the receiver receives a network down/up event, it will notify
the NetworkUptimeWidget to update itself.

Questions:

1) It looks like I will have to duplicate the code in every activity
to listen for updates (I am already using the include element to share
the XML declarations for NetworkUptimeWidget ). Is there any way to
avoid this ?
2) I am currently using the ContentObserver to notify the widget about
changes. Obviously that was meant for database providers. Is it wrong
to use it like a publish/subscribe method in the general sense ?

Thanks

Gavin

-- 
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: Google wave invitations...?

2009-10-16 Thread Gavin Aiken
Takes at least 24 hours in my experience :) have fun waving!
On Fri, Oct 16, 2009 at 2:09 PM, Kenneth Adam Miller 
kennethadammil...@gmail.com wrote:

  Have any of you gotten an email yet?
 I swear I've sent them out...
 perhaps they're just nominations for a possible invite to google wave and
 not you know actual concrete invitations
 I don't know, but I'm guessing that you guys would still want it.
 Hahah

 :)
 I'm in class right now, but I'll review all you guys



 On Fri, Oct 16, 2009 at 7:40 AM, GSC greg.ch...@gmail.com wrote:


 If anyone else has an available invitiation, please send me one.

 Thanks

 On Oct 16, 7:31 am, ColletJb collet...@gmail.com wrote:
  I think there are no invitation left from Kenneth Adam Miller.
 
  But if anyone invited by him has invitation and can invite me, It
  would be great ;)



 


--~--~-~--~~~---~--~~
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: protected member variable mScrollX not accessible to subclasses of ViewGroup

2009-10-04 Thread Gavin Bong

Thanks. scrollTo() solved it for me.

On 2 oct, 23:35, Romain Guy romain...@google.com wrote:
 mScrollX is not part of the public API. Use getScrollX() and
 scrollBy()/scrollTo() to change it.

--~--~-~--~~~---~--~~
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: protected member variable mScrollX not accessible to subclasses of ViewGroup

2009-10-04 Thread Gavin Bong

 mScrollX is a protected member of View, so should be accessible to any 
 subclass.

It should be but eclipse is flagging it. I presume one of Android's
eclipse Builders are flagging it.

Regards,

G
--~--~-~--~~~---~--~~
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] protected member variable mScrollX not accessible to subclasses of ViewGroup

2009-10-02 Thread Gavin Bong

In the android Launcher app, Workspace.java accesses the mScrollX
member variable.

http://www.google.com/codesearch/p?hl=frsa=Ncd=2ct=rc#4r7JaNM0EqE/src/com/android/launcher/Workspace.javaq=computeScroll

However it looks like mScrollX is not accessible to my ViewGroup
subclass.

Eclipse is marking it as unresolved().

Why is it that Launcher's codebase can access it whereas custom
subclasses cannot ?

And what can I do to set the mScrollX with the Scroller's current X
position ?

Thanks

G
--~--~-~--~~~---~--~~
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] ViewGroup#onInterceptTouchEvent is only called once

2009-09-30 Thread Gavin Bong

In my custom ViewGroup, I am returning false after handling the
MotionEvent.ACTION_DOWN event.

According to the javadoc:

For as long as you return false from this function, each following
event (up to and including the final up) will be delivered first here
and then to the target's onTouchEvent().


However, I notice that all subsequent events ( MotionEvent.ACTION_MOVE
and MotionEvent.ACTION_UP) are only
delivered to my #onTouchEvent method. In #onTouchEvent , I always
return true.

What could possibly be my bug ? I am running on Android 1.5r2 SDK.

Thanks a lot

Regards,

Gavin


--~--~-~--~~~---~--~~
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] Correct use of Task Affinities and LaunchModes

2009-09-28 Thread Gavin Bong

My android app contains a suite of mini apps. In short, every screen
contains a navbar with several clickable icons, one each for the mini
apps (and one for the Main screen). When an icon is clicked, the mini
app is launched. In total I have 4 mini apps. So you could imagine
that my main screen is like the Home Screen Launcher. Although these
mini apps could run standalone by their own, I want the user to be
authenticated. Thus there is a LoginActivity right before the
MainActivity.

LoginActivity --- MainActivity --- AppOneActivity or AppTwoActivity
or AppThreeActivity or AppFourActivity (aka PresenceListActivity)

I'm still not pretty sure of the benefit of Tasks (arranged set of
Activities), so I would like comments from Android experts on my
design decisions:-

(1) I plan to set the attribute finishOnTaskLaunch to true for
LoginActivity. As I understand it, once the login is authenticated, I
will navigate the user to MainActivity, and I want LoginActivity to
disappear. Is this better than calling #finish on the Activity ? Will
MainActivity automatically become the root of the Task without any
extra configuration/code ?

(2) One of the mini app is an IM client. The PresenceListActivity will
hosts many instances of ChatActivity (one-to-one chat session with an
active contact in the buddylist). I plan to use the default launchmode
for ChatActivity since each Chat should be handled by a new instance.
Sounds correct ?

(3) As for the sticky navbar, I plan to set the clearTaskOnLaunch
attribute to true for all of them. As I understand it, that should
clear the stack whenever I plan to launch into any of the mini apps.
Also their launchModes will be singleTask. Am I on the right path ?

(4) Finally I don't really understand how to read the output of adb
shell dumpsys activity. For example

Task{10 com.me.rnd.exit}
clearOnBackground=false numActivities=1
affinity=com.me.rnd.exit
lastActiveTime=5513102 (inactive for 5s)
  History #1: .

Task{2 com.android.launcher}
clearOnBackground=true numActivities=1 rootWasReset=true
affinity=com.android.launcher
lastActiveTime=5512949 (inactive for 6s)
  Running #0:
Sometimes underneath the Tasks, you will see History and in others
Running, what do these mean ? Even stranger, sometimes I have two
History under a task.

Thanks

G
--~--~-~--~~~---~--~~
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: TabHost and startActivityForResult

2009-09-09 Thread Gavin

  No one can give an answer??
--~--~-~--~~~---~--~~
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: Obtaining the exact SDK Source

2009-09-04 Thread Gavin Aiken
Hi Dianne,
Say I wasn't trying to imitate the ProgressBar class but I merely wanted to
know what version of the view class I extend when I *extend View*? I totally
understand and appreciate that ProgressBar has access to private APIs but if
I extend the ProgressBar in the SDK I have a different set of methods to
those available in the source I have from git. I just want to know what
version of ProgressBar is in 1.5-r3.

Many thanks,

Gav

On Wed, Sep 2, 2009 at 5:51 PM, Dianne Hackborn hack...@android.com wrote:

 You very often can't just copy code out of the framework, because it by
 definition has full access to private APIs (since it is also the thing that
 contains the private APIs).  You'll need to make any necessary changes to
 get it to compile cleanly against the SDK.


 On Wed, Sep 2, 2009 at 3:13 AM, Gavin Aiken gavin.ai...@imperial.ac.ukwrote:

 Hey All,
 I was hoping someone could give me instructions to obtain the *exact *source
 code for the current SDK. What I have so far is as discussed here;


 http://androidforums.com/android-developers/1045-source-code-android-jar.html

 By using commands such as;

 repo init -u git://android.git.kernel.org/platform/manifest.git -b
 android-sdk-1.5_r3
 jar cvf ../android-src.jar -C core/java .
 ...
 etc.

 My issue is that the source is still inconsistent, some extra methods are
 available and some are not. For example, I want to make a progress bar with
 two sliders (To select a range) but the version of Progress bar I have;


 http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/widget/ProgressBar.javahttp://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/widget/ProgressBar.java;

 I cannot mimic (as an initial implementation), despite using the same
 package and extending View I do not have access to 'mMinWidth' for example.
 In addition the progress bar uses methods of the class StateListDrawable
 which are not available in this SDK (e.g. getStateSet(int i)).

 It's obvious that there's an inconsistency between the source I have and
 that which was compiled into the android SDK but I don't know why given my
 GIT repo commands. Can someone link to the version of ProgressBar which was
 shipped with android-sdk-1.5_r3? Has anyone managed to get the branch which
 maps directly to this release?

 This might well be due my inexperience with Git, please let me know if
 anyone has this set up correctly and I will try again. I seem, in all
 honesty, to have the head revision still.

 Thanks in advance!

 Gavin







 --
 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] TabHost and startActivityForResult

2009-09-02 Thread Gavin

All,

 I meet an issue: my activity cannot return result.

I created an activity which has one  TabHost. I added three tabs
using mTabHost.addTab. Every tab will launch an activity(activity A,
activity B, activity C).  In activity A, it will call
startActivityForResult to start activity A1. The issue is activity A
cannot get any result after A1 finish.

   What is the reason? How should I do if I want to get return value?
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: TabHost and startActivityForResult

2009-09-02 Thread Gavin


More, I am using localActivityManager for tabHost.  mTabHost.setup
(localActivityManager).
--~--~-~--~~~---~--~~
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] Obtaining the exact SDK Source

2009-09-02 Thread Gavin Aiken
Hey All,
I was hoping someone could give me instructions to obtain the *exact *source
code for the current SDK. What I have so far is as discussed here;

http://androidforums.com/android-developers/1045-source-code-android-jar.html

By using commands such as;

repo init -u git://android.git.kernel.org/platform/manifest.git -b
android-sdk-1.5_r3
jar cvf ../android-src.jar -C core/java .
...
etc.

My issue is that the source is still inconsistent, some extra methods are
available and some are not. For example, I want to make a progress bar with
two sliders (To select a range) but the version of Progress bar I have;

http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/widget/ProgressBar.javahttp://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/widget/ProgressBar.java;

I cannot mimic (as an initial implementation), despite using the same
package and extending View I do not have access to 'mMinWidth' for example.
In addition the progress bar uses methods of the class StateListDrawable
which are not available in this SDK (e.g. getStateSet(int i)).

It's obvious that there's an inconsistency between the source I have and
that which was compiled into the android SDK but I don't know why given my
GIT repo commands. Can someone link to the version of ProgressBar which was
shipped with android-sdk-1.5_r3? Has anyone managed to get the branch which
maps directly to this release?

This might well be due my inexperience with Git, please let me know if
anyone has this set up correctly and I will try again. I seem, in all
honesty, to have the head revision still.

Thanks in advance!

Gavin

--~--~-~--~~~---~--~~
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: Inserting large volumes of data into SQLite - speed issues

2009-09-02 Thread Gavin Aiken
Does the data NEED to be on the device? Can it not reside on a server?
Certainly you are better to manage the synchonisation yourself rather than
bundle the 120MB lib for downloading through the marketplace. This sort of
download needs to be resumable and I would recommend users only download
with a Wifi connection.

What sort of data is this?! It would have to be incredible to justify that
size to most users, I think with a 3 hour install you have lost 99% of the
user base without even knowing if the app is any good.

Gav

On Wed, Sep 2, 2009 at 4:47 PM, mjc147 westmead...@yahoo.co.uk wrote:


 I need to insert approximately one million rows of data (spread over 4
 tables) - each row has one or two numeric fields, and two or three
 text fields (normally quite short). Single-column indexes on all the
 fields.

 After doing some tests on the emulator with a small test set, I
 extrapolated (assuming the last row will be inserted with a similar
 speed to the first row) my results to figure out that this would take
 about 15 hours (I have a Core 2 Duo running Vista).

 However, then I tried running the small test set on my Hero and I was
 surprised to see it run more than four times faster. I would guess it
 would take about 3 hours on the Hero.

 Alternatively, I could make the pre-populated database available as a
 download on the first run but this is likely to be a 120MB download.

 I have a few questions I'm hoping someone can help me with:

 1. SQLite performance on the actual device being 4-5 times faster
 compared to the emulator - is this normal/expected?
 2. Do the figures above generally sound fast/slow/normal (sorry this
 is so vague)?
 3. From a user perspective - would it be best to provide a 120MB
 download or a 3 hour first-time initialisation step (plus 6MB
 download)?
 


--~--~-~--~~~---~--~~
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] AutoCompleteTextView

2009-08-12 Thread Gavin

all,

   Is there any method to control popup window in
AutoCompleteTextView? Such as location, background...?

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

2009-08-12 Thread Gavin

I guess it may control the display stytle of listview in popup window.
But how to adjust the location of popup window?

 On Aug 12, 4:38 pm, peter heywoodpres...@gmail.com wrote:
 Create a adpter extends BaseAdpter to fill AutoCompleteTextView

 On Aug 12, 3:40 pm, Gavin fjm...@gmail.com wrote:

  all,

 Is there any method to control popup window in
  AutoCompleteTextView? Such as location, background...?

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

2009-08-12 Thread Gavin

 AutoCompleteTextView has an instance of Popup window. But the class
AutoCompleteTextView doesn't have any public method to control popup
window. :(
--~--~-~--~~~---~--~~
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: AutoCompleteTextView

2009-08-12 Thread Gavin

 AutoCompleteTextView has an instance of Popup window. But the class
AutoCompleteTextView doesn't have any public method to control popup
window. :(
--~--~-~--~~~---~--~~
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: AutoCompleteTextView

2009-08-12 Thread Gavin

 AutoCompleteTextView has an instance of Popup window. But the class
AutoCompleteTextView doesn't have any public method to control popup
window. :(
--~--~-~--~~~---~--~~
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 package question.

2009-07-22 Thread Gavin

hello,

 I found there are two browser dirs at source codes and the
package names are : com.android.browser and com.android.wapbrowser.
Why?

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: data between activities

2009-06-30 Thread Gavin Aiken
Yeah, I use an Application class which holds common data. There are a few
options;

http://developer.android.com/guide/appendix/faq/framework.html#3


On Tue, Jun 30, 2009 at 8:26 AM, Saurav Mukherjee 
to.saurav.mukher...@gmail.com wrote:

 if both the activities are in the same app, yes, its possible.


 On Tue, Jun 30, 2009 at 12:47 PM, Sukitha Udugamasooriya suk...@gmail.com
  wrote:


 Is it possible to transfer data between activities without using
 extars??
  I need to access MyOwnObject in Atctivity 1 from Activity2
  Possible with using static fields?





 


--~--~-~--~~~---~--~~
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] Scaling an image

2009-06-24 Thread Gavin Aiken
Hey all!

This has been frustrating me for a while, all I want is to scale an image to
dimensions that I define whilst keeping an aspect ratio. So for example,
image comes in at 500 * 500, I want to scale to 320 * 480 so I need 320 *
320 so as not to distort the image.

This must be a simple 3 lines of code using a matrix? I just can't do it,
it's lame, i'm very tired and it turns out I suck at programming. One of
those days! :)

Any help greatly appreciated, what you have to work with is this;


float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;

scale = larger of the two scales;

// createa matrix for the manipulation
Matrix matrix = new Matrix();
// resize the bit map
matrix.postScale(scale, scale);

// recreate the new Bitmap
Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0,
  width, height, matrix, true);


Gav

--~--~-~--~~~---~--~~
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] Using an SqliteDatabase from multiple threads

2009-06-24 Thread Gavin Aiken
Hi,

I run into a bunch of errors when running my app and calling these methods
from multiple threads.

Namely;

SqlLiteMisuseException (Library called out of sequence)

SqlLiteException (unknown)  Error while compiling statement

IllegalStateException trying to use a closed reference

I understand this is poor coding on my part but I'm in deep now and i was
wondering if anyone had some reference code for good database use. It has to
be from a helper class available to multiple threads and not be an activity
in itself. I'm doing more than just display items in a list and all I can
find is examples of code that use a database for that purpose.

// Called from multiple threads
public Filter getFilter(int _id) {
// A sub call to another db query method
Filter filter = getBasicFilterDetails(_id);

Cursor c = getFilterNodes(_id);

c.moveToFirst();

MapInteger, ExpressionBitmap filterNodes = new HashMapInteger,
ExpressionBitmap();

while (!c.isAfterLast()) {
// Mapping to an object from DB rows

c.moveToNext();
}
c.close();
c = null;
// Return the output node
filter.setNodes(filterNodes);
return filter;
}

etc.

Should I just synchronize these methods?

Any thoughts appreciated.

Kind regards,

Gavin

--~--~-~--~~~---~--~~
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: Binder Thread issue.

2009-06-23 Thread Gavin

Thanks mike.
But I don't agree with you . If I stop the service through stopSelf(),
the service will not be waked up by alarm manager. It will not
repeatly download data every 5 mins.




On Jun 23, 7:57 pm, Mike Hearn mh.in.engl...@gmail.com wrote:
 They're used by the framework itself, ignore them.

 On Jun 23, 6:59 am, Gavin fjm...@gmail.com wrote:

   My app have a service and it will create athreadevery 5 mins.
  Thethreadwill connect internet to download some data, and then exit.

 That's not the right design. Instead look into the alarm manager, you
 want an inexact repeating alarm to send an intent to your service so
 your process only runs when it's actually working. Make sure that
 stopSelf() is always called, even if the process is killed half way
 through the download!
--~--~-~--~~~---~--~~
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: Binder Thread issue.

2009-06-23 Thread Gavin

OK. thanks for your suggestion. I will modify my design.
It is Binder Thread that I want to know. Is there any negative impact?

On Jun 24, 10:06 am, Mark Murphy mmur...@commonsware.com wrote:
 Gavin wrote:
  Thanks mike.
  But I don't agree with you . If I stop the service through stopSelf(),
  the service will not be waked up by alarm manager. It will not
  repeatly download data every 5 mins.

 Sure it will! Or, more accurately, your BroadcastReceiver that you
 register in the manifest for the AlarmManager will get invoked every N
 minutes, and it can restart the service.

 http://androidguys.com/?p=4411

 Though waking up and turning on WiFi five minutes means you'll wreck
 your users' battery life. I heartily recommend Jeff Sharkey's Google I/O
 presentation, Coding For Life -- Battery Life, That Is:

 http://code.google.com/events/io/sessions/CodingLifeBatteryLife.html

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

 Need Android talent? Ask on HADO!http://wiki.andmob.org/hado
--~--~-~--~~~---~--~~
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] Binder Thread issue.

2009-06-22 Thread Gavin

Hello all,
 I met an issue: when I opened DDMS, I found there are too many
Binder Thread in my app's porcess. I have no idea on Binder Thread.
where did the app create them?  why they cannot exit automatically?

 My app have a service and it will create a thread every 5 mins.
The thread will connect internet to download some data, and then exit.
Binder Thead is caused by the service? but I have never used any
binder in the service.

Who can give some suggestion? 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] How to support drag and drop on listview.

2009-06-15 Thread Gavin

Hello,
 I want to know how to manual sort with ListView by using drag and
drop?  for example, the user can drag an item from postion 2 to
position 1.
 Someone said there is a play list activity that can support it in
music application. But I cannot find it in my SDK 1.0.
 Who can provide some suggestion? If there is a demo, it is more
better.
 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] Checking the Hardware (Phone model) programatically

2009-06-13 Thread Gavin Aiken
Hi All,

I was wondering if there is a way of finding the hardware on which the
Android software stack is currently running. Specifically I'd be interested
to get the processor on which the application is being run so that I can
adjust the intensity of calculations performed.

Thanks in advance!

Gavin

--~--~-~--~~~---~--~~
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: develop a simple game like tic toc

2009-06-13 Thread Gavin Aiken
http://bakhtiyor.com/category/30-days-of-android-apps/page/2/

If you're talking about tic-tac-toe you could look here :)

Good luck

On Sat, Jun 13, 2009 at 5:22 AM, jaimin jaiminmeht...@gmail.com wrote:


 hi.
 i am new to android i have develop a some e book for android mobile
 but i never develop a game
 in android and i would like to develop a first simple  just like tic
 toc .
 so plz help me where can i start with.

 thanks
 jaimin.
 


--~--~-~--~~~---~--~~
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 execute chmod -R 777

2009-06-10 Thread Gavin Aiken
http://groups.google.com/group/android-developers/browse_thread/thread/9646c6aea5b78c1f/47238ea9d76e4887?lnk=gstq=gav+chmod#47238ea9d76e4887

Might help :)

On Wed, Jun 10, 2009 at 9:04 PM, Francesco Pace paxa...@gmail.com wrote:

 Hi guys,I have a problem. I'm working with adb shell and I have to execute
 this command :
 # chmod -R 777 /data
 but SO said : Bad usage.
 Can I have a help?
 How do to execute chmod recursively in a directory?

 Thanks, good evening.

 


--~--~-~--~~~---~--~~
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 execute chmod -R 777

2009-06-10 Thread Gavin Aiken
Well I think the guys were saying it's a bad idea, what is it that you're
trying to achieve?


On Wed, Jun 10, 2009 at 9:12 PM, Francesco Pace paxa...@gmail.com wrote:

 Thanks Gavin, so I have to modify (with chmod 777) 1:1 all file in /data
 directory.?

 2009/6/10 Gavin Aiken gavin.ai...@imperial.ac.uk


 http://groups.google.com/group/android-developers/browse_thread/thread/9646c6aea5b78c1f/47238ea9d76e4887?lnk=gstq=gav+chmod#47238ea9d76e4887

 Might help :)


 On Wed, Jun 10, 2009 at 9:04 PM, Francesco Pace paxa...@gmail.comwrote:

 Hi guys,I have a problem. I'm working with adb shell and I have to
 execute this command :
 # chmod -R 777 /data
 but SO said : Bad usage.
 Can I have a help?
 How do to execute chmod recursively in a directory?

 Thanks, good evening.







 


--~--~-~--~~~---~--~~
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 execute chmod -R 777

2009-06-10 Thread Gavin Aiken
Any context would be great, can't really help otherwise.

Are you looking to get files from the data directory of an app you've
created?

adb pull / push?

Checkout the android source and get your file from there?

On Wed, Jun 10, 2009 at 9:21 PM, Francesco Pace paxa...@gmail.com wrote:

 no i am just trying to do that for accademic reason!can i do this in an
 other way? i don't want to use 1:1!

  i'd like to use an other way , not 1.1 can u suggest something?

 2009/6/10 Gavin Aiken gavin.ai...@imperial.ac.uk

 Well I think the guys were saying it's a bad idea, what is it that you're
 trying to achieve?



 On Wed, Jun 10, 2009 at 9:12 PM, Francesco Pace paxa...@gmail.comwrote:

 Thanks Gavin, so I have to modify (with chmod 777) 1:1 all file in /data
 directory.?

 2009/6/10 Gavin Aiken gavin.ai...@imperial.ac.uk


 http://groups.google.com/group/android-developers/browse_thread/thread/9646c6aea5b78c1f/47238ea9d76e4887?lnk=gstq=gav+chmod#47238ea9d76e4887

 Might help :)


 On Wed, Jun 10, 2009 at 9:04 PM, Francesco Pace paxa...@gmail.comwrote:

 Hi guys,I have a problem. I'm working with adb shell and I have to
 execute this command :
 # chmod -R 777 /data
 but SO said : Bad usage.
 Can I have a help?
 How do to execute chmod recursively in a directory?

 Thanks, good evening.













 


--~--~-~--~~~---~--~~
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] thread question.

2009-06-09 Thread Gavin

Hi,
I have a question.
--~--~-~--~~~---~--~~
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] thread questions.

2009-06-09 Thread Gavin

Hi,
I have a question.
If I  have a list which has many url links. I want to download all
url. How should I do? There are two solutions:
   1) use only one thread to download all links. It needs a while
loop. for example,
   int i=0;
   while(ilist.length){
   download(list[i]);
   i++;
   }

   2) create a thread for a link. After the link is downloaded, create
a new thread to next link. Is it good idea?

   Please give me your suggestions. 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: thread questions.

2009-06-09 Thread Gavin

ebin, thanks

On Jun 10, 12:26 pm, ebin jose ebinjose...@gmail.com wrote:
 Hi Gavin,

 My answer is not specific to android. So please see if this is useful to
 you, else please ignore.

 I assume that you are worried about any user interaction taking place in the
 middle of this download (as the download take a while, if you follow your
 first option), and you may not be able to respond to the user request
 immediately as you are in the middle of a download. If that is what you are
 looking for then.

 In my opinion its not a good idea to create thread for every download. You
 should have only one thread doing download.

 But after every link is downloaded, you must check if there are any user
 requests or anything/any event that you need to service. Service that (if it
 requires attention), then go for the next download.

 There may be situation where you need to navigate to a previous page, or
 cancel the download etc. In such a case check for such an event and
 cancel/come out of this thread.

 -Ebin

 On Wed, Jun 10, 2009 at 9:45 AM, Gavin fjm...@gmail.com wrote:

  Hi,
 I have a question.
 If I  have a list which has many url links. I want to download all
  url. How should I do? There are two solutions:
1) use only one thread to download all links. It needs a while
  loop. for example,
int i=0;
while(ilist.length){
download(list[i]);
i++;
}

2) create a thread for a link. After the link is downloaded, create
  a new thread to next link. Is it good idea?

Please give me your suggestions. 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: Dalvik Version

2009-06-08 Thread Gavin Aiken
That's great cheers, I jsut need to quotre the VM version I ran my tests on.

Gav

On Mon, Jun 8, 2009 at 7:00 PM, fadden fad...@android.com wrote:


 On Jun 7, 7:26 am, Gavin Aiken gavin.ai...@imperial.ac.uk wrote:
  I am writing the report for my project and I was wondering if anyone
 could
  tell me how to find the current version of the Dalvik VM. My phone is a
 Dev
  phone running cupcake. I just can't find it, I'm sure it must be obvious
 but
  if any of you know I'd really appreciate a pointer.

 % adb shell dalvikvm -version

 Not sure how useful that will be.  What are you trying to do?

 


--~--~-~--~~~---~--~~
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] Dalvik Version

2009-06-07 Thread Gavin Aiken
Hi Guys,

I am writing the report for my project and I was wondering if anyone could
tell me how to find the current version of the Dalvik VM. My phone is a Dev
phone running cupcake. I just can't find it, I'm sure it must be obvious but
if any of you know I'd really appreciate a pointer.

Cheers,

Gav

--~--~-~--~~~---~--~~
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 start my service automaticaly after phone boots up.

2009-06-03 Thread Gavin

hello,

 I want to write a service in my application. I hope the service
can automaticaly access to internet and update database after phone
boots up every time. The whole process is background and no any UI
for  user.
 Is it possible? there is any demo ?

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] how to remove a directory on file system?

2009-06-02 Thread Gavin

Hello,
I have some questions.
(1)
I want to remove a directory on filesystem, it is successful but
some logs info was printed: unable to unlink /data/data/packageName/
dir1/dir2.  there are no any file in dir2.

   my codes:

   File dir = getFileStreamPath(dir1);
   File subdir=new File(dir, dir2);
   if(subdir.exists())
   {
subdir.delete();
   }

(2)
   If there are some files in dir2, can I remove the whole directory?

  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] SoftHashMap implementation - For use as a Cache of thumbnails

2009-06-02 Thread Gavin Aiken
Hi All,

I have adapted a SoftHashMap that I found online for use in my Android
application. I generate many thumbnails which use a lot of memory and are
easily traversed, I want to use an ADT like this so that I don't run out of
memory but do make use of the memory available. The cache is meant to retain
the most recently used items using hard links, the number of MRU hard links
is set via the constructor.

Can you let me know if there is a better way of doint this, any errors in my
design (Essentially lifted from
DevXhttp://archive.devx.com/java/free/articles/Kabutz01/Kabutz01-2.asp),
especially with respect to any differences in Dalvik or bonus classes in the
SDK which render it useless.

Otherwise, feel free to use it obviously :)

SoftHashMap.javahttp://code.google.com/p/miffed/source/browse/trunk/miffed/src/uk/ac/ic/doc/gea05/miffed/adts/SoftHashMap.java?r=221

Gav
http://archive.devx.com/java/free/articles/Kabutz01/Kabutz01-2.asp

--~--~-~--~~~---~--~~
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] Database Pattern - What's your method?

2009-06-02 Thread Gavin Aiken
Hi All,

I was wondering if you could shed any light on the pattern you use for your
database connections.

I have a class;


public class FilterDBHelper extends SQLiteOpenHelper{...}

With a method;

public Cursor getFilterNodes(int _id) {...}

That returns a cursor.

The activity then takes care of closing the cursor but how is it that I
close the database at the appropriate time? I presume I must wait until
after the cursor has been closed to close the database.

Do you close a database after each query? Do you close the cursor inside a
method 'close()' of FilterDBHelper that also closes the cursor?

Any advice or links to source would be greatly appreciated.

Kind regards,

Gavin

--~--~-~--~~~---~--~~
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: SoftHashMap implementation - For use as a Cache of thumbnails

2009-06-02 Thread Gavin Aiken
Hi Mark,

Thanks so much for the pointer. It is indeed from the newsletter you
mentioned, I shall be signing up too I think.

Just in case you thought I was being cheeky and passing this off as my own,
his name with a link is right at the top of the source :).

Thanks again,

Gavin

On Tue, Jun 2, 2009 at 11:31 PM, Mark Murphy mmur...@commonsware.comwrote:


  Can you let me know if there is a better way of doint this, any errors in
  my
  design (Essentially lifted from
  DevXhttp://archive.devx.com/java/free/articles/Kabutz01/Kabutz01-2.asp
 ),
  especially with respect to any differences in Dalvik or bonus classes in
  the
  SDK which render it useless.

 I think that is based on Dr. Heinz' original article (newsletter #15). He
 revised it for Java5 in newsletter #98:

 http://www.javaspecialists.eu/archive/Issue098.html

 A quick read of #98 suggests there are some memory leaks in his
 implementation of #15, so you might want to double-check which one yours
 is based upon.

 I do need to re-susbscribe to his newsletter sometime...

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com
 _The Busy Coder's Guide to Android Development_ Version 2.0 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
-~--~~~~--~~--~--~---



[android-developers] sub-thread issue.

2009-05-30 Thread Gavin

Hi,

 I have some questions about threads.
 Threre is a main thread A, and then it creats a sub-thread B. I
want to know:
1) If main thread A exits or crashs,  thread B can continue
running?
2) if the upper question's anwser is yes, is there a method that A
can notify B before A exits? How can B get A's state?

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] Simple Canvas Question

2009-05-28 Thread Gavin Aiken
Hi All,

I want to fill a bitmap with a colour. I have the a,r,g  b values. The
techinique I'm using is;

public Bitmap evaluate(Bitmap input) {
Canvas c = new Canvas(input);
c.drawARGB(a, r, g, b);
return input;
}

But my changes are not apparent in the returned bitmap.

The nature of the application is such that I need to return a bitmap but I'd
rather not have to setPixel for every x  y.

I'm hoping that this is obvious but I couldn't work out why this wasn't
working for the documentation or sample code.

Kind regards,

Gav

--~--~-~--~~~---~--~~
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: Grayscaling

2009-05-28 Thread Gavin Aiken
Hi Marco,

Would you mind giving a brief code snippet of how this might work? I've been
trying to get a similar function to run faster but when I use the bitmap the
values I thought were written by the canvas aren't there.

Kind regards,

Gav

On Tue, Apr 21, 2009 at 12:21 AM, Marco Nelissen marc...@android.comwrote:

 You can do this more efficiently by using a Paint and a ColorFilter.



 On Mon, Apr 20, 2009 at 3:59 PM, sm12 mata...@gmail.com wrote:


 Solved. The problem was in the parameters of Color.rgb.




 


--~--~-~--~~~---~--~~
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: Grayscaling

2009-05-28 Thread Gavin Aiken
Thanks for the fast response. I can't seem to saw the changes made by the
canvas in the original bitmap, my code is as follows;

int old = input.getPixel(0, 0);
Canvas c = new Canvas(input);
c.drawARGB(a, r, g, b);
int n = input.getPixel(0, 0);
if(old==n)
Log.e(TAG, Values didn't change!); // Fires
return input;

'input' is mutable but the returned bitmap retains it's old values. The
'clip' Rect is the size of the bitmap.

Do you know why this is the case?

I'm looking for a finalize or save on the canvas but they don't seem to do
the job.

Kind regards,
Gav

On Thu, May 28, 2009 at 5:19 PM, Streets Of Boston
flyingdutc...@gmail.comwrote:


 - Create a mutable bitmap from immutable. But instead of a copy, just
 create an empty one with the same width and height as the original
 one.
 - Create a canvas from this mutable bitmap (new Canvas(mutable));
 - Create a ColorFilter object. Set its saturation to 0 (this is one
 way of doing this).
  (ColorMatrixColorFilter with a ColorMatrix whose saturation is set
 to 0).
 - Create a new Paint object and set its color-filter to the
 ColorMatrixColorFilter (bwPaint).
 - Draw the original bitmap onto the new canvas:
  mutableCanvas.drawBitmap(immutable, 0, 0, bwPaint);
 - After this drawBitmap call, the mutable bitmap contains a bw
 version of your original mutable bitmap.

 On May 28, 12:00 pm, Gavin Aiken gavin.ai...@imperial.ac.uk wrote:
  Hi Marco,
 
  Would you mind giving a brief code snippet of how this might work? I've
 been
  trying to get a similar function to run faster but when I use the bitmap
 the
  values I thought were written by the canvas aren't there.
 
  Kind regards,
 
  Gav
 
  On Tue, Apr 21, 2009 at 12:21 AM, Marco Nelissen marc...@android.com
 wrote:
 
 
 
   You can do this more efficiently by using a Paint and a ColorFilter.
 
   On Mon, Apr 20, 2009 at 3:59 PM, sm12 mata...@gmail.com wrote:
 
   Solved. The problem was in the parameters of Color.rgb.- Hide quoted
 text -
 
  - Show quoted text -
 


--~--~-~--~~~---~--~~
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] Gathering Usage Data - Any ideas welcome!

2009-05-26 Thread Gavin Aiken
Hi all,

I'm currently working on a demo project and I'm about to try it out with
some users. I'd like to automatically record the way they use the
application, their navigation route, times spent in each section and
duration using the application in general etc. I was wondering if there are
any solutions for this already available and if not how would you go about
achieving such a goal?

My initial thought is that I could augment all of my UI click listeners with
a call to a custom logger class which could write the time and the element,
opening the file for writing in onStart, onResume and closing it in onStop
for the activity.

This doesn't need to be bullet proof, I'm just gathering data to improve the
UI. That being said, I'm sure developing a unified solution would help a lot
of people learn more about how their users interact with their apps and I'm
happy to do the leg work I was just hoping for some advice regarding the
approach to use.

I found this in the google internal code;

UsageStatsServicehttp://www.google.co.in/codesearch/p?hl=en#uX1GffpyOZk/services/java/com/android/server/am/UsageStatsService.javaq=android%20package:git://android.git.kernel.org%20UsageStatsl=17

Which is slightly different to what I need but made me think that perhaps a
background service would be the best option, it could presumably then be
turned on and off and therefore not be used in the deployed version. This
would remove the issue of overhead.

I'm just thinking out loud, feel free to do the same :)

Gav

--~--~-~--~~~---~--~~
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 difference between thread and service?

2009-05-26 Thread Gavin

Hello,
I want to download some data from internet.  It should not block
main UI thread.
I know both thread and service can handle the work.  What is the
difference between them?
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: What is the difference between thread and service?

2009-05-26 Thread Gavin

Could  you explain it? I am directly using thread. what is the issue
if I don't use service?

On May 27, 11:29 am, Dianne Hackborn hack...@android.com wrote:
 Service doesn't.  You still need to use a thread in it.

 On Tue, May 26, 2009 at 8:22 PM, Gavin fjm...@gmail.com wrote:

  Hello,
 I want to download some data from internet.  It should not block
  main UI thread.
 I know both thread and service can handle the work.  What is the
  difference between them?
 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] Re: How to force to update a view?

2009-05-24 Thread Gavin

But I insert an item to database from an activity, the list activity
cannot update data.I guess it cannot get notification.

On May 23, 1:10 am, Marco Nelissen marc...@android.com wrote:
 This should normally happen automatically: when the database changes, the
 cursor adapter is notified, which causes the cursor to be requeried and the
 the listview to be updated.

 On Fri, May 22, 2009 at 2:31 AM, Gavin fjm...@gmail.com wrote:

  Hello,
I have a List activity which use cursor adapter. When an item of
  database is changed, I hope the  corresponding view of this list can
  update and get new data from database.

I know the time when database is changed, but how to update 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] Re: How to force to update a view?

2009-05-24 Thread Gavin

It can work. thanks.

On May 25, 11:13 am, Christine christine.kar...@gmail.com wrote:
 A call to notifyDatasetChanged lets the list adapter know that the
 dataset has changed and it should update the view.

 On May 24, 7:16 pm, Gavin fjm...@gmail.com wrote:

  But I insert an item to database from an activity, the list activity
  cannot update data.I guess it cannot get notification.

  On May 23, 1:10 am, Marco Nelissen marc...@android.com wrote:

   This should normally happen automatically: when the database changes, the
   cursor adapter is notified, which causes the cursor to be requeried and 
   the
   the listview to be updated.

   On Fri, May 22, 2009 at 2:31 AM, Gavin fjm...@gmail.com wrote:

Hello,
  I have a List activity which use cursor adapter. When an item of
database is changed, I hope the  corresponding view of this list can
update and get new data from database.

  I know the time when database is changed, but how to update view?

  thanks.- Hide quoted text -

  - Show quoted text -
--~--~-~--~~~---~--~~
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 force to update a view?

2009-05-22 Thread Gavin

Hello,
   I have a List activity which use cursor adapter. When an item of
database is changed, I hope the  corresponding view of this list can
update and get new data from database.

   I know the time when database is changed, but how to update 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] Color Bug?

2009-05-22 Thread Gavin Aiken
Hey all,

Before I submit this I just wanted to check it's not a java nuiance.

The Color class can be used to extract rgb values from a pixel (32 bit int).


I implemented a lookup table filter and used a byte to store each individual
r g  b value to save a bit of space.

Long story short;

public void testColor(){

int nr = (byte)0; // Simulation of lookup in array of byte values
representing individual bands
int ng = (byte)0;
int nb = (byte)0;
int nc = Color.rgb(nr, ng, nb);

assertEquals(nr,Color.red(nc));
assertEquals(ng,Color.green(nc));
assertEquals(ng,Color.blue(nc));

nr = (byte)0;
ng = (byte)137;
nb = (byte)0;
nc = Color.rgb(nr, ng, nb);

assertEquals(nr,Color.red(nc));// FAIL HERE
assertEquals(ng,Color.green(nc));
assertEquals(nb,Color.blue(nc));
}

Failure in testColor:
junit.framework.AssertionFailedError: expected:0 but was:255
at uk.ac.ic.doc.gea05.miffed.os.ColorTest.testColor(ColorTest.java:44)


Any ideas?

137 is the magic number causing the error in my case, there may be more.


Cheers!

Gav

--~--~-~--~~~---~--~~
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: Color Bug?

2009-05-22 Thread Gavin Aiken
Did this in the end;
...
int nr = table[r]  0xFF;
int ng = table[g]  0xFF;
int nb = table[b]  0xFF;
...
Where table is a byte array.

Have a good weekend!!


On Fri, May 22, 2009 at 9:09 PM, Gavin Aiken gavin.ai...@imperial.ac.ukwrote:

 Hey all,

 Before I submit this I just wanted to check it's not a java nuiance.

 The Color class can be used to extract rgb values from a pixel (32 bit
 int).

 I implemented a lookup table filter and used a byte to store each
 individual r g  b value to save a bit of space.

 Long story short;

 public void testColor(){

 int nr = (byte)0; // Simulation of lookup in array of byte values
 representing individual bands
 int ng = (byte)0;
 int nb = (byte)0;
 int nc = Color.rgb(nr, ng, nb);

 assertEquals(nr,Color.red(nc));
 assertEquals(ng,Color.green(nc));
 assertEquals(ng,Color.blue(nc));

 nr = (byte)0;
 ng = (byte)137;
 nb = (byte)0;
 nc = Color.rgb(nr, ng, nb);

 assertEquals(nr,Color.red(nc));// FAIL HERE
 assertEquals(ng,Color.green(nc));
 assertEquals(nb,Color.blue(nc));
 }

 Failure in testColor:
 junit.framework.AssertionFailedError: expected:0 but was:255
 at uk.ac.ic.doc.gea05.miffed.os.ColorTest.testColor(ColorTest.java:44)


 Any ideas?

 137 is the magic number causing the error in my case, there may be more.


 Cheers!

 Gav





--~--~-~--~~~---~--~~
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: Color Bug?

2009-05-22 Thread Gavin Aiken
Thanks for the quick response and sorry for the unneccesary use of the word
bug.

I was clearly confused wrrt signed ints and 'unsigned' bytes (the values
shown in the eclipse debugger), all cleared up now!

Cheers,

Gav

On Fri, May 22, 2009 at 9:43 PM, Romain Guy romain...@google.com wrote:


 Bytes are signed in Java, so 137 is not what you want. Also,
 Color.rgb() take ints, not bytes. So (byte) 137 cast as an int results
 in rg == -119.

 On Fri, May 22, 2009 at 1:09 PM, Gavin Aiken gavin.ai...@imperial.ac.uk
 wrote:
   Hey all,
 
  Before I submit this I just wanted to check it's not a java nuiance.
 
  The Color class can be used to extract rgb values from a pixel (32 bit
 int).
 
  I implemented a lookup table filter and used a byte to store each
 individual
  r g  b value to save a bit of space.
 
  Long story short;
 
  public void testColor(){
 
  int nr = (byte)0; // Simulation of lookup in array of byte values
  representing individual bands
  int ng = (byte)0;
  int nb = (byte)0;
  int nc = Color.rgb(nr, ng, nb);
 
  assertEquals(nr,Color.red(nc));
  assertEquals(ng,Color.green(nc));
  assertEquals(ng,Color.blue(nc));
 
  nr = (byte)0;
  ng = (byte)137;
  nb = (byte)0;
  nc = Color.rgb(nr, ng, nb);
 
  assertEquals(nr,Color.red(nc));// FAIL HERE
  assertEquals(ng,Color.green(nc));
  assertEquals(nb,Color.blue(nc));
  }
 
  Failure in testColor:
  junit.framework.AssertionFailedError: expected:0 but was:255
  at
 uk.ac.ic.doc.gea05.miffed.os.ColorTest.testColor(ColorTest.java:44)
 
 
  Any ideas?
 
  137 is the magic number causing the error in my case, there may be more.
 
 
  Cheers!
 
  Gav
 
 
 
 
  
 



 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  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] Re: Color Bug?

2009-05-22 Thread Gavin Aiken
EDIT: 'signed' bytes, as you said

Cheers
On Fri, May 22, 2009 at 10:00 PM, Gavin Aiken gavin.ai...@imperial.ac.ukwrote:

 Thanks for the quick response and sorry for the unneccesary use of the word
 bug.

 I was clearly confused wrrt signed ints and 'unsigned' bytes (the values
 shown in the eclipse debugger), all cleared up now!

 Cheers,

 Gav

   On Fri, May 22, 2009 at 9:43 PM, Romain Guy romain...@google.comwrote:


 Bytes are signed in Java, so 137 is not what you want. Also,
 Color.rgb() take ints, not bytes. So (byte) 137 cast as an int results
 in rg == -119.

 On Fri, May 22, 2009 at 1:09 PM, Gavin Aiken gavin.ai...@imperial.ac.uk
 wrote:
   Hey all,
 
  Before I submit this I just wanted to check it's not a java nuiance.
 
  The Color class can be used to extract rgb values from a pixel (32 bit
 int).
 
  I implemented a lookup table filter and used a byte to store each
 individual
  r g  b value to save a bit of space.
 
  Long story short;
 
  public void testColor(){
 
  int nr = (byte)0; // Simulation of lookup in array of byte
 values
  representing individual bands
  int ng = (byte)0;
  int nb = (byte)0;
  int nc = Color.rgb(nr, ng, nb);
 
  assertEquals(nr,Color.red(nc));
  assertEquals(ng,Color.green(nc));
  assertEquals(ng,Color.blue(nc));
 
  nr = (byte)0;
  ng = (byte)137;
  nb = (byte)0;
  nc = Color.rgb(nr, ng, nb);
 
  assertEquals(nr,Color.red(nc));// FAIL HERE
  assertEquals(ng,Color.green(nc));
  assertEquals(nb,Color.blue(nc));
  }
 
  Failure in testColor:
  junit.framework.AssertionFailedError: expected:0 but was:255
  at
 uk.ac.ic.doc.gea05.miffed.os.ColorTest.testColor(ColorTest.java:44)
 
 
  Any ideas?
 
  137 is the magic number causing the error in my case, there may be more.
 
 
  Cheers!
 
  Gav
 
 
 
 
  
 



 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  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] Alarm issue.

2009-05-21 Thread Gavin

Hi, all

  I want to know how many alarms can be set in one application?
what is the length for every interval time  that I can set?
 I need many alarms and at least 1 month interval time in my
application. it is possible?
 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: Running exclusively SmallTests

2009-05-21 Thread Gavin Aiken
Hey,

Just wondering if anyone has found a way to pass the command line parameter
'-e size small' to the Android JUnit test runner as configured through
eclipse. I'd rather work within eclipse than on the command line if
possible.

Cheers,

Gav

On Sat, Apr 11, 2009 at 11:21 PM, Gavin Aiken gavin.ai...@imperial.ac.ukwrote:

 Hi all,

 To build a test suite containing only small tests I looked at the source
 examples and found 
 SmallTests.javahttp://www.google.co.in/codesearch/p?hl=en#SS2by_AKaLs/tests/src/com/android/email/SmallTests.javaq=android%20package:git://android.git.kernel.org%20SmallTestsin
  the email app test source. I assumed that I would need to add a
 Predicate to such a class as this seems not to distinguish test sizes
 (Unless the test runner infers this from the name of the suite?).

 I could then add the predicate to a TestSuiteBuilder via 'addRequirements'
 but I couldn't work out how to build a predicate based on the annotation
 class SmallTest.

 Eventually I found the 
 InstrumentationTestRunnerhttp://developer.android.com/reference/android/test/InstrumentationTestRunner.htmldocumentation
  and it seems that the command;

 adb shell am instrument -w -e size small
 com.android.foo/android.test.InstrumentationTestRunner

 Does the trick.

 I post this information for reference but also to ask if the former option
 is possible, i.e. if there is a simple predicate that I could create to
 isolate SmallTest annotated tests?

 Just for interests' sake :)

 Gav


--~--~-~--~~~---~--~~
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: Alarm issue.

2009-05-21 Thread Gavin

  I need every alarm  have different interval time and start time.

On May 21, 4:30 pm, Gavin fjm...@gmail.com wrote:
 Hi, all

   I want to know how many alarms can be set in one application?
 what is the length for every interval time  that I can set?
  I need many alarms and at least 1 month interval time in my
 application. it is possible?
  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: Alarm issue.

2009-05-21 Thread Gavin

great.

On May 21, 4:51 pm, Mark Murphy mmur...@commonsware.com wrote:
I need every alarm  have different interval time and start time.

 AlarmManager can handle that.

I want to know how many alarms can be set in one application?

 How much memory do you have?

   I need many alarms and at least 1 month interval time in my
  application.

 No you don't.

 You need one periodic alarm for every 24 hours. You then need zero or more
 other alarms to cover the specific events that need to fire at specific
 times within the current day.

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 _The Busy Coder's Guide to Android Development_ Version 2.0 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
-~--~~~~--~~--~--~---



[android-developers] Parsing special code types with SAX Parser.

2009-04-20 Thread Gavin

Hello,
 I have XML file with gb2312 code type, when I use SAX parser, it
have error info:
 not well-formated (invalid token).
 How should I do ?Thanks.



some lines of xml file:

?xml version=1.0 encoding=gb2312?
rss version=2.0
   channel
  title![CDATA[hello world]]/title
  description新闻/description
...
--~--~-~--~~~---~--~~
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: Early Look Android 1.5 SDK

2009-04-14 Thread Gavin Aiken
+1

Thank you guys

On Tue, Apr 14, 2009 at 7:58 AM, Pd lotusscr...@gmail.com wrote:


 +1

 Al Sutton wrote:
  To Xav, Dave, JBQ, Dianne, Romain, and anyone else involved in getting
 this
  out there.
 
  THANK YOU.
 
  You may not literally get a thousand thank yous in your mail box, but
 it'll
  probably be said a thousand times in various ways by developers around
 the
  world.
 
  Al.
 
  ---
 
  * Written an Android App? - List it at http://andappstore.com/ *
 
  ==
  Funky Android Limited is registered in England  Wales with the
  company number  6741909. The registered head office is Kemp House,
  152-160 City Road, London,  EC1V 2NX, UK.
 
  The views expressed in this email are those of the author and not
  necessarily those of Funky Android Limited, it's associates, or it's
  subsidiaries.
 
 
  -Original Message-
  From: android-developers@googlegroups.com
  [mailto:android-develop...@googlegroups.com] On Behalf Of Xavier
 Ducrohet
  Sent: 14 April 2009 00:31
  To: android-developers@googlegroups.com;
 android-beginn...@googlegroups.com
  Subject: [android-developers] Early Look Android 1.5 SDK
 
 
  Hello developers!
 
  I'm pleased to announce the release of an early look of the Android 1.5
 SDK.
 
  More information and download link at:
 
 http://android-developers.blogspot.com/2009/04/getting-ready-for-android-15
 .
  html
 
  Have fun!
 
  Xav
  --
  Xavier Ducrohet
  Android Engineer, Google.
 
 
 
 
  
 
 

 


--~--~-~--~~~---~--~~
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: TDD with Android 1.5

2009-04-14 Thread Gavin Aiken
In my humble setup the test application is separate to the actual
application but references it so that the required classes can be used.

http://code.google.com/p/miffed/source/browse/#svn/trunk/MiffedTest%3Fstate%3Dclosed

As such I can choose to install Miffed (The name of my app) or MiffedTest.
Upon installation of the latter I can run tests from the command line as
descibed in the comments of AllTests;

What you're referring to is a configuration requirement that predates 1.5 so
no doubt you can find the solution to this problem better explained within
this archive.

http://groups.google.com/group/android-beginners/browse_thread/thread/92cae3fad38643a4?pli=1
http://dtmilano.blogspot.com/2008/11/android-testing-on-android-platf.html

Gav


On Tue, Apr 14, 2009 at 8:43 AM, zlu zhao.lu...@gmail.com wrote:


 Thanks for the link.  I created a similar manifest file and got this
 error:

 [2009-04-14 00:28:22 - followme] Error generating final archive:
 duplicate entry: AndroidManifest.xml

 How do you fix that, now that I have 2 manifest files in different
 locations?

 On Apr 13, 11:16 pm, Xavier Ducrohet x...@android.com wrote:
  Looks at the manifest in
  SDK/platforms/android-1.5/samples/ApiDemos/tests/AndroidManifest.xml
 
  Xav
 
 
 
  On Mon, Apr 13, 2009 at 11:13 PM, zlu zhao.lu...@gmail.com wrote:
 
   I found this link:
  http://developer.android.com/guide/samples/ApiDemos/tests/src/com/exa.
 ..
   and wrote a very similar test.  I tried to run it from Eclipse as
   android junit test and got this error:  The application does not
   declare uses-library android.test.runner.
   How do I specify that?
 
   On Apr 13, 9:51 pm, zlu zhao.lu...@gmail.com wrote:
   There's better support for JUnit in 1.5.  I'm trying to test-driven a
   service class.  I see ServiceTestCase.java in 1.5.  My question is has
   anyone written their own test case extending this (if it is supposed
   to be extended)?  I could find any example online and positron doesn't
   see to have any support for testing services.
 
   Thanks,
 
   Zhao
 
  --
  Xavier Ducrohet
  Android Engineer, Google.
 


--~--~-~--~~~---~--~~
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] Running exclusively SmallTests

2009-04-11 Thread Gavin Aiken
Hi all,

To build a test suite containing only small tests I looked at the source
examples and found
SmallTests.javahttp://www.google.co.in/codesearch/p?hl=en#SS2by_AKaLs/tests/src/com/android/email/SmallTests.javaq=android%20package:git://android.git.kernel.org%20SmallTestsin
the email app test source. I assumed that I would need to add a
Predicate%20http://www.google.co.in/codesearch/p?hl=en#uX1GffpyOZk/core/java/com/android/internal/util/Predicate.javato
such a class as this seems not to distinguish test sizes (Unless the
test
runner infers this from the name of the suite?).

I could then add the predicate to a TestSuiteBuilder via
'addRequirements%20http://developer.android.com/reference/android/test/suitebuilder/TestSuiteBuilder.html#addRequirements%28com.android.internal.util.Predicate%3Candroid.test.suitebuilder.TestMethod%3E...%29'
but I couldn't work out how to build a predicate based on the annotation
class SmallTest.

Eventually I found the
InstrumentationTestRunnerhttp://developer.android.com/reference/android/test/InstrumentationTestRunner.htmldocumentation
and it seems that the command;

adb shell am instrument -w -e size small
com.android.foo/android.test.InstrumentationTestRunner

Does the trick.

I post this information for reference but also to ask if the former option
is possible, i.e. if there is a simple predicate that I could create to
isolate SmallTest annotated tests?

Just for interests' sake :)

Gav

--~--~-~--~~~---~--~~
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] Writing PerformanceTestCases

2009-04-11 Thread Gavin Aiken
Hi All,


Does anyone have a simple example of a
PerformanceTestCasehttp://www.google.co.in/codesearch/p?hl=en#uX1GffpyOZk/core/java/android/test/PerformanceTestCase.javaI
want to get some timing metrics for certain business logic functions
in my
ap.

Until now I have been using the current milliseconds and logging
functionality but if there is a better way to gather performance metrics I'd
love to hear it.

Do I have to implement the Intermediates interface or am I missing
something?

Kind regards,

Gav

--~--~-~--~~~---~--~~
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: file written to /sdcard is missing AND USB Mass Storage option missing AND no browsable drive valid...

2009-04-09 Thread Gavin

which permission need be added?

On Apr 9, 10:49 am, Richard Schilling richard.rootwirel...@gmail.com
wrote:
 Problem solved.

 There was nothing wrong - it was a permissions problem.

 Richard

 On Apr 8, 6:43 pm, Richard Schilling richard.rootwirel...@gmail.com
 wrote:



  O.K., Three problems in one, perhaps all related?

  My application writes data to a file in the /sdcard directlry.  There
  are no errors during the write.  But, the file never shows up on the
  card, in the file browser (on the device - I use Glance).  Where did
  the file go?

  When trying to browse the device from my desktop, I notice the USB
  Mass Storage option is missing .. .guess that's expected since others
  in the forum explain that it was removed in this version.

  But, I can't get my PC to browse the memory card when it's stored in
  the phone.

  So, I'm stuck.

  Yech.

  Any one know what's going on?   This all just seems to add up to a
  flaky memory management problem, but I can't be sure.

  Cheers,

  Richard- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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 login to the root of Android Dev Phone 1?

2009-04-09 Thread Gavin Aiken
Hi Guys,

I'm having the same issue. I just go a dev phone and i'm used to wiping the
database of my ap by removing it using eclipse from the
/data/data/my-ap's-namespace/databse.db location.

Now i'm developing on a dev phone I don;t have access to /data/.

I've installed terminal emulator but I need to know what command to use as a
recursive chmod on data returns the error message 'bad mode'.

# chmod 777 -R /data/

Any help greatly appreciated! I'm trying different database setups, the sql
is bundled with the apk, the database remains upon reinstallation of the app
via eclipse and hence I need to remove it manually (A better approach would
also be a welcome suggestion).

Cheers,

Gav


On Sun, Apr 5, 2009 at 4:26 AM, havexz bali.param...@gmail.com wrote:


 Well i finally get the solution..u have to use the su command to
 login as root and then have to change the permissions for the folder
 (in my case its data). Once done that then you can easily move files
 using the eclipse DDMS from the Android Dev Phone 1. But remember you
 also need to change the permissions for the file that you want to copy
 from the deviceAnd the pull and push commands only work
 outside su so you have to change permissions using su and den try
 pull or push.

 Thanks a lot to Jean-Baptiste Queru who helped me with su.



 On Mar 25, 4:30 am, David Turner di...@android.com wrote:
  pull is an adb command, you need to run it on the host (there is no
 easy
  way to send a file to your host from the system). E.g.
 
  adb pull device-path host-path
 
  On Wed, Mar 25, 2009 at 4:34 AM, havexz bali.param...@gmail.com wrote:
 
   well i am able to access the folder but still unable to get the files
   out to local system ..
   the following is the snap shot. Here i had run the su command and
   the prompt changes from $ to #
 
   # pull
   pull
   pull: not found
   # help
   help
   help: not found
   #
 
   On Mar 24, 1:28 am, havexz bali.param...@gmail.com wrote:
THANKS ITS WOKRING..:)
 
BTW is there a way i can access using the UI DDMS which comes with
eclipse IDE.?
 
On Mar 23, 10:40 pm, Jean-Baptiste Queru j...@android.com wrote:
 
 Run su in your shell, and you'll be running arootshell.
 
 JBQ
 
 On Mon, Mar 23, 2009 at 7:45 PM, havexz bali.param...@gmail.com
   wrote:
 
  Also tried login to shell using adb but i am unable to browse to
 that
  directory.. the error is given below:
  $ ls
  ls
  sqlite_stmt_journals
  cache
  sdcard
  etc
  init
  default.prop
  logo.rle
  init.trout.rc
  data
  system
  init.goldfish.rc
  sys
  proc
  init.rc
  sbin
 root
  dev
  $ ls data
  ls data
  opendir failed, Permission denied
  $
 
  On Mar 23, 9:43 pm, havexz bali.param...@gmail.com wrote:
  I am unable to copy the files from the data folder of the
 Android
   Dev
  Phone 1. I used to do that on the Emulator. I need to back up
 the
  application data so that I can restore it.
 
 --
 Jean-Baptiste M. JBQ Queru
 Android Engineer, Google.
 
 Questions sent directly to me that have no reason for being private
 will likely get ignored or forwarded to a public forum with no
 further
 warning.
 
 
 


--~--~-~--~~~---~--~~
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] Failed to create email account on emulator.

2009-04-07 Thread Gavin

Hello,

  When I create email account, it prompts Unable to open
connection to server. But the browser application can connect to
server after  I add proxy setting in settings.db.
  Is there other settings for email 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] Re: Passing ArrayList across actvities

2009-04-07 Thread Gavin

I have the same codes with you. I don't know the type of MyList, but I
think you should new it before use it. like this:

ArrayListString aList = new ArrayListString();
aList.add(new String(hello1));
intent.putExtra(MyList, aList );

it can work.

On Apr 7, 1:07 pm, a...@lg l.prade...@gmail.com wrote:
 Hi all,
 I have an ArrayListMyList aList in an activity. I would like to send
 this data to another activty.  Such that,

 ArrayListMyList aList;

 Intent intent = new Intent();
 intent.setClass(mainactivity.this, newActivity.class);
 intent.putExtra(MyList, aList );
 startActivity(intent);

 Will this work out..??

 On the receiving activity,

  Intent i = getIntent();
 newList = (ArrayListMyList) i.getSerializableExtra(MyList);

 But this gets me no where ERROR..!!!

 Please help me..how to approach this problem...

 My intention is to share this List between activities...

--~--~-~--~~~---~--~~
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: Taking a picture Intent?

2009-04-06 Thread Gavin Aiken
Hey,

Currently you can only get a very small resolution image but I expect this
to be changed in Cupcake (I don't know though).

android.media.action.IMAGE_CAPTURE

Is the intent you want search this list for it to get mroe info, on the
emulator this yields a very low resolution still image from the movie office
space I think, very strange. Or is that just happening to me?

OpenIntents is a great resource for this sort of question
http://www.openintents.org/en/intentstable

Gav

On Mon, Apr 6, 2009 at 10:33 AM, zeeshan genx...@gmail.com wrote:


 Hi,

 i have the same question, anybody answer plz

 On Apr 6, 4:07 am, Ivan Soto ivanso...@gmail.com wrote:
  Hi, I have an Activity for my application to take pictures and store them
  with a content provider.
 
  The problem is that obviously I would like the picture to auto rotate
  depending if I have my phone in landscape or not and I would like to use
 the
  autofocus feature. So I'm wondering if I could just call a Camera app
 intent
  and get the URI of the picture taken.
 
  is that possible? I remind reading that it will only give me a small size
  picture.
 
  Thanks!
 
  Ivan Soto Fernandez
  Web Developerhttp://ivansotof.com
 


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



[android-developers] Image Manipulation - getPixel on a PNG resource error - bug?

2009-03-15 Thread Gavin Aiken
Hi all!

I am trying to perform a transformation on an image, specifically a PNG
although any lossless format supported by Android would suit me, when
running my test suite I keep getting errors that the new pixel values I'm
creating are slightly wrong.

To narrow the problem I ran my tests with a single pixel PNG image and got
some bizarre results. I started by opening the file with gimp and using the
pippet to grab the argb value (Not very scientific I know) the pixel has the
following properties;

Red: 250
Green:  114
Blue:142
Hex: 0xFA728E
Binary: 0b1010 01110010 10001110

To me this suggests the file is stored in 32 bit depth and not the RGB_565
later reported, do images in res/raw get reduced to 16 bit when packaged
with an application?

In my test case I check that the values agree in the preconditions

   @SmallTest
   public void testPreconditions() {
 super.testPreconditions();
 assertEquals(String.format(Get Pixel doesn't map to test data
%n%s%n%s%n,MiffedTest.getBitPattern(b.getPixel(0,0)),
MiffedTest.getBitPattern(*0xfffa728e*)),b.getPixel(0,0), 0xfffa728e);
   }

I eventually get the following report;

Failure in testPreconditions:
junit.framework.AssertionFailedError: Get Pixel doesn't map to test data

 0111 01110001 10001100
 1010 01110010 10001110
expected:-560756 but was:-363890

I decode the single pixel PNG using the following command;

b =
BitmapFactory.decodeResource(getContext().getResources(),R.raw.test);

The config for b is RGB_565 , this worries me, I was using the format in the
hope that it was lossless but 16 bit colour is not a great sign, I feel like
the crux of this issue lies in the conversion from RGB_565 - ARGB_
which much take place in the getPixel method.

Does anyone know why these values are out? They're such minor amounts but
the issues grow the more work I do to an image.
How is the conversion from the RGB_565 format to the 32 bit integer returned
by getPixel done? Some low end bits seem to be set so it's not the method
I'm used to.
Is there any other way to get at the raw pixel data if the methods are
inaccurate?
Is there any way for me to store or convert a PNG in ARGB_ on the
platform? I just need to be able to get the exact 32 bit value of any pixel
from the image.

Any information would be greatly appreciated.

Kind regards,

Gav

--~--~-~--~~~---~--~~
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 can I source-level debugging in unit test caes in android under eclipse with ADT?

2009-03-14 Thread Gavin Aiken
Hi Ying,

Did you ever work out how to debug using adb shell am instrument? I can't
work out what the flag to allow this is.

Kind regards,

Gav

On Mon, Feb 2, 2009 at 8:09 PM, ying lcs ying...@gmail.com wrote:


 By following this:

 http://dtmilano.blogspot.com/2008/11/android-testing-on-android-platf.html

 I can run the unit test cases either by :
 1. command line ' adb shell am instrument -w
 com.example.android.apis.tests/android.test.InstrumentationTestRunner'
 2. Go to 'Dev' and clicks 'Instrumentation' and click 'Test API Demo'

 But my questions now is, how can I debug my unit test cases? I try
 'Debug' my APIDemoTest eclipse project and then
 do #2 above, it did not break at any of my breakpoints I setup.

 Thank you for any pointers

 


--~--~-~--~~~---~--~~
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 can I source-level debugging in unit test caes in android under eclipse with ADT?

2009-03-14 Thread Gavin Aiken
http://developer.android.com/reference/android/test/InstrumentationTestRunner.html
*
 To debug your tests, set a break point in your code and pass: -e debug
true
in addition to the other arguments. *

Knew i'd read it somewhere!

Gav

On Sat, Mar 14, 2009 at 8:53 PM, Gavin Aiken gavin.ai...@imperial.ac.ukwrote:

 Hi Ying,

 Did you ever work out how to debug using adb shell am instrument? I can't
 work out what the flag to allow this is.

 Kind regards,

 Gav


 On Mon, Feb 2, 2009 at 8:09 PM, ying lcs ying...@gmail.com wrote:


 By following this:

 http://dtmilano.blogspot.com/2008/11/android-testing-on-android-platf.html

 I can run the unit test cases either by :
 1. command line ' adb shell am instrument -w
 com.example.android.apis.tests/android.test.InstrumentationTestRunner'
 2. Go to 'Dev' and clicks 'Instrumentation' and click 'Test API Demo'

 But my questions now is, how can I debug my unit test cases? I try
 'Debug' my APIDemoTest eclipse project and then
 do #2 above, it did not break at any of my breakpoints I setup.

 Thank you for any pointers

 



--~--~-~--~~~---~--~~
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: JUnit and ClassNotFoundException

2009-03-13 Thread Gavin Aiken
Hi Xav,

Thanks for the tip, I'm still having trouble setting up the test project;

File
New
Android Project
Create new android project
Create Project from existing source
android/android-sdk-linux_x86-1.1_r1/samples/ApiDemos/tests

!  No activity name defined in
/home/gavin/Work/android/android-sdk-linux_x86-1.1_r1/samples/ApiDemos/tests/AndroidManifest.xml.

I understand that I have to add ApiDemos to the build path but I have to
create the project first. Apologies if this is a bit of a silly question, I
imagine the answer is right in front of me but I can't work it out.

Kind regards,

Gavin

On Fri, Mar 6, 2009 at 10:40 PM, Xavier Ducrohet x...@android.com wrote:


 The only way to test code that uses Android API is on a device or emulator.

 Look at instrumentation projects such as the ApiDemos test project
 (samples/ApiDemos/tests/)

 You will need to create an Eclipse project for ApiDemos and one of the
 test project.
 ADT doesn't fully support this at this point, so you'll need to add
 the ApiDemos project to the build path of the test project so that it
 compiles.

 You then need to install both apk on the device, and use the am
 instrument ... command on the device (through adb shell).
 More information at

 http://developer.android.com/reference/android/test/InstrumentationTestRunner.html

 Xav

 On Fri, Mar 6, 2009 at 1:24 PM, Gavin Aiken gavin.ai...@imperial.ac.uk
 wrote:
  Hi Bo,
 
  Did you resolve this issue? I'm having a similar problem.
 
  My test suite is a separate eclipse project, I need to test my android
  program against a desktop Java program in order to verify that I have
 ported
  the application correctly.
 
  To so this I need to use classes from both the JAI library and Android
  library.
 
  My test package is currently setup as a java project, I assumed the JAI
  library wouldn't compile to dex but that the android classes would
 compile
  to java class files. I'm guessing that the latter is incorrect as any
  methods I call return a stub error;
 
  60.  return Bitmap.createBitmap(pixels, 0, width, width, height,
  Bitmap.Config.ARGB_);
 
  java.lang.RuntimeException: Stub!
  at android.graphics.Bitmap.createBitmap(Bitmap.java:27)
  at
 
 uk.ac.ic.doc.gea05.miffed.operators.concreteoperators.binary.TestIdentityTransform.generateBitmap(TestIdentityTransform.java:60)
 
  I'm presuming that I can't get this to work, and submit this comment for
  reference. If there is a way to use Java Libraries in a test with android
  api calls then please let me know!
 
  Gav
 
 
  On Tue, Jan 6, 2009 at 10:07 AM, Bo bo.majew...@gmail.com wrote:
 
  I am trying to run a unit test in Eclipse. I followed Android FAQ
  (http://code.google.com/android/kb/troubleshooting.html#addjunit) to
  get JUnit working. Unfortunately, it works only if tested code does
  not reference any android classes. As soon as it does, I get the
  following exception, when running the test (if the class in question
  implements Parcelable):
 
  Caused by: java.lang.ClassNotFoundException: android.os.Parcelable
 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
 ... 33 more
 
  I tried including android.jar file explicitly, but then I got an
  exception claiming that RectF (an instance variable in my class) is a
  stub. Anybody knows how to setup Eclipse to run a unit test with
  classes that either implement, extend or use android classes?
 
 
 
 
 
  
 



 --
 Xavier Ducrohet
 Android Engineer, Google.

 


--~--~-~--~~~---~--~~
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 hide signal icon and clock icon at status bar?

2009-03-09 Thread gavin

Hello,

 I want to hide the two icons but not the whole status bar when
user enters my application. After exit my application, the two icons
can be re-displayed. How should I do ? 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: Bitmaps (.bmp) don't show up in 'Pictures' when on SDCard

2009-03-08 Thread Gavin Aiken
Thanks clark, I wasn't aware png was lossless, I changed the format and it
all works fine!

Cheers,

Gav

On Sat, Mar 7, 2009 at 5:35 PM, clark clarkd...@gmail.com wrote:


 The .png file format employs lossless data compression.  You may give
 that a try.  I even through a .png image onto my SD card and it shows
 up within the Pictures application just fine.


 ~Clark

 On Mar 7, 8:13 am, Gav gav.ai...@googlemail.com wrote:
  Hi,
 
  For the purpose of testing I need to store some small (20x20px)
  bitmaps on the SDCard of the emulator.
 
  If I store the files in jpg format then media scanner picks them up
  and I can view them with the stock 'Pictures' application.
 
  When I use the '.bmp' file format as created via the JAI based tool I
  am testing, the files do not show up on the phone, a look at the file
  explorer shows the files to be there next to their jpg equivalents on
  the SDCard under the folder pictures.
 
  I mount the SDCard to add the files if it makes any difference.
 
  I need the files to be lossless ARGB_ format, is there something
  other than .bmp I can use?
 
  Kind regards,
 
  Gav
 


--~--~-~--~~~---~--~~
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] SimpleCursorAdapter and OnListItemClick - Simple question

2009-03-08 Thread Gavin Aiken
Hi guys,

I use a SimpleCursorAdapter like this;

@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
this.getIntent().getIntExtra(category, -1);
Integer category = this.getIntent().getIntExtra(category,
-1);
SqliteFilterMediator mediator = new
SqliteFilterMediator(this);
ListAdapter adapter =
new SimpleCursorAdapter(this,
R.layout.row,
c,
new String[] {column},
new int[] {R.id.name});
setListAdapter(adapter);
}

public void onListItemClick(ListView parent, View v, int position,
long id) {
   // Position doesn't necessarily map to _id
setResult(RESULT_OK, this.getIntent().putExtra(_id,
position));
finish();
}

I want to return the 'id' which is paired with the text on the ListItem in
the database (And in the cursor). Currently I return the position of the
list item clicked.

The cursor might return items with ids that are out of order with the
position of the list, or it could contain gaps in the sequence of integers,
as such the position isn't enough to map to the id of the row selected in
the database so that I can act acordingly.

I hope my situation makes sense, I think it might involve displaying the id,
casing the view clicked and somehow grabbing the displayed integer back as
the id, this seems a bit ridiculous though so I'm hoping there is a simpler
way to retrieve the id without making another database query.

Many thanks!

Gav

--~--~-~--~~~---~--~~
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: SimpleCursorAdapter and OnListItemClick - Simple question

2009-03-08 Thread Gavin Aiken
This works for me;

private Cursor c;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Integer category = this.getIntent().getIntExtra(category, -1);
mediator = new SqliteMediator(this);
c = mediator.getFitlerNames(category);
ListAdapter adapter =
new SimpleCursorAdapter(this,
R.layout.row,
c,
new String[] {column},
new int[] {R.id.name});
setListAdapter(adapter);
}

public void onListItemClick(ListView parent, View v, int position, long
id) {
c.moveToPosition(position);
int filterId = c.getInt(0);
c.close();
mediator.onStop();
setResult(RESULT_OK, new Intent().putExtra(_id, filterId));
finish();
}

On Sun, Mar 8, 2009 at 7:56 PM, Gavin Aiken gavin.ai...@imperial.ac.ukwrote:

 Hi guys,

 I use a SimpleCursorAdapter like this;

 @Override
 public void onCreate(Bundle icicle) {
 super.onCreate(icicle);
 this.getIntent().getIntExtra(category, -1);
 Integer category = this.getIntent().getIntExtra(category,
 -1);
 SqliteFilterMediator mediator = new
 SqliteFilterMediator(this);
 ListAdapter adapter =
 new SimpleCursorAdapter(this,
 R.layout.row,
 c,
 new String[] {column},
 new int[] {R.id.name});
 setListAdapter(adapter);
 }

 public void onListItemClick(ListView parent, View v, int position,
 long id) {
// Position doesn't necessarily map to _id
 setResult(RESULT_OK, this.getIntent().putExtra(_id,
 position));
 finish();
 }

 I want to return the 'id' which is paired with the text on the ListItem in
 the database (And in the cursor). Currently I return the position of the
 list item clicked.

 The cursor might return items with ids that are out of order with the
 position of the list, or it could contain gaps in the sequence of integers,
 as such the position isn't enough to map to the id of the row selected in
 the database so that I can act acordingly.

 I hope my situation makes sense, I think it might involve displaying the
 id, casing the view clicked and somehow grabbing the displayed integer back
 as the id, this seems a bit ridiculous though so I'm hoping there is a
 simpler way to retrieve the id without making another database query.

 Many thanks!

 Gav





--~--~-~--~~~---~--~~
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: JUnit and ClassNotFoundException

2009-03-06 Thread Gavin Aiken
Hi Bo,

Did you resolve this issue? I'm having a similar problem.

My test suite is a separate eclipse project, I need to test my android
program against a desktop Java program in order to verify that I have ported
the application correctly.

To so this I need to use classes from both the JAI library and Android
library.

My test package is currently setup as a java project, I assumed the JAI
library wouldn't compile to dex but that the android classes would compile
to java class files. I'm guessing that the latter is incorrect as any
methods I call return a stub error;

60.  return Bitmap.createBitmap(pixels, 0, width, width, height,
Bitmap.Config.ARGB_);

java.lang.RuntimeException: Stub!
at android.graphics.Bitmap.createBitmap(Bitmap.java:27)
at
uk.ac.ic.doc.gea05.miffed.operators.concreteoperators.binary.TestIdentityTransform.generateBitmap(TestIdentityTransform.java:60)

I'm presuming that I can't get this to work, and submit this comment for
reference. If there is a way to use Java Libraries in a test with android
api calls then please let me know!

Gav


On Tue, Jan 6, 2009 at 10:07 AM, Bo bo.majew...@gmail.com wrote:


 I am trying to run a unit test in Eclipse. I followed Android FAQ
 (http://code.google.com/android/kb/troubleshooting.html#addjunit) to
 get JUnit working. Unfortunately, it works only if tested code does
 not reference any android classes. As soon as it does, I get the
 following exception, when running the test (if the class in question
 implements Parcelable):

 Caused by: java.lang.ClassNotFoundException: android.os.Parcelable
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
... 33 more

 I tried including android.jar file explicitly, but then I got an
 exception claiming that RectF (an instance variable in my class) is a
 stub. Anybody knows how to setup Eclipse to run a unit test with
 classes that either implement, extend or use android classes?


 


--~--~-~--~~~---~--~~
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] Gesture detection using touchscreen and accelerometer

2009-02-25 Thread Gavin Aiken
Hi Guys,
I want to use gestures for navigation in my application. The classic would
be to draw clockwise / counter clockwise on the screen for zooming. Does
this functionality exist as is? Any third party libraries? Any reason why I
shouldn't attempt to write one if it doesn't exist?

I had a decent search and all I could find was this;

http://groups.google.com/group/android-challenge/browse_thread/thread/9a43583613bb5c2c

And this;

http://www.youtube.com/watch?v=-ybFRlq1hm4

Which are both pretty cool! Nothing concrete though, there's also an empty
google code project;

http://code.google.com/p/android-gestures/

Can anyone point me in the right direction? I want to focus on an innovative
and intuitive UI for my project and I think gestures are the way to go.

Cheers,

Gav

--~--~-~--~~~---~--~~
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] Populating a database efficiently

2009-02-20 Thread Gavin Aiken
Hi all,
It currently takes my onCreate method 147 seconds to create and populate my
database, if anyone with a better knowledge of SQLite could help me reduce
this it would be greatly appreciated.

I have want to create a database with three tables;


   1. CREATE TABLE nodeConfigurations (nodeId INTEGER PRIMARY KEY
AUTOINCREMENT  NOT NULL , filterId INTEGER NOT NULL , left INTEGER NOT
   NULL , right INTEGER NOT NULL , type INTEGER NOT NULL , parameters
   TEXT);
   2. CREATE TABLE data (dataId INTEGER PRIMARY KEY  AUTOINCREMENT  NOT
   NULL , dataName TEXT NOT NULL );
   3. CREATE TABLE nodes (nodeId INTEGER PRIMARY KEY  NOT NULL ,
   nodeType TEXT NOT NULL );

These three lines are stored in a file under the raw directory, one command
on each line.

I have data to insert of the form;

   1. 24 x INSERT INTO nodes VALUES(1,'type');
   2. 1000 x INSERT INTO data VALUES(1,'name');
   3. 13589 x INSERT INTO nodeConfigurations VALUES(1,1000,5,6,1,'[]');

These 14614 separate insertion commands are stored one on each line in
another file in the raw resource directory.

My database helper is defined thus;

public class DBHelper extends SQLiteOpenHelper {

public void onCreate(SQLiteDatabase db) {
this.db = db;
long start = System.currentTimeMillis();
try{
Scanner sql = new
Scanner(context.getResources().openRawResource(R.raw.database_schema));

db.beginTransaction();
while(sql.hasNextLine()){
String command = sql.nextLine();
db.execSQL(command);
}
db.endTransaction();
 sql = new
Scanner(context.getResources().openRawResource(R.raw.database_data));

db.beginTransaction();
while(sql.hasNextLine()){
String command = sql.nextLine();
db.execSQL(command);
}
db.endTransaction();

}catch (Throwable t) {
Toast.makeText(context, Exception: +t.toString(),2000).show();
Log.w(FilterDB, Database initialization failed);
t.printStackTrace();
}

Log.i(FilterDBHelper,Database created in  + (System.currentTimeMillis()
- start) +  Milliseconds);
}
   
}


Checking the log I can see that the creation and inserts took a
whopping 147seconds I must be doing something wrong.

02-20 15:42:37.703: INFO/FilterDBHelper(281): Database created in 147844
Milliseconds


Any advice would be greatly appreciated!

Kind regards,

Gavin

--~--~-~--~~~---~--~~
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] Content Providers and Database initialisation

2009-02-18 Thread Gavin Aiken
Hey,
I have a plethora of data which is currently stored in 1000 different very
small text files, I want to store this data in an SQLite database as I feel
that this will be more space efficient and hopefully time efficient as I
presume a database query is faster than opening and parsing a text file
(please stop me now if this isn't the case!).

The data does not need to be available to other applications and will be
used internally only. My first question is whether or not to create a
content provider anyway, is there any benefit to this?

My second question is where to initialize the database, is it possible to
ship an application with a database included already populated? Do I have to
populate it in the onCreate method of the SQLiteOpenHelper subclass? If I
have to include the 1000 text files and read, parse and insert the data at
install time I have a feeling this would be slow. Is it possible for me to
populate the database now, dump it to a single file and then bulk insert
from the file in the onCreate method?

I hope you get the jist of what I mean!

Many thanks,

Gav

--~--~-~--~~~---~--~~
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: Loading DEX files at runtime from SDCARD - Possible?

2009-02-09 Thread Gavin Aiken
Thanks for the response Dianne, I still live in the cotton wool word of
University where third parties are friendly types.
Understood, I did some more searching and found another thread in which you
contributed regarding this topic;

http://groups.google.com/group/android-developers/browse_thread/thread/7ee9248deeacd556/b116df9cffe4e045?lnk=gstr#b116df9cffe4e045

In case anyone else is on this trail.

I will also reply to your message there as I need a little
further clarification on the options available for a plugin style
architecture.

Kind regards,

Gavin

On Mon, Feb 9, 2009 at 8:03 PM, Dianne Hackborn hack...@android.com wrote:

 Sorry, this is not currently supported.

 And you really really wouldn't want to do this, because it would allow any
 other app installed on the device to take over your own and use any of its
 permissions for malicious purposes under the guise of being you.

 On Mon, Feb 9, 2009 at 5:09 AM, Gav gav.ai...@googlemail.com wrote:


 Hey!

 BACKGROUND

 I would like my users to develop their own routines for image
 manipulation. Lets presume that a third party has written a class
 which implements one of my interfaces;

 public abstract class PixelBinaryFilter extends BinaryFilter{
 ...
protected abstract int generatePixel(int p1, int p2);
 ...
 }

 And hence has a class with one method defined, which could multiply
 pixel values together, subtract them find their lowest common multiple
 basically any routine they can think of.

 This class would be complied and then converted to DEX using the dx
 tool.

 The third party would then download the .dex file to their phones
 SDCARD, probably via my application using a 'Get New Routines' request
 which takes the URL of the file.

 QUESTION

 If I have a .dex file on the SDCARD how can I load it at runtime? The
 class name and path would be known.

 I have been using the Class.forName command for the standard routines
 but I don't know how (if) this will work with classes outside of the
 application.

 Many thanks,

 Gavin





 --
 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.  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] Re: Make a photo with Android Emulator

2009-01-22 Thread Gavin Aiken
There is a command line tool for making an SD card, you then need to pass it
in as a command line argument to the emulator.
Presuming tools is in your PATH;

Command line: mksdcard 1024M sd.iso
Argument to emulator: -sdcard C:\PATH_TO_SD\sd.iso
Add files manually: adb push local_file sdcard/remote_file

A quick google search for Android sdcard yielded this previous question;

http://groups.google.com/group/android-developers/browse_thread/thread/9d068936b43c5f27?pli=1

with a link to a tutorial should you need further instruction.

Hope this helps!

Gav

On Thu, Jan 22, 2009 at 10:18 AM, ANDREA P andrewpag...@gmail.com wrote:


 If I use the Camera of Emulator appear this text :Please insert the
 SDCARD before using the Camera

 How do I simulate a SDCARD 

 Thanks !



 On 21 Gen, 21:06, Dave Sparks davidspa...@android.com wrote:
  You need to call startPreview() before takePicture. You also need to
  supply a PictureCallback function to receive the encoded JPEG. By
  passing null, you are telling the camera service you don't want the
  final JPEG image.
 
  On Jan 21, 2:50 am, ANDREA P andrewpag...@gmail.com wrote:
 
   I want to use the camera tomakeaphotosnapshot with Android .
 
   At the beginning in my code :
 
   Camera mCamera = Camera.open();
 
   PictureCallback callback = null;
   mCamera.takePicture(null, null, callback);
 
   but nothing doesn't happen 
 
   And if I Use the program Camera of the phone Emulator says that I have
   to insert the SD  Card.
 
   Please Help me..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: Emit a signal

2009-01-21 Thread Gavin Aiken
Hey Nico,
Can you clarify the question, you want an action to be performed after a
button is clicked? As in with a button listener? Or is your request more
complex than this?

Cheers,

Gav

On Wed, Jan 21, 2009 at 8:31 AM, Nico nicolas.d...@gmail.com wrote:


 Hi,
 I need to emit a signal clicked to a button. How can I do it ?
 Thx.
 


--~--~-~--~~~---~--~~
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] GUI Design - Are there standards for user interface design in Android?

2009-01-12 Thread Gavin

Hi all,

I am doing some background research for an Android project and was
wondering if there are any good journals or books which look at user
interface design. I remember taking a more general UI class which
taught us about the Gestalt principles etc but I'm looking for any
research done on small touch screen devices.

I'd be interested in any more general texts that you have found useful
also. User interface design isn't my forte and it'd be great to follow
a set of guidelines to try and abide by.

I appreciate that using Widgets should take care of a lot of the UI
design for me but this is a university project and I need to do some
background research none the less.

Many thanks in advance!

Gav

--~--~-~--~~~---~--~~
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] Looking for a TextView with hyperlinks

2008-07-21 Thread Gavin Bong

Has anyone opensourced a TextView that will render urls as clickable
links (fire up WebKit on receiving a clickc event) ? If not, I'll
write one myself.

Thanks

Gavin
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] SQL aggregate functions via SqlQueryBuilder

2008-06-28 Thread Gavin Bong

Hi,

I want to run a query of the form:

select sum(salary) from people where department=23

I'm not sure how to do it via the SqlQueryBuilder? Is there an
alternative solution ?

Thanks all.

Regards.

Gavin
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: SQL aggregate functions via SqlQueryBuilder

2008-06-28 Thread Gavin Bong

Just discovered SQLiteDatabase.rawQuery( ... )
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Why do I get this SQLiteCursor exception ?

2008-06-28 Thread Gavin Bong

Specifically what causes this to happen ? Thanks.


DEBUG/dalvikvm(927): Exception Ljava/lang/IllegalStateException; from
SQLiteCursor.java:403 not caught locally
INFO/dalvikvm(927): Uncaught exception thrown by finalizer (will be
discarded):
INFO/dalvikvm(927): Ljava/lang/IllegalStateException;: Finalizing
cursor [EMAIL PROTECTED] on reports that
has not been deactivated or closed
INFO/dalvikvm(927): at
android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:403)
INFO/dalvikvm(927): at android.dalvik.NativeStart.run(Native
Method)
DEBUG/SurfaceFlinger(513): Surface 2, heap=0x1236e0 destroyed
DEBUG/SurfaceFlinger(513): Surface 1, heap=0x1236e0 destroyed
DEBUG/SurfaceFlinger(513): Surface 1, heap=0x1236e0 destroyed
DEBUG/SurfaceFlinger(513): Surface 0, heap=0x1236e0 destroyed
DEBUG/SurfaceFlinger(513): Surface 1, heap=0x1236e0 destroyed
DEBUG/AdContentProvider(927): insert
DEBUG/AdContentProvider(927): inserted new uricontent://org.mape.ad/ads/1
DEBUG/AdServerService(927): received Advert for uuid
c60e02e1-2ae6-707a6b41e445-Advert28  saved as content://org.mape.ad/ads/1
VERBOSE/org.android.server.service.AdUnitDownloadServiceImpl$2(641):
Message (what=2) received
DEBUG/AdUnitDownloadService(641): numOfCallbacks 1
DEBUG/AdUnitDownloadService(641): Broadcast advert
c60e02e1-2ae6-707a6b41e445-Advert32
INFO/DEBUG(490): *** *** *** *** *** *** *** *** *** *** *** *** ***
*** *** ***
INFO/DEBUG(490): pid: 927, tid: 1164   org.android.client 
INFO/DEBUG(490): signal 11 (SIGSEGV), fault addr 03e4
INFO/DEBUG(490):  r0 001d  r1 400898c8  r2 0140  r3 
INFO/DEBUG(490):  r4 00f9  r5 ffeb  r6 0012ae18  r7 0012ae18
INFO/DEBUG(490):  r8   r9 0140  10   fp 400898c8
INFO/DEBUG(490):  ip 000e5c20  sp 42ccc644  lr ac035304  pc ac034ff0
cpsr 2010
INFO/DEBUG(490):  #01  pc ac034ff0  /system/lib/libsgl.so
INFO/DEBUG(490):  #01  lr ac035304  /system/lib/libsgl.so
INFO/DEBUG(490):  #02  pc   unknown
INFO/DEBUG(490): stack:
INFO/DEBUG(490): 42ccc600  03c0
INFO/DEBUG(490): 42ccc604  afe0e5d8  /system/lib/libc.so
INFO/DEBUG(490): 42ccc608  03c0
INFO/DEBUG(490): 42ccc60c  0140
INFO/DEBUG(490): 42ccc610  afe3c34c
INFO/DEBUG(490): 42ccc614  afe0e448  /system/lib/libc.so
INFO/DEBUG(490): 42ccc618  0012ae18  [heap]
INFO/DEBUG(490): 42ccc61c  c000
INFO/DEBUG(490): 42ccc620  01b4
INFO/DEBUG(490): 42ccc624  afe0b1df  /system/lib/libc.so
INFO/DEBUG(490): 42ccc628  00179718  [heap]
INFO/DEBUG(490): 42ccc62c  0140
INFO/DEBUG(490): 42ccc630  42a42f2c
INFO/DEBUG(490): 42ccc634  
INFO/DEBUG(490): 42ccc638  df002777
INFO/DEBUG(490): 42ccc63c  e3a070ad
INFO/DEBUG(490): 42ccc640  0003
INFO/DEBUG(490): == 42ccc644  400898c8
INFO/DEBUG(490): 42ccc648  
INFO/DEBUG(490): 42ccc64c  0012ae18  [heap]
INFO/DEBUG(490): 42ccc650  ac034fc4  /system/lib/libsgl.so
INFO/DEBUG(490): 42ccc654  0140
INFO/DEBUG(490): 42ccc658  42a42f2c
INFO/DEBUG(490): 42ccc65c  
INFO/DEBUG(490): 42ccc660  0577
INFO/DEBUG(490): 42ccc664  ac035304  /system/lib/libsgl.so
INFO/DEBUG(490): 42ccc668  
INFO/DEBUG(490): 42ccc66c  ac1067ec  /system/lib/libsgl.so
INFO/DEBUG(490): 42ccc670  0064
INFO/DEBUG(490): 42ccc674  000e5c20  [heap]
INFO/DEBUG(490): 42ccc678  
INFO/DEBUG(490): 42ccc67c  42ccc6a8
INFO/DEBUG(490): 42ccc680  03ec
INFO/DEBUG(490): 42ccc684  ac034764  /system/lib/libsgl.so
INFO/DEBUG(490): 42ccc688  ac034878  /system/lib/libsgl.so
INFO/DEBUG(490): 42ccc68c  ac034824  /system/lib/libsgl.so
INFO/DEBUG(490): 42ccc690  00150238  [heap]
INFO/DEBUG(490): 42ccc694  e0ffd8ff
INFO/DEBUG(490): 42ccc698  464a1000
INFO/DEBUG(490): 42ccc69c  01004649
INFO/DEBUG(490): 42ccc6a0  0101
INFO/DEBUG(490): 42ccc6a4  0100
INFO/DEBUG(490): 42ccc6a8  
INFO/DEBUG(490): 42ccc6ac  
INFO/DEBUG(490): 42ccc6b0  
INFO/DEBUG(490): 42ccc6b4  
INFO/DEBUG(490): 42ccc6b8  
INFO/DEBUG(490): 42ccc6bc  
INFO/DEBUG(490): 42ccc6c0  
INFO/DEBUG(490): 42ccc6c4  
INFO/DEBUG(490): 42ccc6c8  
INFO/DEBUG(490): 42ccc6cc  
INFO/DEBUG(490): 42ccc6d0  
INFO/DEBUG(490): 42ccc6d4  
INFO/DEBUG(490): 42ccc6d8  
INFO/DEBUG(490): 42ccc6dc  
INFO/DEBUG(490): 42ccc6e0  
INFO/DEBUG(490): 42ccc6e4  
INFO/DEBUG(490): 42ccc6e8  
INFO/DEBUG(490): 42ccc6ec  
INFO/DEBUG(490): 42ccc6f0  
INFO/DEBUG(490): 42ccc6f4  
INFO/DEBUG(490): 42ccc6f8  
INFO/DEBUG(490): 42ccc6fc  
INFO/DEBUG(490): 42ccc700  
INFO/DEBUG(490): 42ccc704  
INFO/DEBUG(490): 42ccc708  
INFO/DEBUG(490): 42ccc70c  

  1   2   >