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