[android-developers] Re: Newbie question: What is "this" in the code?

2011-05-16 Thread Hari Edo

On May 15, 6:33 am, tyliong  wrote:
> I am a newbie developer and have done iphone coding. I just don't
> understand how some code works as it is not explained in my book.

An Android book probably doesn't teach you programming, or
programming in the Java language.  Read up on the basics of
Java programming to learn about 'this' and other object
oriented concepts.

-- 
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 reverse camera view?

2011-05-13 Thread Hari Edo

I'm not sure what the value of such a preview
would be-- I thought you wanted it mirror-flipped,
but you're swapping left and right halves of the image.

You may want to read through this thread.  The
challenge is to keep your processing code lean and
efficient enough, since a phone is not going to have
a lot of CPU cycles to devote to real-time video
manipulation.

https://groups.google.com/group/android-developers/browse_thread/thread/c85e829ab209ceea/d3b29d3ddc8abf9b

On May 13, 6:13 am, Ali  wrote:
> Correct Illustration 
> URL:http://stackoverflow.com/questions/4874095/how-to-slice-reverse-camer...
>
> On May 13, 3:11 pm, Ali  wrote:
>
>
>
> > Hi
>
> > I am working on an app that will show reverse view from camera so user
> > will see constantly reverse view from camera through this app. Please
> > see 
> > illustration:http://stackoverflow.com/questions/4874095/how-to-slice-camera-view
>
> > I am not very sure how to achieve this. Any help or idea would be
> > highly appreciated. Thanks!

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


[android-developers] Re: How can we get the mobile position (e.g. by gps) all the time?

2011-04-27 Thread Hari Edo

Theoretically, a perfect accelerometer would give you your relative
velocity
change, and if you knew the initial velocity, you could get your
relative
position change.

In practice, you don't have a perfect accelerometer-- they have sample
rate limits that are pretty coarse for kinetic analysis, and it's easy
to
exceed the force limits giving you garbage data samples.  MEMS are
amazing
things, and oh so inexpensive, but they're not magic.

On Apr 27, 7:20 am, lbendlin  wrote:
> TreKing, this just gave me an idea. How about a hybrid between GPS and
> accelerometer?  Keep the GPS listener running until there was no position
> update for, let's say, 20 periods. Then disable the GPS listener and enable
> the accelerometer listener. Once movement is observed, restart the GPS
> listener.
>
> Now of course the big question is how the power consumption compares between
> the two...

-- 
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: Honeycomb Sourcecode

2011-04-08 Thread Hari Edo


On Apr 7, 3:06 pm, "JAlexoid (Aleksandr Panzin)" 
wrote:
> Why would you need Honeycomb source?


I think the issue is not "need" vs "want."  Yet.  It's doing the right
thing.  If a network router uses some open-licensed code, but doesn't
provide the sources, they are rightly brought to task for it through
a legal challenge.

If Motorola has shipped "stock Honeycomb 3.0" (per words from Google
reps here), then Motorola's users should have access to the software
on
the device.  While you can quibble about distinctions between Apache
vs GPL, and deltas from version 2.3 to version 3.0, the point is the
same:  users can't call it OPEN unless the users can have the CODE.
For Google to call it OPEN when users do not in fact have the CODE is
disingenuous at best, and becomes more nefarious over time.

Google's really good at hoovering in all kinds of data and coming up
with some sort of corporate strategy from it.  Google has not shown
the same level of ability at communicating in the other direction.
If we developers are going to be Google's partner in making Android
a success, then Google needs to communicate with us.  That goes for
Android Market, Android Platform, and all other areas upon which we
mutually depend.

-- 
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: HttpURLConnection responsecode 414-url too long issue

2011-04-08 Thread Hari Edo

As another poster was hinting, this is a job for HTTP POST, not
HTTP GET.

GET puts all arguments into the URL.  POST puts a short URL, and
then adds all of the arguments to the hidden handshaking
conversation that follows the network connection.  The good news
is that many CGI programs don't even notice that you've made the
request in a different way.  The program just gets its arguments
and is happy.  The bad news is that this is not guaranteed.

(A side benefit of POST is that all of these ugly or semi-
private facts don't show up in the URL.)

If you can't accept HTTP POST arguments this way for some
reason but you can modify the CGI script (recipeBatch in your
example), then you may get a little farther by compacting the
arguments a bit.  You have a couple hundred copies of the
characters '&ids='.  Make it one argument with + separators,
and split it on the CGI side.  That gives you a little bit
of room, but it's not unlimited by URL length like POST is.

I am hoping that those 7-digit numbers are not phone numbers.
I'd hate to think I was helpful AT ALL to someone building
an annoying telemarketing system.

On Apr 8, 3:18 am, imran ali  wrote:
> Hi all,
> i have to download data but having big ur,l it's character is going to
> increase more than 4048,
> for small url it is working fine but for big url it has been giving
> response code 414- url too long.
> what would be feasible way to handle this issue?
>
> example of url is
> "http://www.someserver.com/api/recipeBatch?
> ids=4851525&ids=4853720&ids=4856090&ids=4856180&ids=4856578&ids=
...

-- 
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: Parshing error

2011-04-07 Thread Hari Edo

On Apr 7, 2:55 am, rishabh agrawal  wrote:
> plz reply

rishabh agrawal, your question made no sense because it had no details
that we could use to understand the problem.  This is not the first
time that your questions on this forum were helpless.  Could you
please
read this page?

http://www.catb.org/~esr/faqs/smart-questions.html

-- 
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: Chinese soft keyboard and unknown character set

2011-04-06 Thread Hari Edo

Why don't you write a little code to find out?

Log.d("APP", "This is the code for the character: " + (int)ch);

Many times, self-discovery is faster than forums, and the knowledge
sticks a lot better.

On Apr 6, 2:07 pm, Kostya Vasilyev  wrote:
> Are they actually different characters, or the good old ones, just drawn
> with a wider, Chinese font?
> 06.04.2011 21:59 пользователь "Hari Edo"  написал:
>
>
>
>
>
> > The characters are made to be the same width as all other
> > Chinese characters, so that text will align as expected.
>
> > Even if I knew NOTHING about Unicode, or UTF-8 encoding,
> > I might decide to type all of the digits on the Chinese
> > soft keyboard, then cut and paste them into my Java code,
> > making a nice little filter with similar logic:
>
> > if (ch == '1') ch = '1';
> > if (ch == '2') ch = '2';
>
> > And so on. If I looked at the integer values of each
> > character, I might notice that they're all in the same
> > order, so I could do something more sophisticated for
> > all conversions in one statement, like:
>
> > ch = (char) ( (int)ch + (int)'1' - (int)'1' )
>
> > Some things require problem-specific code. I would
> > suggest reading up on Unicode, and browsing the
> > UTF-8 or Unicode code tables to learn a bit more.
>
> > Were you hoping for a magic "DWIM" API that just
> > would "Do What I Mean" for any and all situations?
>
> > On Apr 6, 9:38 am, viktor  wrote:
> >> 21212 -- Input from Chinese keyboard
> >> 21212 -- From English keyboard
>
> >> On 6 Кві, 16:22, viktor  wrote:
>
> >> > Hi,
>
> >> > I have got device with Chinese keyboard, when I type digits into
> >> > EditText and compare it with digits from English keyboard I have
> >> > different results.
>
> >> > How to convert Chinese characters to normal charset?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Chinese soft keyboard and unknown character set

2011-04-06 Thread Hari Edo

The characters are made to be the same width as all other
Chinese characters, so that text will align as expected.

Even if I knew NOTHING about Unicode, or UTF-8 encoding,
I might decide to type all of the digits on the Chinese
soft keyboard, then cut and paste them into my Java code,
making a nice little filter with similar logic:

 if (ch == '1') ch = '1';
 if (ch == '2') ch = '2';

And so on.  If I looked at the integer values of each
character, I might notice that they're all in the same
order, so I could do something more sophisticated for
all conversions in one statement, like:

   ch = (char) ( (int)ch + (int)'1' - (int)'1' )

Some things require problem-specific code.  I would
suggest reading up on Unicode, and browsing the
UTF-8 or Unicode code tables to learn a bit more.

Were you hoping for a magic "DWIM" API that just
would "Do What I Mean" for any and all situations?

On Apr 6, 9:38 am, viktor  wrote:
> 21212 -- Input from Chinese keyboard
> 21212 -- From English keyboard
>
> On 6 Кві, 16:22, viktor  wrote:
>
>
>
> > Hi,
>
> > I have got device with Chinese keyboard, when I type digits into
> > EditText and compare it with digits from English keyboard I have
> > different results.
>
> > How to convert Chinese characters to normal charset?

-- 
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: Activity lifecycle

2011-04-05 Thread Hari Edo

On Apr 4, 10:29 am, Gino  wrote:
> In my tests, it looks like onSavedInstanceState() does not get called
> when switching from portrait to landscape mode, or vice versa.

There is no 'onSavedInstanceState' method in Activity.
Is that a typo in your question, or a typo in your code?
Did you mean 'onSaveInstanceState'?

Eclipse will put a little arrow in the left margin if you
are correctly overriding a base class's method.  You can
of course make a method of any name you want, but there is
a very small likelihood that it will ever get called.

-- 
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: openGL texture render size

2011-04-02 Thread Hari Edo

On Apr 1, 11:16 pm, a a  wrote:
> But i can't understand the following algorithm
>
> function nextHighestPowerOfTwo(x) {
>     --x;
>     for (var i = 1; i < 32; i <<= 1) {
>         x = x | x >> i;
>     }
>     return x + 1;
>
> }

On the first loop, take the value and "smear" its bits
once rightward:

  x was:10010111
  x >> 1:   01001011
  x | x >> 1:   11010001

On the second loop, you could "smear" the bits once
rightward again (doing i++ in the for loop), but that
would be a waste of time since there can be no more
single 1 bits.  All the runs of 1 bits are now fatter.
So on the second loop, smear the bits TWICE rightward,
by doing (i <<= 1) in the for loop instead.

  x was:11010001
  x >> 2:   00110100
  x | x >> 2:   1101

On the third loop, smear the bits FOUR rightward,
since any 1 bit is now fatter.

  x was:1101
  x >> 4:   
  x | x >> 4:   

We're done in this example, but the loop here
also tries to smear by 8 and smear by 16.

We then add 1, to roll over to the next power of
two.

  x was:
  next power:   0001

However, because you don't want to have the
nextHighestPowerOfTwo(2048) to return 4096,
the function starts with x-1 instead of x.

-- 
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: Emulator not rotating screen?

2011-03-29 Thread Hari Edo


On Mar 29, 7:25 am, Mark Murphy  wrote:
> This is a known problem with the 2.3 emulator.


*sigh*   Seems like a pretty obvious thing to test before releasing,
wouldn't you think?

-- 
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: Stack overflow error in TextView with text = "ジョルテ"

2011-03-28 Thread Hari Edo

I've used katakana and hiragana extensively in textviews, no problem.
This is a pretty suspicious error report-- is it JUST that string?
Is it only when the textview is in a listview?  What's the full stack
trace?  Are you sure your own function is not in the recursion, like
if you change the text on an "on text changed" listener, etc.?

On Mar 28, 12:47 pm, Bjorn Backlund  wrote:
> Hello group,
> I'm getting a  stack overflow in ViewRoot.draw when using a text view
> with  text = "ジョルテ". The text view is in a ListView. Is there a way to
> catch this error and handle it gracefully?
> ---bjorn

-- 
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: On Click method not working for buttons gotten by inflating the layout!

2011-03-28 Thread Hari Edo

You're inflating a whole layout, then attaching a listener to it,
then throwing the whole layout away.  There's nothing here showing
that the layout you've inflated is actually shown or attached to
the current activity.  If it's not on the screen, it's not going
to react to clicks.

Normally, you call your activity's .setContentView() with an ID
of a layout (R.layout.level), and that does the inflating and
more importantly, the continual display of said layout.  You
can then use .findViewById() to grab various buttons or other
view types in that layout.

setContentView(R.layout.level);
Button updateLevel = findViewById(R.id.updateLevel);

If you are inflating portions of a whole activity's layouts,
then be sure to add those inflated views to the activity's
existing containers (layouts).  For example,

setContentView(R.layout.whatever);
ViewGroup group = (ViewGroup)findViewById(R.id.levelgroup);
View level = getLayoutInflater()
.inflate(R.layout.level, levelgroup, false);
levelgroup.addView(level);
Button updateLevel = levelgroup.findViewById(R.id.updateLevel);

On Mar 24, 7:58 pm, The young programmer 
wrote:
> All my other On Click methods work except the ones the I have to
> inflate the layout "to get the button". What should I do to make this
> work? Or is it just my code that is wrong?
>
> Here are how I define my On Click listeners for the problem buttons:
>
> Button updateLevel =
> (Button)getLayoutInflater().inflate(R.layout.level,
> null).findViewById(R.id.updateLevel);
>
>         updateLevel.setOnClickListener(new View.OnClickListener() {
>
>                         @Override
>                         public void onClick(View v) {
>                                 setLevelOnClick(v);
>
>                         }
>                 });
>
>    Button goBackMainMenu = (Button)
> getLayoutInflater().inflate(R.layout.play,
> null).findViewById(R.id.tomenu);
>         goBackMainMenu.setOnClickListener(new View.OnClickListener() {
>
>                         @Override
>                         public void onClick(View v) {
>                                 toMenuOnClick(v);
>
>                         }
>                 });
>
> Here are my onClick actions:
>
> protected void toMenuOnClick(View v) {
>                 setContentView(R.layout.main);
>
>         }
>
>         protected void setLevelOnClick(View v) {
>
>                 setContentView(R.layout.main);
>
>         }
>
> What is wrong?

-- 
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: custom dialog frame - how to get a pointy triangle edge

2011-03-27 Thread Hari Edo

If you mean like the SMS app, you can do that with a .9.png
image file, also called a "Nine Patch."

http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch

On Mar 27, 10:34 pm, Nick Longinow  wrote:
> Like a balloon-style dialog, with one side of the dialog having a
> triangle coming out of it so that the dialog appears to point to some
> portion of the screen.  I've seen these in alot of apps - what is the
> basic idea here?  Is it use of shapes and themes?  Any simple examples
> out there?

-- 
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: Augmented Reality and Spherical 360º Views

2011-03-26 Thread Hari Edo


On Mar 26, 10:01 pm, miguel  wrote:
> - Any tip for the sensor noise removal? Low pass filter, threeshold?
> both? any value for that filters? I tried EVERYTHING but the smooth
> problem may not be just here (so sad)
> - Any useful tip to make the overlay views move smooth?

Threading only helps separate the computation from the visuals,
so neither one gets too hung up on the other.

The most common filtering done, from Wiimotes to Google Star Map,
is kalman filtering.  It can take a bit of time and effort to
tune it right, but it will work better than anything else to
remove sensor nonrepeatability noise and jitter from an
arbitrary motion.

-- 
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: collision detection

2011-03-25 Thread Hari Edo

On Mar 25, 8:36 pm, bob  wrote:
> Does android have any libraries to help with collision detection?

Not going to give us much to go on, right?  What do you mean?
Phone-hits-pavement, finger-thumps-phone, finger-taps-widget,
circle-intersects-with-circle, rectangle-intersects-with-line,
sphere-intersects-with-ray, mesh-intersects-with-mesh, what?

Actually, I guess the answer is simpler than the question.
In all but one of those cases, the answer is generally "no."

-- 
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: SIGSEGV on free()

2011-03-23 Thread Hari Edo

On Mar 23, 11:41 pm, Dewr  wrote:
> thank you guys. I really appreciate your advice.
> I have debugged by putting this 1 line code right after free(strBuf);
> (though there is no repeating free(strBuf)...)
>
> > strBuf = NULL;


If that's all that you changed, and it "fixed" the
problem, then you WERE calling free() twice, likely
the same line of code was reached twice.  I wouldn't
call your logic really fixed, but at least now it
doesn't crash.

-- 
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: SIGSEGV on free()

2011-03-23 Thread Hari Edo

This has nothing to do with Android, per se.


Calling free(x) when x is NULL is not harmful.
Calling free(x) when x came from malloc() is not harmful.
Calling free(x) twice with the same value of x will surely SIGSEGV.
Calling free(x) with a bad value will likely SIGSEGV.

Note case 3:  if you call free(x), follow it immediately with x=NULL,
and you will probably not crash anymore.  Matching your malloc()/
free()
calls carefully and logically tends to fix such problems.




On Mar 22, 4:26 am, Dewr  wrote:
> I have tested it on Galaxy S and it worked well on Galaxy S (2.2). I have
> not tried it on another Nexus One in order to know if my Nexus One is
> faulty.
>
> and it seems like that AssetFileDescriptor is not the source of the problem,
> because the problem is still ocurring while I didn't access asset files
> directly but accessing copied ones.
>
>
>
> On Fri, Feb 25, 2011 at 1:10 PM, Dewr  wrote:
> > it often causes SIGSEGV on third for-loop. but just a moment ago SIGSEGV on
> > fourth loop.
>
> >> for ( i = 0 ; i < 4 ; i++ ) {
> >> sprintf (temp, "%s%s", header[i], index[fileno[i]]);
> >> *strBuf = getTextByIndex(&filebuf, temp);* *//malloc() in this
> >> function.*
> >> if (strBuf == NULL)
> >> buf_output[i] = NULL;
> >> else
>
> >> {
> >> buf_output[i] = (*gEnv)->NewStringUTF(gEnv, strBuf);
> >> *free(strBuf);*
> >> }
> >> }
>
> > On Thu, Feb 24, 2011 at 1:15 PM, Dewr  wrote:
>
> >> Hello, I am porting a C program.
>
> >> The problem I've met is SIGSEGV on free(). I can't see what's the root
> >> cause of it.
> >> it doesn't occur sometimes, but very often.
>
> >> I am testing it on NexusOne 2.2.1
> >> I am using Android NDK r5b and Android SDK and Eclipse ADT and Cygwin.
>
> >> I am using *android.content.res.AssetFileDescriptor* to read assets in C
> >> modules.
>
> >> Here is the messages in ndk-gdb when the problem appears.
>
> >>> (gdb) c
> >>> Continuing.
>
> >>> Breakpoint 2, Java_kr_co_pkbio_Unse_DangSaJuShinSal (env=0xaa50,
> >>> obj=0x4495b970)
> >>> at
> >>> C:/DEWR/Product/Software-Engineering/Eclipse-Workspace/Unse/jni/unse.c:1
> >>> 83
> >>> *1083free(strBuf);*
> >>> (gdb) next
>
> >>> *Program received signal SIGSEGV, Segmentation fault.*
> >>> *0xafd11c80 in __libc_android_abort ()*
> >>>from
> >>> C:/DEWR/Product/Software-Engineering/Eclipse-Workspace/Unse/obj/local/a
> >>> meabi/libc.so
> >>> (gdb) bt
> >>> #0  0xafd11c80 in __libc_android_abort ()
> >>>from
> >>> C:/DEWR/Product/Software-Engineering/Eclipse-Workspace/Unse/obj/local/a
> >>> meabi/libc.so
> >>> #1  0xbec233bc in ?? ()
> >>> Cannot access memory at address 0xc
> >>> (gdb) quit
>
> >> Here is the Java source code...
>
> >>> public static FileInfoForNativeCode openAssets(String fname) {
> >>> if (Constants.VERBOSE_LOGS)
> >>> Log.d(TAG, "openAssets("+fname+")");
>
> >>> *AssetFileDescriptor myDescriptor = null;*
> >>> try {
> >>> myDescriptor = context.getAssets().openFd(fname+".jet");
> >>> } catch (IOException e) {
> >>> e.printStackTrace();
> >>> return null;
> >>> }
> >>> FileDescriptor fd = myDescriptor.getFileDescriptor();
> >>> long off = myDescriptor.getStartOffset();
> >>> long len = myDescriptor.getLength();
>
> >>> if (Constants.VERBOSE_LOGS)
> >>> Log.d(TAG, "fd:"+fd+" off:"+off+" len:"+len);
>
> >>> return new FileInfoForNativeCode(off, len, fd);
> >>> }
>
> >> Here is the C source code...
>
> >>> char* getTextByIndex (TextFileBufType *filebuf, char *index) {
> >>> #define _INDEX_PREFIX_'@'
> >>> inti, j, lenBuf;
> >>> char*result;
> >>> charindexPrefix = _INDEX_PREFIX_;
> >>> intlenIndexPrefix = utf8len( &indexPrefix );
> >>> intlenIndex = strlen(index);
>
> >>> for ( i = 0 ; i < filebuf->total ; i++ ) {
> >>> *//__android_log_print(ANDROID_LOG_DEBUG,"TAG", "JNI : %d ->
> >>> %s", i, filebuf->text[i]);*
>
> >>> if ( memcmp (filebuf->text[i], &indexPrefix, lenIndexPrefix) != 0
> >>> )
> >>> continue;
>
> >>> if ( memcmp (filebuf->text[i]+lenIndexPrefix, index, lenIndex) !=
> >>> 0 )
> >>> continue;
>
> >>> lenBuf = 0;
> >>> lenBuf += strlen(filebuf->text[i]);
> >>> lenBuf++;
> >>> for ( j = i+1 ; j < filebuf->total ; j++ ) {
> >>> if ( memcmp (filebuf->text[j], &indexPrefix, lenIndexPrefix)
> >>> == 0 )
> >>> break;
>
> >>> lenBuf += strlen(filebuf->text[j]);
> >>> lenBuf++;
> >>> }
>
> >>> *result = malloc(lenBuf);*
> >>> result[0] = 0;
> >>> strcat(result, filebuf->text[i]);
> >>> strcat(result, "\n");
> >>> for ( j = i+1 ; j < filebuf->total ; j++ ) {
> >>> if ( memcmp (filebu

[android-developers] Re: security of the framework

2011-03-23 Thread Hari Edo

On Mar 23, 5:50 am, madushanka  wrote:
> Hi, I am handling the security module of a framework that will
> designed to develop real time applications for as my final year
> project. I am new to android and i need help on this. At the moment i
> need to know how to encrypt an XML file using an algorithm and how to
> decrypt it when needed, in android. Please Help me.

In general, asking people on the Internet to help you do your homework
is considered bad form.  Break up the problem into small parts, and
tackle each small part as its own problem.  As mentioned, encrypting
or decrypting XML is no different with Android than with any other
Java or Java-like environment.

-- 
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 change behavior of default application in android

2011-03-23 Thread Hari Edo

I think you're confused about how Android picks apps (activities)
to handle various commands (intents) that the user invokes.

Roughly:

  * the phone radio kit receives a call
  * Android asks, "hey, which app is able to answer calls?"
+ If one app says it can, that app is assumed the default.
+ If more than one app says it can, and one has been marked
  as the default, that app is used.
+ If more than one app says it can, and no default is marked,
  the user is shown a list of choices.
+ The user can make a choice and use it this time.
+ The user can make a choice and mark it as default for
  future situations as well.
  * Android uses the chosen app to display a "receive call" UI.

This scenario is not just for receiving calls.  It also works
for responding to the Home button, and many many many other
situations in the Android system.

You don't get hooks or callbacks for when applications finish--
even the app itself may not be notified that it's being killed.

You cannot disable this "search for intent handlers" mechanism.
It is at the core of what makes Android... Android.

On Mar 23, 9:58 am, Kacee  wrote:
> Hello All,
>
> I want to change default behavior of one of the in-built application
> like Phone/SMS/etc. I got to search on forums that there is an option
> in
> Settings>Launch By Default > There "Clear defaults"
> The "Clear default" button on right is disabled for both in-built and
> any other downloaded app.
>
> 1) Are there any special settings to disable it from custom(non in-
> built)  app?
> 2) If once I change Clear Default using "ClearDefault" app available
> on market , is it possible to set the original default application
> back to "active/defaults" ?
>
> I want to change behavior of app after it is just about to complete.
> Can i get some event/ack that "abc app has finished" so that I can
> start my app after that ?

-- 
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 Obfuscate Android project source in eclipse

2011-03-23 Thread Hari Edo

The Android SDK setup for Eclipse does integrate with the ProGuard
tool,
which includes obfuscation.  I don't think obfuscation is much of a
protection, to be honest.  Focus on making a damned good app that
honest people will be happy to pay for.  You'll never achieve 100%
control over something you publish on the Internet.

On Mar 23, 7:12 am, lbendlin  wrote:
> you're searching for the wrong terms. This hasn't much to do with Android.
> Try
>
> eclipse java obfuscate

-- 
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 make webview answers onmousedown immediataly when touched?

2011-03-18 Thread Hari Edo

On Mar 17, 10:05 pm, lol  wrote:
> webview always answers onmousedown (js) after your finger leave up
> from the screen, so onmousedown is just like onclick. So how can
> webview listen to onTouch event so that it can answer the onmousedown
> event immediataly when you've touched the screen?

Touch devices have different semantics.  They simulate the
onmousedown/onmouseup events for backward compatibility, but
you really can't assume they will work the same way.

For example, how would you scroll a webview if it replied to the
initiation of every touch instantly?  The touch, stroke, lift
has come to be known as a scrolling gesture, and the web page
should not receive any onmousedown/onmouseup events.  If you
touch and lift without stroking, only then can the system know
you're not trying to scroll, and it offers the onmousedown/
onmouseup events at that time.

-- 
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: Any idea for Augmented Reality??

2011-03-13 Thread Hari Edo

On Mar 13, 3:59 pm, Abhishek Talwar 
wrote:
> can anyone guide me to the path of augmented reality some nice
> tutorials, books ,special tips, platforms/sdk
> video links which can do the magic,..

Here you go:  http://tinyurl.com/663pdl2

-- 
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: TranslateAnimation and scaleAnimation run at a time.

2011-03-10 Thread Hari Edo

On Mar 10, 5:21 am, leela  wrote:
> i am able to run Scale adn Translate animations one after another
> is it possible to run both at a time..

Read the documentation for AnimationSet.

-- 
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: android TOAST?

2011-03-09 Thread Hari Edo

On Mar 9, 5:38 pm, kiros88  wrote:
> rather then the basic "Ringer Volume" display so i couldnt find any
> code that was using those words does anyone have an idea what it is
> like is it a toast cuz if it is does anyone know how to put a seekbar
> and textview on a single toast

You can put any view into a toast.   So make a layout in XML with all
you want to show, then inflate that layout, then assign it to the
toast.  Not difficult.

However, the one big rule about toasts:  no touch, click or typing
interaction is possible.  It fades in, it lingers, it fades out, and
you can't interact at all through 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: Read CSV from web

2011-03-07 Thread Hari Edo

This looks like a school homework assignment.

Have you even taken the first step of dividing this task into
two parts?  What's the first thing you want to do?  What have
you considered, to get that first step accomplished?

On Mar 3, 6:13 pm, Muhammad Anas  wrote:
> I am new to android and creating an application that imports data from
> web in CSV format. Please tell me how to parse data taken from web
> (CSV Format) in android
>
> I need to read it from URL and the sample data that I need to parse is
> as follows
>
> "Start Date","Start Time","End Date","End Time","Location","Subject"
>
> "2011-03-03","13:15","2011-03-03","15:00","-","S1,John,Seminar on
> Telecommunication"
>
> "2011-03-06","10:15","2011-03-06","13:00","-","E1,Nicolas,Examination
> of TCP"
>
> The above is the data I am importing from URL (webpage) and it is not
> exactly as I have written it. The data is in one line not in different
> lines like below
>
> "Start Date","Start Time","End Date","End
> Time","Location","Subject""2011-03-03","13:15","2011-03-03","15:00","-","S1 
> ,John,Seminar
> on
> Telecommunication""2011-03-06","10:15","2011-03-06","13:00","-","E1,Nicolas 
> ,Examination
> of TCP"
>
> I need to separate each n everything. Please help me out that how to
> import it from URL and to parse it in android
>
> /Anas

-- 
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: Can you use with @layout-land?

2011-03-06 Thread Hari Edo


On Mar 6, 5:00 pm, Romain Guy  wrote:
> If the layout you want to include is *exactly* the same for all
> configurations, just put it in res/layout.



I once tried to have small rotation-independent clusters of
views included from layout/, while the activity xml was in
layout-land.  It seemed to have trouble finding layout/ to
resolve include tags.  Trouble of the NullPointerException
variety.

Since then, I dropped that approach, and keep everything
that a layout-land/ xml might need in layout-land/.  Maybe
later builds have fixed that bug.

-- 
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 check my sign is correct & not

2011-03-05 Thread Hari Edo

On Mar 5, 7:47 am, rishabh agrawal  wrote:
> how to check my sign is correct or not,becouse i have no android phone
> where i can test.i sign my apps using eclipse so how i will
> chek ..plz help

Why would you start publishing without even having one device?
The world is not your beta-testing employee.

-- 
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: TextView gravity off on Galaxy Tab?

2011-03-05 Thread Hari Edo
Try setting the text value after setting the typeface?  It may
incorrectly
cache the measurement using the view's Paint's font, and not revise
that
measurement when the typeface is changed.

On Mar 5, 10:38 am, Nikolay Elenkov  wrote:
> On Sat, Mar 5, 2011 at 1:10 PM, Nikolay Elenkov
>
>  wrote:
> > Hi,
> > I have a TextView displaying a single character, centered inside the view.
> > It works fine on all sort of devices, but on Galaxy Tab, the character is
> > aligned with the top of the view and slightly clipped. I've reproduced it
> > with the emulator, and tried all combination of gravity
> > (center_vertical|center_horizontal, etc), with no success.
>
> OK, this only happens when I use a custom font. This same font works fine on
> other devices. Anything obvious I am missing? What I am doing is very simple:
>
> Typeface tf  = Typeface.createFromFile("my-font.ttf");
> myText.setTypeface(tf);
>
> There are no errors or warnings in logcat. I'm guessing the custom font 
> somehow
> is screwing up text drawing. Is there anyway I can get it redraw the
> text? I've tried
> with postInvalidate() and requestLayout() with no success.

-- 
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: Help Getting the Context

2011-03-04 Thread Hari Edo

On Mar 4, 10:40 am, Hari Edo  wrote:
> Yes, indeed.  Extend android.app.Application.
> ... Android constructs your class instead of
> the default.  It gets its own onCreate()/onDestroy() lifecycle that
> spans all activities.

Clarification:  Application has no onDestroy() and you can't rely
on the onTerminate() either.  Android can kill a process without
notifying the Application class instance, so if anyone adds other
features besides the singleton pattern, take care in holding onto
any kind of resource that needs to be committed/saved/closed/freed
for a clean termination.  In fact, better if you don't hold any
such resource open/uncommitted at all, if you can help 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: Help Getting the Context

2011-03-04 Thread Hari Edo

On Mar 4, 9:54 am, Jake Colman  wrote:
> So your suggestion is that I extend the Application class using the
> singleton pattern?  And my extension saves 'this' (the context) as a
> static member of my singleton?  So now I have to see how to extend the
> application class.

Yes, indeed.  Extend android.app.Application.

In your manifest, your  tag refers to the class that
should be constructed for the Application.   It's usually left to
be the default, Application, but you simply name your Application
extension class there, and Android constructs your class instead of
the default.  It gets its own onCreate()/onDestroy() lifecycle that
spans all 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: Help Getting the Context

2011-03-04 Thread Hari Edo

One alternative is to look for, or create, a public singleton.
A public singleton is a class that (1) ever only has one instance,
and (2) that instance can be located from anywhere by means of a
static method.

One candidate for singleton status is Application -- it is a Context,
and you expect there'll only be one of them.  In your extension of
Application, have the constructor save 'this' to a static field, and
have a public static method to get the saved reference.  Voi la, you
can now get a useful Context from anywhere.  Most apps don't use an
Application extension, but you can use this pattern on pretty much
any class.

On Mar 4, 9:38 am, Jake Colman  wrote:
> I'm sure that this is a basic question that must have been answered a
> 100 times but I googled to no avail.  Maybe I am going about this the
> wrong way.
>
> I am creating a class that is not an Activity or a Service.  I need that
> class to be able to get a hold of, for example, the Location Manager.
> If I had a context I would call
>
>    (LocationManger)context.getSystemService(...)
>
> How do I obtain a context in this situation?
>
> I would prefer not passing in the context to the class constructor.  Am
> I fundamentally misunderstanding this environment?
>
> --
> Jake Colman -- Android Tinkerer

-- 
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: Two activities in one window

2011-03-02 Thread Hari Edo

On Mar 2, 7:20 am, Mika  wrote:
> So what I would like to do is to have one view open where the user can
> see the new values and in the same window have also the system
> settings activity where the user should input the values.

And if they have no hardware keyboard, they will have to see

  * your layout containing the suggested settings,
  * a system settings activity, the size and layout you don't control,
  * a software keyboard that often takes up about 50% of the screen

All at once on a small handheld device.

I feel for your situation, it's a shame the settings can't be done
programmatically as would be ideal.  But this suggestion goes beyond
the sensible interface.  If it were just one field, such as a tricky
hostname, I'd offer the use of the clipboard.  If this is only to be
done once, they may have to resort to pencil and paper.  If it's
to be done often, and in likely travel situations (setting up a new
scratch VPN from every airport), it's not pretty at all.

-- 
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 stop music which is play background in my apps

2011-03-02 Thread Hari Edo


On Mar 2, 12:41 pm, rishabh agrawal  wrote:
> i have develope apps in which i play background music.but when i go to
> the home through back tab then the song is also playing.how it is
> stop.. my code are
>         MediaPlayer mp=MediaPlayer.create(this, R.raw.ri);
>         mp.start();


You are creating a MediaPlayer instance.  You save a reference to
this instance with your variable mp.  You then start the music
by calling one of the methods, with mp.start().  You then forget
all about the instance, by not saving any reference to it.  The
local variable mp is gone, but the instance is still playing.

This is like sitting in your car, starting the motor, turning on
the radio of your car, then stepping out of your car as it rolls
away from you.

You should declare mp to be a member of your class, instead of a
local variable.  And at an opportune time, such as during your
activity's onPause() callback, you should use the member mp to
control the media playback.

If this makes no sense to you at all, I'm afraid you should go
find a much more basic introduction to Java and software
development in general.

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

2011-02-28 Thread Hari Edo

Reflection is the act of asking the JVM (Dalvik VM) and the
current ClassLoader object instance for information about the
classes it can reach in memory or along the Java CLASSPATH.

It has nothing to do with inter-process communication.  If it
is not in the current process, or reachable by the CLASSPATH,
it won't be found.

On Android, different package names are given different user
ids, and apps reside in completely different directories, to
further limit the visibility of files related to a different
application.

On Feb 28, 11:09 pm, Krt  wrote:
> Hi All,
>
> I am trying reflection in android.
>
> It works fine for classes, say A and B, under same project(same
> process in other words).
>
> It does not work between two different processes.
> i.e. I have
> project A, package name com.ref.classA
> project B, package name com.ref.classB
>
> Can I call from project B, Class.forName("com.ref.classA");
>
> I get exception class not found when I do this.
> Please note I have not imported package of calssA in classB.
>
> Am I missing something? or it is just not possible to do it between
> different processes.
>
> Any input would be of great help.
>
> Regards,
> Krt

-- 
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: Market package name on Xoom?

2011-02-28 Thread Hari Edo

Greg, reading fail.  There's a difference between "she's
only the one who..." and "she's the only one who..."
Without Dianne's team, Android wouldn't be.

Shane, the advice (from Google team or anyone else) is
trying to coach you into a sustainable design.  You can
write whatever compiles, but the advice is to write
something robust and future-proof.

Have you tried the original suggestion, clipping the query
parameters?  I don't know if it would succeed.

Uri.parse("market://")

On Feb 28, 5:16 pm, Greg Donald  wrote:
> On Mon, Feb 28, 2011 at 4:06 PM, rich friedel  wrote:
> > she's only the one who makes this OS happen...
>
> I'm pretty sure Linus Torvalds (and 16K kernel hackers) would
> disagree, not to mention Dan Bornstein, Andy Rubin, etc.
>
> --
> Greg Donald
> destiney.com | gregdonald.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] Re: Avoiding getIdentifier calls.

2011-02-16 Thread Hari Edo



On Feb 16, 7:30 am, Samuh  wrote:
> Questions:
> What are other alternatives that we can try?
> How should such resources be bundled so that they can be addressed in
> code efficiently?


If you do find yourself making many calls, especially from the same
name multiple times, form your own Map with each
value you look up.  Use the value if it's already in the map, or
ask Android to resolve the name and add it to the map.  This
technique is called "memo-izing" or memorizing the function.

-- 
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: Avoiding getIdentifier calls.

2011-02-16 Thread Hari Edo

I think the advice is to caution you not to do this for all of your
UI elements everywhere, just as you don't use Java Reflection for
all method calls.  Looking a few things up by name in response to
an activity start-up or a user interaction should not be a big deal.

On Feb 16, 7:30 am, Samuh  wrote:
> We have about 300 drawables/icons in our application and each drawable/
> icon is associated with an Id meaningful within the functional context
> of our app. These icons are to be displayed in a Gallery and when the
> user makes a selection, the relevant "Id" for the selected icon needs
> to be passed to the backend server.
>
> Presently, inside getView of the Gallery Adapter, we are making use of
> getResources().getIdentifier() to fetch appropriate icons since we
> know only the names of the icons and their IDs. We DO NOT know their
> resource ID.
>
> The official documentation discourages use of this API. Also, though
> we have not yet instrumented our code, people have said this API and
> also reflection is inefficient.
>
> Questions:
> What are other alternatives that we can try?
> How should such resources be bundled so that they can be addressed in
> code efficiently?
>
> 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 handle?

2011-02-16 Thread Hari Edo

You don't respond to the HOME key, it is handled by the OS
and only by the OS.  Add android:clearTaskOnLaunch to your
top-level  tag in the manifest, and the OS does
what you describe.

http://developer.android.com/guide/topics/manifest/activity-element.html

On Feb 16, 7:00 am, Abhilash baddam
 wrote:
> Hi,
>
>    How to handle the Home key functionality. Suppose in my app i am having 5
> activities. When the user in 3rd activity if he clicks on Home button i want
> to finish my app. If he starts the app again then i want to start the app
> from starting onwards.
>
> I did like this but its not working,
>
> public boolean onKeyDown(int keyCode, KeyEvent event) {
>     if ((keyCode == KeyEvent.KEYCODE_HOME)) {
>      //webView.goBack();
>      System.out.println("HOME in TEstApps");
>      finish();
>         return true;
>     }
>     return super.onKeyDown(keyCode, event);
>
>
>
>
>
>
>
> }

-- 
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: SQLite & multithreads

2011-02-15 Thread Hari Edo

Fifteen seconds of the proper use of web search tools gives this:

   FAQ: Is SQLite threadsafe?
   http://www.sqlite.org/faq.html#q6

   Android Documentation - SQLiteDatabase - setLockingEnabled()
   
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#setLockingEnabled(boolean)

On Feb 12, 4:36 pm, Neo Apostol  wrote:
> Hi,
> Is it possible to write data from different threads  to the SQLite DB at
> the some time?
> 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.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to delete...?

2011-02-14 Thread Hari Edo


On Feb 14, 9:15 am, Abhilash baddam
 wrote:
> I tried like but showing error..

Why is it so hard for people to explain WHAT error they get?

-- 
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: Getting rid of the blink after a TranslateAnimation

2011-02-11 Thread Hari Edo

Note that the usual matrix-manipulating animations don't change the
hit-testing for a view, so you have to actually move the real view
if you plan on animating a view that is touchable.

My app, "Qwiz - Hiragana", uses a LOT of drag and drop of views,
and touchable views that move around on their own initiative.

I implemented a true Animation class that adjusts the view's
position instead of manipulating the drawing transform matrix.
Then you don't need to reinvent the wheel of timing and iterating
and interpolating things (and you can use all of the other fun
iterators to bounce or wiggle the view).  I use a FrameLayout to
support moving things around by their margin coordinates, instead
of an AbsoluteLayout, but the idea is the same.

On Feb 10, 10:40 pm, Mark  wrote:
> I'm using TranslateAnimation  to actually move a View from one place
> to another, however from what I can google no one has managed to
> actually do this without having the View blink out for a second at the
> end of the animation...  If you've managed to do this without the
> blink please share.
>
> Has anyone tried doing the translate themselves with AbsoluteLayout?
> It looks like I'll have to duplicate the translate functionality by
> using a Handler to act as a run loop and move the View myself? A
> handler isn't a separate thread right? I just use it to to call a move
> function every X ms?

-- 
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: Redrawing a view when the transparent activity closes

2011-02-10 Thread Hari Edo

Are you saying that your MainActivity.onResume() nor your
MainActivity.onActivityResult() is not being called?  I would think
both should be happening here, and the translucent visual effect is
irrelevant.  See the activity lifecycle documentation.

On Feb 9, 6:02 am, vivin joy  wrote:
> Hi All,
>        i have an Activity called MainActivity. It has a custom view on
> it and a button. When i press a button, it opens a new Activity with a
> translucent theme so that MainActiivty is paused. The Second Activity
> has got a EditText. and i type something over there and press a button
> which closes the second activity and it returns back to MainActivity.
> When we return back to MainActivity, i need to redraw the custom view
> depending on what i typed in the second Activity. but it doesn't get
> re-drawn immediately after i have returned. It gets re-drawn only
> after i touch the custom view. How do i make a custom view re-draw
> immediately when i return to an activity? plz people help me with
> this.

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


[android-developers] retrieve current shadow effect attributes from a textview

2011-02-10 Thread Hari Edo

I can set shadow layer attributes in XML for a textview.
Separate attributes control the Dx, Dy, radius and color.

I can also set shadow layer attributes in code.
One method will allow me to set all four of those parameters.

However, I don't see any getters for these parameters.

I'd prefer to design the appropriate shadow in XML, but
I guess I'll have to do it in code, so I can know the values.

I was hoping to read the existing values of the parameters,
so I could do some dynamic effects with them in some
situations, without completely shifting to implement the
parameters in code.

(Example:  rotate text view upside down, but play with
shadow Dx Dy so the lighting doesn't look wrong.  Or
animate shadow right to left as another graphic moves.)

-- 
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: Android Market anomaly in limiting distribution

2011-02-09 Thread Hari Edo

Try signing out of the Market console, shutting down your web browser
instance completely, and forcing a refresh of the page.  This sounds
similar to a complaint where Free apps were reported with 'invalid
price' in many countries; a clean browser session fixed the problems.

On Feb 9, 12:01 pm, "Maps.Huge.Info (Maps API Guru)"
 wrote:
> I see the same thing. If it is indeed the case, shortly I'll be seeing
> a bunch of one star comments in different languages. Our weather app
> (Radar Now!) only functions in the US and border regions of Canada and
> Mexico. I'll post back if that's the case.
>
> -John Coryat
>
> On Feb 9, 10:20 am, DanaH  wrote:
>
>
>
> > I am preparing to release the latest update to our company's app. This
> > application is intended to be released only within the United States,
> > and in the past this has not presented any difficulty. Apparently with
> > the recent updates to the Android Market publishing page, I am no
> > longer able to select only the United States as my intended country.
> > When I unselect the default "All Countries" option, and then select
> > "United States", the "All Countries" check box again becomes selected.
> > This anomalous behavior is not unique to selecting the U.S.; selecting
> > any country causes the "All Countries" check box to become selected.
>
> > Has anyone else seen this behavior? This functionality worked as
> > expected in the previous release of Android Market.
>
> > I am running on Windows XP Professional, and I see this behavior both
> > with Internet Explorer and Safari web browsers.

-- 
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: Where to report app update problems?

2011-02-06 Thread Hari Edo

I ran into this on an update of my free app tonight as well.
I completely quit the whole Chrome browser process (which has
been running for a month), and restarted it.  The price problem
went away as if by magic.

I did notice another problem, where non-latin characters were
causing the "Recent Changes" text to blank out.  It would let
me type them and save them, but then a refresh or look in the
Market would show no text at all.  If I latin-ized the text,
it worked okay and the "Recent Changes" text stayed.


The question of the thread still stands:  where do you post
this kind of problem with the market, officially?


> > On Feb 6, 9:20 am, Keith Wiley  wrote:
> > >  I scroll down to find the problem and see that
> > > many countries now say "Invalid price" in red writing with a red box
> > > (those messages weren't there before I clicked Save)...BUT IT'S A FREE
> > > APP!!!  and to make matters worse, the United States is one of those
> > > countries (I'm in the U.S.)!!!

--
Qwiz - Hiragana flashcard drill game
http://market.android.com/details?id=cc.halley.droid.qwiz

-- 
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: Completely disable Soft Keyboard from EditText

2011-02-06 Thread Hari Edo

I think he said he had a special soft keyboard that was to be used for
this field.  Sounds like he doesn't want to go through the whole
hassle
of creating an entire soft keyboard, nor creating all the caret-
position
and backspace-handling code necessary to reinvent EditView.  I don't
know the actual situation but imagine a Scrabble tile rack that only
let
you enter the letters in your rack, plus a backspace and DONE key.

On Feb 6, 2:26 am, Dianne Hackborn  wrote:
> Can I first ask, what are you trying to accomplish?  What is the purpose of
> having an editable text view if the user can't actually put text into it?
>
>
>
>
>
>
>
>
>
> On Tue, Feb 1, 2011 at 10:29 AM, zenperttu  wrote:
> > Hi!
>
> > I would like a way to turn off showing the current soft keyboard for
> > an EditText. I have a custom View that provides the soft input needed
> > for an EditText, so on every occasion (on click, on focus change, on
> > touch...) when by default the soft keyboard would be shown, I want it
> > NOT to be shown.
>
> > The closest things I found are
>
> >http://groups.google.com/group/android-developers/browse_thread/threa...
>
> > and
>
> >http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr...
>
> > and
>
> >http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr...
>
> > These however do not work for me.
>
> > The solution suggested in the latter
>
> > InputMethodManager imm =
> > (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
> > imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
>
> > for example works only after the EditText has been selected by the
> > user and is already accepting input and so the soft keyboard is
> > already on the screen. I want it never to appear.
>
> > I can try to implicitly set all of the onFocusChangeListener,
> > onTouchListener, onClickListener  to do
>
> > public void onSomeActionListener(View v) {
>
> > InputMethodManager imm = (InputMethodManager)
> > context.getSystemService(Context.INPUT_METHOD_SERVICE);
> >                        if (imm.isActive(v)) {
> >                                imm.toggleSoftInput(0,0);
> >                        }
> > }
>
> > However, this is really not a nice solution because
>
> > 1) the soft keyboard is first called and shown so that it briefly
> > flashes on the screen before disappearing
>
> > 2) I can't by trial and error try to find all the different ways user
> > could cause soft keyboard to be shown and override all corresponding
> > methods
>
> > Thanks for your help!
>
> > --
> > 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
>
> --
> 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: Application Shutdown

2011-02-05 Thread Hari Edo

Save data when the user's no longer interacting with it.  And even
when they are.  As you point out, there are no guaranteed callbacks.
The system assumes that if you're idle, you can be killed.

On Feb 5, 8:57 pm, AndroidDevTime  wrote:
> I would like to handle application shutdown gracefully.  Whether the
> user ends the application or the system decides the kill the process,
> I want to know the best place to put hooks in the application to
> detect and handle this.  I know that application level components have
> lifecycle methods the conform to system events, but I really want the
> best practice on this at the application level.  This is after all an
> application level shutdown, so i want an app level(not just component
> level) handling.
>
> Not really sure where to put the global app shutdown code:
>
> In Application.terminate() ?:  Not really guaranteed to get called.
>
> In a service?:  I have n services.
>
> In an activity? : ok but just for the view data.
>
> The only thing I can think is to have a service dedicated to this
> shutdown activity manage the application level data, but I don't
> really want to start a service at a time when my app is getting
> shutdown perhaps for resource consumption.
>
> Perhaps one could  just let each component deal with it, however I
> have shared data/state (that is not a preference) across the
> components, and I see no reason why one of those components other than
> the application (subclass) should be dealing with application global
> data management.
>
> 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: In app billing...

2011-02-04 Thread Hari Edo

On Feb 4, 2:31 pm, Kostya Vasilyev  wrote:
> No, that says that the purchase can't be refunded.
>
> Is it somehow made clear to the user that the purchase can be refunded
> by contacting the developer?
>
> -- Kostya


I would gather that only those developers who WANT TO OFFER THE
OPTION of refunding in-app purchases, would make that clear in
the app itself.  (The left-hand image in the above checkout flow
could have that made clear, at the developer's discretion.)

Given that in-app purchases can have immediate benefits to the
buyer (buying a dragon-sleep potion allows the player access to
the dragon's treasure hoard), I can imagine that the developer
DOES NOT WANT an in-box filled with "can you refund my purchase,
the potion didn't work" messages which are 99% lying anyway.

-- 
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: Disable landscape orientation in Android Browser?

2011-02-04 Thread Hari Edo

Web sites should be even more aware that differences in browsers
exist, and to allow the end user to dictate the state of the
browser, not you.  For some examples, phone clamped in landscape
on a car's dashboard; user who prefers landscape because the text
can be bigger and more readable; users who need to enter things
with the pop-out hardware keyboard.

What could possibly *require* portrait layout over the wishes of
the user?

On Feb 3, 2:46 pm, Grev  wrote:
> I know there is a way to restrict the orientation within an app, but
> is there a way in code of a web page (whether it be HTML, CSS or JS)
> to restrict the web view to only potrait?

-- 
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: Force Close Question

2011-02-01 Thread Hari Edo

Something else is causing your Force Close.  Read the exception
report in LogCat and dig into the actual cause.

Read up on the Activity lifecycle, in particular the bubble
that reads "Other applications need memory":

http://developer.android.com/reference/android/app/Activity.html

The Android OS won't even try to return to your app if
it reaped it for memory.  It will just restart it.  There
is no way that it reaps some part of the app state
irretrievably, but leaves the process going.

If the system is low on memory, your app may receive an
*opportunity* to shed some of its state data at the app's
discretion.  If your app does honor this *request*, then
the system may have regained enough memory to allow the
user to run some other heavy task in the foreground.  The
current activity also got an earlier courtesy notice when
your activity was no longer active, giving an opportunity
to save the state away.  If your app does not honor these
requests, or cannot free up enough memory, the then the
system reserves the right to completely kill the whole
process as a whole.  If that happens, your next startup
will surely be as a brand new process, and your activity
will be handed whatever you chose to save away earlier.

You *can* flag your app to "start at the initial activity"
every time the app is suspended and resumed, but that is
completely separate from your impression that Android
frees up memory without any notice or control over its
own state.

On Feb 1, 7:18 pm, Scott Deutsch  wrote:
> Hello Group,
>
> How can I deal with when the user hits the home button when in my app and
> then doesnt go back to it for a while and then they hold home button to go
> back to my app and then the force close appears since all the memory has
> been freed because how the OS is designed.
>
> Is there a way instead of resuming the app that has freed memory and will
> break instantly...just launch it brand new?
>
> Is there a setting in the Android Manifest to force start brand new if freed
> memory?
>
> Thanks group.

-- 
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 analytics and active installs on market way off

2011-01-30 Thread Hari Edo

Congrats on having such a popular app.

Sounds like your child has grown up and left home, moved off to other
markets
without asking your permission.  Some people would say it's stealing,
piracy,
and must be stopped at all costs.  Some people would say that the more
people
see it, the more people will buy it, so those underground copies are
just a
form of advertising.

I just wish the market and the analytics would update more often than
24
hours.

On Jan 30, 9:05 am, neuron  wrote:
> Hi
>
> I got an application that onhttp://market.android.com/publish/shows around
> 20k active installs / 30k total installs. However, google analytics for the
> app (that's not really doing anything weird. It's just using the normal api,
> collecting fairly standard data). Is showing 100k+ unique visitors since
> launch (around 37k so far this month).
>
> What should I trust?

-- 
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 convert a image into Base64 string?

2011-01-28 Thread Hari Edo

Perhaps the actual question is "how to get a byte[] for a given
Bitmap" or vice versa.  This is, indeed, Android-specific and not
as obvious as the Base64 part of your question.

However, again, with a couple minutes of Google use, I found
this snippet:

 // have Bitmap bitmap from somewhere
 ByteArrayOutputStream bos = new ByteArrayOutputStream();
 bitmap.compress(CompressFormat.JPEG,100,bos);
 byte[] array = bos.toByteArray();
 // now have byte[] array to use, e.g., base64 encode

And then on the decompression side,

 // have byte[] array from somewhere, e.g., base64 decode
 Bitmap bitmap =
BitmapFactory.decodeByteArray(array, 0, array.length);
 // now have Bitmap bitmap to use, e.g., to make a drawable



On Jan 28, 11:40 am, saex  wrote:
> Hi
>
> Can someone tell me the code to transforma image (maximum of 200KB)
> into Base64 String???
>
> i need to know how to do it with android, because i have to add the
> functionality to upload images to a remote server in my main app
> putting them into a ROW of the database, as a string.
>
> i am searching in google and in StackOverflow but i can't find easy
> examples that i can afford. And also i find some examples but they are
> not talking about to transform into String... and i need to transform
> into string to upload by JSON to my remote server.
>
> 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 convert a image into Base64 string?

2011-01-28 Thread Hari Edo

This kind of question seems more like a school homework
assignment, but in case the question is practical, here goes.

What Base64 is:

  http://en.wikipedia.org/wiki/Base64

This article gives plenty of examples and details that someone
can write their own fully-tested implementation in an hour.

But in twenty seconds of using Google, I tried the search string
of "base64 encode in java" and got tons of hits.  The third link
has a fully-tested implementation (based on the same Wikipedia
example data and algorithms).

  http://www.wikihow.com/Encode-a-String-to-Base64-With-Java

Now, it's not good form to just copy code without asking, but
since this is a How-To article published on the web, I don't
think you'll run into copyright issues if you adapt their code
into your application.  There's good discussion in the article
about how the code works, and advice on learning to program.

However, this question is even sillier than that.  The
Android platform even includes a class called Base64 which
does all the encoding and decoding for you.  Without
worrying about incompatibility, testing, or license issues!

  http://developer.android.com/reference/android/util/Base64.html

That class even has an .encodeToString() method that turns
your arbitrary byte[] data into a String ready for use in
sqlite TEXT fields.

Beyond that, I'm really not sure what the actual problem is.

I'm not trying to be rude, but it's depressing when people
ask questions that are so quickly answered with even the
most cursory search first.

On Jan 28, 11:40 am, saex  wrote:
> Hi
>
> Can someone tell me the code to transforma image (maximum of 200KB)
> into Base64 String???
>
> i need to know how to do it with android, because i have to add the
> functionality to upload images to a remote server in my main app
> putting them into a ROW of the database, as a string.
>
> i am searching in google and in StackOverflow but i can't find easy
> examples that i can afford. And also i find some examples but they are
> not talking about to transform into String... and i need to transform
> into string to upload by JSON to my remote server.
>
> 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: Suggested Android Phone for Unity Game Development Testing?

2011-01-27 Thread Hari Edo

They list compatible phones.  Buy one of those.

This is the most important paragraph I found in your forum link:

  The problem is, publishing to Android won't really be
  solid for another year. Consumers get locked into 2 year
  contracts, in the same way I got locked in, and the most
  common will be the free phones and the cheaper (50$) for
  the next 2 years. Without a way to dumbdown your app, or
  modify the published one within Eclipse to work for ARMv6,
  that is potentially a GIANT chunk of current market share
  which will be LOST to a Unity>Android developer.

The market has a ton of very competent devices out there, but
Unity is not doing what they need to do to be compatible
with what is out there NOW.  As much as a developer may want
to tease over the specs to find 'Samsung Galaxy S' is a
compatible model, the general public does *not* see any
clear differentiation or tiers.  They just see that your
game sucks because it won't run while Angry Birds does.

That, and Unity has no "try ON THE PHONE before you buy"
plan to get into Unity development.  You might go with the
trial on your desktop, but that doesn't really tell you
whether your idea will work well on the Android platform.
If you had to buy Eclipse and the Android SDK just to load
an app on your own phone, we wouldn't have come so far so
fast.  If the price of those tools was as high as Unity,
come on now.

On Jan 24, 7:29 pm, HV-Charley  wrote:
> Hey everyone,
>
> I'm new to Android development and am looking to sort out what I
> should be getting as a development device for non-emulator testing
> purposes. Naturally, my goal would be to get a device that best
> represents the most common end-user device looking ahead to the next
> 4-12 months when our first title(s) are likely to be released.

-- 
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: Absolute path for an asset file

2011-01-27 Thread Hari Edo

An APK file, like a Java JAR file, is really just a ZIP
archive file with special manifest data included with the
other data files.

Your assets/ directory on your development machine may
contain individual files.  They get zipped up into the
APK along with all the .class, .png and .xml files.
The APK file contains it all in one file.

Once inside the APK, there really is no "absolute path"
to the files inside.  They are not really files.  They
are just entries in the ZIP, which a zip expander could
reconstruct into real files later.

This is why you use special API to access assets.  Many
apps ship with initial databases, and if the app finds
no existing file, it uses the special API to reconstruct
real files (sometimes confusingly called "copying a file
out of the APK").

See "copyDataBase()" in this article for a working
example of how to extract an asset and reconstruct a
file in your data directory.

http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

On Jan 27, 2:31 pm, Titus  wrote:
> Hello,
>
> I have been trying to get the absolute path for an asset file but i
> havent found an answer.
>
> the file which is directly within my asset folder is mydemo.txt
>  and i call the function given below to test the validity of the path
> (tried the below options)
>                 testURI("//android_asset/mydemo.txt");
>                 testURI("//assets/mydemo.txt");
>
>         public void testURI(String filepath) {
>                 try {
>                         Log.e(TAG, "Testing " + filepath);
>                         File f = new File(filepath);
>                         if (f.exists() == true) {
>                                 Log.e(TAG, "Valid :" + filepath);
>                         } else {
>                                 Log.e(TAG, "InValid :" + filepath);
>                         }
>                 } catch (Exception e) {
>                         Log.e(TAG, "File not found" + filepath);
>                         e.printStackTrace();
>                 }
>         }
>
> Can someone let me know whats the absolute path i can use to get an
> asset file. i don't need the file descriptors but i want the file path
> to construct an URI.

-- 
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: Android Developer Position for a NY Based Internet Company

2011-01-27 Thread Hari Edo

I've never heard of a software *development* position that's
stuffed into a mid-shift or night-shift slot.  Either you're
really advertising for operations technicians to be on call
for those hours, or you are expecting a "groundbreaking work
environment where collaboration is excercised" primarily
with calls to offshore outsource labor in a remote timezone.
Nothing wrong with global economy and all that, but it's
hard to tell what you're really seeking in candidates.

Can you give more info on your unusual ad in this regard?

On Jan 27, 6:45 am, Kim Abunado  wrote:
> Hi There,
>
> SourcePad is a New York City based Internet company focusing on
> outsourcing services for SME. Our company practices a groundbreaking
> work environment where collaboration is exercised throughout all
> levels of the company.
>
> We are expanding rapidly and have now worked with 50+ clients!
>
> We currently have more Mobile work than we can handle and need to grow
> our team!
>
> We have positions for both Mid-shift & Night-Shift, so, if you are
> smart, excited about Mobile  development and want to potentially
> double your salary...we want you to join our team!
>
> If you are interested, please email Kim at k...@sourcepad.com or text
> at 0916.496.83.46
>
> Look forward to speaking with you!
>
> Kim Abunado
> Recruiting Manager
> SourcePad LLC
> 0916.496.8346www.sourcepad.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] Re: android: a redundant UI syntax ?

2011-01-26 Thread Hari Edo


This is pretty common with XML systems with a lot of tags, especially
if they're meant to be expanded or mashed up.

If you create your own View types, you can extend the XML DTD to
include
your namespace.  Third-party libraries can add all of their features
with their own namespace.  It's the combination of these namespaces
and
DTD rules that allow the XML scanning process to find errors or
mistyped
parameter names.  No namespace, weaker protection from errors.

You might see the official reply in this bug tracker entry:
  http://code.google.com/p/android/issues/detail?id=7123

On Jan 24, 9:31 pm, Naren  wrote:
> Hi,
> I am a beginner to android development and wanted to ask a question to
> the developer community.
>
> What is the significance of specifying "android:" in front of every
> attribute.?
>
> be it view or layout, I know that I am already in android, then I feel
> its kind of redundant to prefix an attribute with android colon.
>
>  android:layout_width="wrap_content"
>                 android:layout_height="wrap_content" android:text="Master of
> Computer Applications">
> 
>
> Cant this be expressed as follows?
>
>                  layout_height="wrap_content" text="Master of Computer 
> Applications">
> 
>
> However the one reason that I can think of is specifying the package
> name (android:) as a prefix to resource will help to retrieve the
> resource easilly. But still, this need not be prefixed in every
> attribute. This should have been able to be specified in only one
> header or similar at the top.
>
> I think this might help in bringing down the code size and also for a
> quicker parsing.
>
> Let me know if I am missing something.
>
> Thank you
>
> Further,
> the attributes itself also can be very well shortened.
> ex:width as "w" height as "h" and layout_width as "lw" and
> layout_height as "lh"
>
> Thank you,
> Naren P

-- 
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: Hide each view after LayoutAnimation

2011-01-26 Thread Hari Edo

Are you setting fill-after to true on this animation?

On Jan 26, 4:58 pm, chrismanster  wrote:
> I have a GridView with several n Views in the Layout.  When one is
> clicked I want to reverse the LayoutAnimation to give the affect that
> everything is being removed.  Once the animation ends I do something,
> in this case start an activity.
>
> My problem is that once the LayoutAnimation on each view is complete
> it returns to its original position.  This doesn't give me the affect
> I am going for.  Is there anyway to keep the Views from returning
> until after the activity is started?

-- 
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: Built-in resource unexpectedly not found

2011-01-26 Thread Hari Edo

On Jan 26, 2:53 pm, Mark Murphy  wrote:
> I would recommend that developers depend as little as possible on
> explicitly using firmware-defined resources. If you need them, copy
> their values into your project. Or, at least have a value that you use
> as a fallback in case a firmware-defined resource is not available.

While I understand that sentiment, it's not practical.  Widgets
like Button constantly use built-in firmware-defined resources.
And I too have gotten TWO crash dumps where the .inflate() failed
unexpectedly, one trying to fetch Button's .9.png background, and
one trying to fetch a custom .9.png that I had put into my own app,
just as you suggest doing.

Now my first guess was that I was doing something wrong with a
timer, some accidental UI Thread/Worker Thread collision, so I
did revise that area of the code.  But if it wasn't that, then
I am not sure exactly how you should really respond to an
exception deep in .inflate() or .setContentView()... besides
calling .finish() and let the user wonder why the activity did
not appear.

-- 
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: Application does not use all screen in Android tablet (with android 2.2)

2011-01-26 Thread Hari Edo

The tarot deck answers nothing, so I'm reading the tea leaves now.  If
that
doesn't work, I will throw some chicken bones across the campfire.

What app?  Is this your app?  What are you doing to develop the
activity?
Are you making layouts in XML?  Did you try a sample application?
What
tablet are you talking about?

I'm sure this reply is not useful to you.  Google for "How to ask
questions
the smart way" and you may get some more useful replies.

On Jan 26, 2:10 pm, gato chlr  wrote:
> Hi List,
>
> In a phone, the application works o, but in an android tablet (with android
> 2.2) it does not use all screen, does anybody know how to fix that?
> I just see the application in the center of screen, and the rest of screen
> is black.
>
> Thanks a lot!

-- 
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: ENHANCEMENT: Allow java public static finals to be referenced from XML

2011-01-26 Thread Hari Edo

It would create a dependancy loop:

 *   the app code requires R.java to be generated
 *   the R.java generation requires the XML to be scanned
 *   the XML @java would require the app code to be scanned

Maybe you intend the XML to be scanned twice, with two different
sets of rules as to what is allowed to be broken on each pass,
such that nothing broken slips through the two passes.  On the
first pass, find @+id kinds of things to add to R.java; on the
second pass, find @java kinds of things to validate the code.
All of the rest of the XML DTD rules would need to be covered
on at least one of those passes.  That kind of duplicity is
very error-prone and troublesome.

On Jan 26, 12:14 pm, mkh  wrote:
> One example from an AndroidManifest.xml:
>
>              android:authorities="com.exampl.notepad.provider.NotePad" /
>
>
>
> This deliberately includes a typo that cannot be flagged by an IDE
> because it is just a string.
>
> Instead as an enhancement, why not define "@java/" to be a reference
> to the a public static final, then the above becomes:
>
>              android:authorities="@java/
> com.example.android.notepad.AUTHORITY" />
>
> Now an IDE can provide completion on these @java variables, and the
> IDE can also immediately flag undefined references. Also, the
> definition of the authority string can be changed in one place, and
> the code does not break.
>
> Is there any reason this would not work -- it seems like the benefits
> offered are significant.

-- 
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: performance when passing background data to ui thread

2011-01-26 Thread Hari Edo

If you're sure that all users of the data are within the same process
(the
same app), then using Java synchronized is the best way to go.
However,
you will need to be very careful to understand your semaphore
dependencies,
or deadlock will occur.  "Not responding" is almost as bad as "Data
corrupted" due to bad inter-thread communication.

The use of Bundles and/or ContentProviders are to enable inter-process
data
passing, and to avoid some of the danger of errant deadlock
situations.

On Jan 26, 10:37 am, neuron  wrote:
> Hi
>
> I've got an app that spawns of a seperate thread. Parses JSON data into a
> structure. And passes it back to the main thread through a handler. Each
> part of data is sent through the handler individually. That worked fairly
> well with my previous XML parser, as XML parses data while it downloads. But
> JSON doesn't (atleast I haven't found a way to get that working). In either
> way the JSON data is much smaller and much faster to parse.
>
> I've recently added a feature that requires me to load several sources of
> json in parallel, parse in the background, and pass all the data back again
> using a Handler. This is a bit slower than I was hoping.
>
> Would it be faster (and possible) for me to do this:
> BackgroundThread extends Thread {
>     onCreate (Parent) {
>         this.parent = parent;
>     }
>     onData {
>         parent.addParsedData(x);
>     }
>
> }
>
> Parent extends ListActivity {
>     ListAdapter list;
>     onCreate {
>        setListAdapter(list);
>        new BackgroundThread(this);
>     }
>     public synchronized addParsedData(data) {
>         list.add(data)
>     }
>
> }
>
> I'm thinking this won't be thread safe, as ListAdapter is in the parent
> thread. Am I right?
> Should I instead inside the listadapter (which puts data in an array) have
> synchronized access to it's items?

-- 
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: Edittext max characters - not set max

2011-01-26 Thread Hari Edo

I think Andre was looking for a design limit, not how to set one.

The control can handle many pages of text, even with spanning styled
markup.  The EULA which I saw on one Android tablet was shown in a
simple text view, and it was about fifty pages of text on the tablet.
(The EditText control should have the same limits as the TextView,
as the EditText is just some additional features on the basic view.)

The answer is "how much memory can you allocate?"  Of course
the system needs to allocate resources to measure and typeset and
render all of that text.  If it's too long, consider showing the text
in pages or chunks.

On Jan 26, 1:05 pm, Marcin Orlowski  wrote:
> On 26 January 2011 18:27, André  wrote:
>
> > Is there a limit on how many characters and or lines you can have in
> > an edittext? Or is it unlimited?
>
> http://developer.android.com/reference/android/widget/TextView.html#a...

-- 
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: One frame buffer per activity or one frame buffer per the whole system

2011-01-26 Thread Hari Edo

I'm not sure that this is the right forum for platform-developers;
it's more geared to app-developers.

However, I will point out that there's an important entity between
the framebuffer level and the activity level, and that is the Window.
Activities come and go, Dialogs come and go, and their views are
attached to the window to be seen.  Activities themselves aren't
users of pixels, but Views are.  I don't think any storage is "given"
to a View; the View is merely consulted to render into the Window.

On a phone, the Window is basically 95% of the whole screen so you
don't necessarily think of this, but it's still a separate entity.
I could definitely see some more traditional WIMP implementation
offering a Desktop that contains multiple overlapping or tiled
Window areas, and in those Windows various Views/Activities being
managed in parallel.  Not saying that's the best vision of a huge
display on Android, but it may help understand the framebuffer
question you posed.

On Jan 25, 9:59 pm, Videoguy  wrote:
> Hi
> I am trying to come up with memory footprint requirements for an
> android based settop box. Does Android maintain framebuffer per
> activity or one framebuffer per the whole system?
>
> Lets say I have 10 activities. Lets assume frame buffer size is 2MB.
> Does system need 10x2MB+2MB (= 22MB) for these many resident
> activities?
>
> 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: Tablet support up to 2.2

2011-01-26 Thread Hari Edo

I think the tablets in general will be more likely to flip orientation
and good apps should handle that gracefully.  But I think they should
also have a "lock orientation" control at the OS or hardware level,
as it's common but annoying to have the view flipping as you lay down
in bed reading on an e-book reader (as an example).

One thing that I did in my app was to identify some views as "heros"
and some views as mere interface details.  I made a generic sizing
capability which makes a view, say, N% of the size of the whole
window, and I use that on all the hero elements.  So the buttons stay
the same size (finger sized) but the main elements of the screen use
their available real-estate more fully.

 (Not to toot my own horn, but see my "Qwiz - Hiragana" screenshots.)
 http://www.appbrain.com/app/qwiz-hiragana/cc.halley.droid.qwiz

Other applications just try to allow the additional area to be used
as a more convenient tableau, fitting more items in view at once,
because the individual items remain finger-sized.

 (NiaSoft's game "Alchemy Classic" uses tablet workspace well.)
 http://www.appbrain.com/app/alchemy-classic/com.niasoft.alchemyclassic

On Jan 26, 5:43 am, Neilz  wrote:
> Hey thanks Kostya, that's really useful. I agree, maybe ensuring that
> the layout works is more important than resizing all the images again.
>
> Portrait vs Landscape is another issue... the majority of my apps
> specify portrait only, it's just the way they were intended to work.
> Do I take it that these tablets are designed to set landscape mode as
> their default?

-- 
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 get home screen click event

2011-01-24 Thread Hari Edo

As far as I know, the "Home" button can't be overridden or hooked by
your application.  The button invokes an Intent, and the system looks
up what activity (or activities) are coded to respond to that Intent.

All your app will know is that it is asked to save instance state,
pause operation, and maybe get a notice that you're being destroyed.

On Jan 24, 4:40 am, Narendra Bagade  wrote:
> Hi,
>
> Does anyone know how to get home screen click event.
> --
> Regards,
> Narendra
> .

-- 
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: Android Emulator-capture live images

2011-01-24 Thread Hari Edo

Read the documentation for the 'adb' tool.  Live pictures from your
phone or from your emulator.  No video.

On Jan 24, 9:51 am, jayavenkat  wrote:
> Hi All,
>          whether its possible to capture live picture from Android
> emulator 2.2 version,If so can anyone share your ideas and can you
> please list some related url
>
> Thanks in Advance,

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


[android-developers] Re: Shared preference from non activity class

2011-01-22 Thread Hari Edo


On Jan 22, 7:50 pm, TreKing  wrote:
> I have no idea what a "bean class" is.


It's one of those J2EE things that they shove at you in
diploma-mill university IT classes.  Basically, an object
with a hashmap of properties, so that it's trivial to make
GUI front-ends that can manipulate the properties directly.

While I haven't weaned myself off all of the Collections
classes, I'd say heavy Beans and lightweight Android are
at diametric odds with regard to garbage collection
stressors.

-- 
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: Pretty sure Google Analytics for Android not working

2011-01-22 Thread Hari Edo

My GoogleAnalytics app is working fine, but it's not on the market yet
so it's only getting about 150 events / day as I debug features at
home.

Are you calling .dispatch() occasionally?  Queued up pageviews and
events
don't get sent to the server until (1) there's network, and (2) you
call
.dispatch() on the tracker object.

On Jan 22, 5:27 pm, Brill Pappin  wrote:
> OK, I'm pretty sure now that the Google Analytics for Android is not
> working.
>
> I pushed out an update on my free app about 48 hours ago.
> It logs a few custom vars and manually does a commit int he first several
> blocks of the startup code.
> It also doesn't shutdown until the app exists (which can be minutes, so I'm
> giving it plenty of time to sync).
>
> I don't know exactly how many of the 30k+ users have run the update (since
> the market doesn't tell me a darn thing), but i know I should have at least
> myself logged and I'm pretty sure some of the 30k users would have updated
> by now.
>
> My only conclusion is that its broken.
>
> Does anyone have a better solution than GAnalytics?
> Maybe one that actually works?
>
> - Brill Pappin

-- 
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 Launch Home Screen Programmatically in Android

2011-01-21 Thread Hari Edo


On Jan 21, 7:52 pm, Dianne Hackborn  wrote:
> Further, if you are planning on publishing an app to Market, I would *very*
> *strongly* urge you to *not* do development against a device that does not
> itself ship with Market.  You have no idea what kinds of things may be
> different in it.

Thanks for the note about the Market.  I don't agree with that
principle,
but if that's how Google decides compatibility, that's what we have.

I wouldn't make a NOOKcolor my *only* hardware test, surely, but I
would
recommend app developers try a wide variety of screen sizes, at least
in the
emulator, and on other devices that are conveniently borrowed or
bought.
Then you do have some idea what kinds of things may be different in 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: How to Launch Home Screen Programmatically in Android

2011-01-21 Thread Hari Edo

> On Fri, Jan 21, 2011 at 12:06 PM, Hari Edo  wrote:
> > Not that it's a particularly standard example, but the e-book reader
> > NOOKcolor...

On Jan 21, 3:35 pm, Dianne Hackborn  wrote:
> (1) NOOK is not a compatible device.

Dianne, I generally value your feedback on this group, it's always
very
informative.  However, I'd have to ask what you consider to be the
definition of "compatible" here.  What part of the CDD does the
NOOKcolor
device miss?  I note a lack of microphone, phone, and camera, but
otherwise seems to meet all the other Core Application Intents and
hardware.  I think the Core Application Intents will probably drop
camera and phone requirements for future devices like televisions,
so I don't think we can go by that.  The CDD does not say that the
application must include a Market app.  The CDD also specifically
says that the HOME/MENU/BACK buttons do not need to be hard buttons,
and the NOOKcolor does make them available in soft form without
obscuring the current activity... all as the CDD requires.

I think it's disingenuous to say that a device built on Android which
has all of the core intents and hardware is "not compatible."  There
are
surely some growing pains with all tablets, as the first tablet-
focused
build of Android is still making its way to release.  I've been able
to
run a very wide variety of paid and free Android software.  A few have
some bugs because the author made bad assumptions as to DPI versus
pixel real estate vs aspect ratio.  Most authors have done enough
testing with the emulator's "design a device" features that the apps
run flawlessly on surprise contenders like the NOOKcolor.

I'd hate for the definition of "compatible" to be reduced to
contractual
distinctions such as the lack of the Android(tm) brand in the
marketing
materials, or an included Google Android Market app.  That would be
about as silly as the dalvik dodge that Android's not running Java.

-- 
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 Launch Home Screen Programmatically in Android

2011-01-21 Thread Hari Edo

Not that it's a particularly standard example, but the e-book reader 
NOOKcolor
replaces the "see all your apps" launcher with the "see all your Barnes & 
Noble
purchased e-books" Home instead.  So the Home key doesn't "show all your
apps," and neither would the ACTION_MAIN/CATEGORY_HOME intent.

I could see a television based on Android to also have a Home activity that 
is
not the global list of available applications.


On Friday, January 21, 2011 3:50:36 AM UTC-5, sjor wrote:
>
> Hi. I want to launch home screen of Android with my application. The 
> main target is to show all of apps to user when he/she presses a 
> specialized key. Actually, the way is not important. Any idea to do 
> this?

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

[android-developers] Re: another problem with Galaxy Tab and fullscreen

2011-01-21 Thread Hari Edo

* I meant "inflating your content view," not your "intent."

On Jan 21, 9:29 am, guich  wrote:
> Hi,
>
> Pardon me, i forgot that i set the fullscreen at runtime, just before
> showing the application's ui:
>
>       if (fullscreen)
>
> getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
> WindowManager.LayoutParams.FLAG_FULLSCREEN);
>
> thanks
>
>    guich

-- 
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: another problem with Galaxy Tab and fullscreen

2011-01-21 Thread Hari Edo

Are you doing all your setFlags() before inflating the intent?
I'm not sure but I think that's a requirement.


On Jan 21, 9:29 am, guich  wrote:
> Hi,
>
> Pardon me, i forgot that i set the fullscreen at runtime, just before
> showing the application's ui:
>
>       if (fullscreen)
>
> getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
> WindowManager.LayoutParams.FLAG_FULLSCREEN);
>
> thanks
>
>    guich

-- 
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 get the current shown text from a textview embeded in scrollview

2011-01-21 Thread Hari Edo

I think he wants to know what range of characters are exposed, when
the
text is longer than the visible area.  The TextView and ScrollView
don't
really communicate or coordinate this very well.  Since ScrollView
works
on a pixel basis, and TextView is all about characters and lines, you
likely have to do all the paint.measureText() work yourself.  Maybe I
am
missing something.

On Jan 21, 10:53 am, TreKing  wrote:
> On Fri, Jan 21, 2011 at 5:45 AM, dylan-cool  wrote:
> > i am now try to get the current shown text in the textview as a bookmark
> > for future reference.but how can i located to this site,and save a portion
> > of  my string?
>
> Sorry, but your question does not make much sense.
>
> --- 
> --
> TreKing  - Chicago
> transit tracking app for Android-powered devices

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


[android-developers] Re: Detecting Search button

2011-01-21 Thread Hari Edo

On Jan 21, 3:06 am, Zsolt Vasvari  wrote:
> Is there a way to know whether a phone has a Search button or not?  I
> believe Search is optional and not all phones have it.  I would like
> to hide my UI elements for invoking search if I could determine the
> presence of the hard button.

Search buttons are a SHOULD, not a MUST.

However, many people assume that the standard HOME/BACK/MENU buttons
are always a hard button outside the screen area.  This is not
required.

http://source.android.com/compatibility/index.html

8.7. Navigation keys

The Home, Menu and Back functions are essential to the Android
navigation paradigm. Device implementations MUST make these
functions available to the user at all times, regardless of
application state. These functions SHOULD be implemented via
dedicated buttons. They MAY be implemented using software,
gestures, touch panel, etc., but if so they MUST be always
accessible and not obscure or interfere with the available
application display area. Device implementers SHOULD also provide
a dedicated search key. Device implementers MAY also provide send
and end keys for phone calls.

One example is the Barnes & Noble NOOKcolor, which has a physical
HOME button, but shows screen buttons for MENU and BACK on their
notifications area when they think it's appropriate.  Obviously
the company wants to minimize the Android-ness and focus on the
prominent "Home" book reading activity, but they are arguably
still in compliance with the above standard.  Some users
have added third-party solutions for more permanent onscreen
buttons, or rooted the keyboard config to change the volume
buttons into permanent MENU/BACK buttons.

I don't think you're going to find a standard way of discovering
whether there is a SEARCH button, and if there is, whether it is
a hard or a soft screen button.  These may even be a globally
recognized touch or shake gesture, and still fall within the
bounds of the requirement above.

-- 
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 detect Face and Smile & Face matching in Android?

2011-01-21 Thread Hari Edo


On Jan 21, 1:12 am, Ankit Nigam  wrote:
> 1. Pick a photo and detects faces and show rectangle, and detect smile
> of each face and show smile percentage of each.
> 2. Pick a photo from photo library and show faces. if you click faces,
> it search all photo library and show list of possible same person.

Android doesn't have these features built-in, that I know of.  But
there
are algorithms out there that you could implement.

> Please help me out it's urgent.

Why do so many people think that their urgency will matter to other
people?  It's only urgent to you.  Why is it urgent?  Did you promise
your boss that you could do it, without any research into the topic?

-- 
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: Underclocking to simulate other phones

2011-01-20 Thread Hari Edo

I think people rely on the software emulator instead.

If you know how to dive into the firmware at that level,
you would know whether you would impact the reliability
and consistent behavior of the device.  I wouldn't trust
the results, myself.

On Jan 19, 8:29 pm, brian purgert  wrote:
> Would that work underclocking my phone so it could simulate much slower
> phones then mine.

-- 
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: Guidewire Developer in MA 6+ months contract

2011-01-20 Thread Hari Edo


On Jan 20, 11:10 am, arun panigrahi  wrote:
- *Position: Guidewire Developer*
- The candidate is required to have a minimum of *2 years experience
with
- Guidewire's UI (Screen configurations) & Rules and Integration*
development
- utilizing *Guidewire Claim Center 5.0 or 6.0, Guidewire Contact
Center and
- Payments components*. Experience in Rule writing using GOSU code is
a must.
- Very good understanding of Guidewire platform, and GOSU is a must.
- Development experience in Claim Center integration is also required.

Does this have ANYTHING to do with Android development?  You don't
mention.

Why are you posting a public job ad, when you really just want to hire
from
within?  I'd wager there's only one person on the planet who meets
these
constraints and is looking for a job, and you know that person's name
already.

-- 
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: Does Any one Building Android source code in Mac

2011-01-20 Thread Hari Edo

A large number of app developers are using Eclipse (or other
tools) on Mac OS X to produce Android packages successfully.

The performance of a machine running Eclipse on Mac OS X will be
about the same as a similar configuration on Linux.  There is no
reason to expect a major shift between these two platforms.

Windows will also have similar performance, but I have heard that
there are some minor USB compatibility complaints or
compatibility with their still-immature 64-bit device layer.

On Jan 20, 10:59 am, Desu Vinod Kumar  wrote:
> Hi All,
>
> Does any one using Mac Os for Building Android Source code.
>
> How was performance & is it better compare to Ubuntu ?
>
> I am planning to buy Mac Book Pro, please let me know your opinions.
>
> TIA
>
> --
> Regards
> ---
> D Vinod Kumar
> R & D Engineer - Android Platform
> Mobile : 09916009493http://in.linkedin.com/in/desuvinodkumar

-- 
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: getHitRect() returns hit to a different image item in a Customize List

2011-01-20 Thread Hari Edo

It's not clear what effect you're doing, but you will probably need
the inverse of the drawing transformation to determine the hits.
That is, if the drawing transformation is dividing by Z for depth
and perspective, the hit testing function should be multiplying by
Z to put the touch coordinates back into the button's coordinate
space.

On Jan 20, 2:45 am, argongold  wrote:
> Hi,
>
> I have developed a custom list with images and these images are
> displayed with different Z distance ( in 3D) as well as custom x,y and
> z angles for each image item.
>
> My problem is that when I hit an image on screen , the getHitRect()
> returns a different image hit and not the actual on which I hit on
> screen. Even though Images are not overlapping each other.
>
> Can any one suggest me how can I precisely get the hit of
> corresponding image.
>
> Note. I am using Camera and Matrix classes and
> getChildStaticTransformation() function to display the images.
>
> Thanks in advance .
>
> Regards,
> argongold

-- 
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: Isolated database tests

2011-01-19 Thread Hari Edo

The database is just one file in your app's data directory.  You need
to
specify the name of the database when you use it, and that becomes the
filename that defines the database file.

Just make a backup copy of the original file, or make a brand new
database
file for your tests.  You should be able to open and use two databases
independently even at the same time, though I haven't tried
instantiating
more than one SQLiteDatabase object at a time.


On Jan 19, 10:16 am, Mattias Svala  wrote:
> Hello!
>
> I would like to be able to write tests for my database code and have them
> run without touching the database that my actual application uses. It would
> be OK for the database tests to start with an empty or non existing database
> each time the tests are run.
>
> Is this possible?
>
> I would have guessed that I could use IsolatedContext in some way to achieve
> this, but I have not been able to figure out how. Perhaps there is some
> other way to have my database tests run isolated from the application's
> database?
>
> :.:: mattias

-- 
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: change color of Button

2011-01-19 Thread Hari Edo

None of the existing ColorFilter classes have any spatial arguments.

If you can implement a new ColorFilter extension that did take
an X/Y formula or maybe a gravity-like constant, that could work.
However, I expect all of the ColorFilter examples use native code
for speed purposes.

Instead, you might draw your own custom buttons with "patch 9"
style graphics (.9.png extensions).  The upside is that you can
draw whatever you like.  The downsides are that you take ownership
of all of the different dpi versions, and they may not match the
"stock" look on some devices which don't follow the Google theme
artwork.

On Jan 19, 5:22 am, "pramod.deore"  wrote:
> Hi, everybody
> I want to change color of button. Now I am done this with
>
> button.getBackground().setColorFilter(new
> LightingColorFilter(0xFF9933, 0x0CC000));
>
> But is it possible to 1)change button color like - At the left top
> corner have dark color and color become faint as we move to the right
> bottom corner.
>
> 2) Can we change the color of border of button?
>
> 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: No ; Do all android systems support vibration?

2011-01-18 Thread Hari Edo

As an example, the Barnes and Noble NOOKcolor device has no
vibrator.  Any apps that were expecting to offer that feature run
without incident (and without vibrating, obviously).  This device
also has a number of other deficiencies as it was not intended to
be used as a generic Android tablet, but it's otherwise pretty good
for the price.

On Jan 17, 10:04 pm, Ken Baltrinic  wrote:
> I am looking at putting my first app up on Android Market and am
> reviewing the nitty details like setting up the right uses-feature
> entries and such.  I am surprised to find that there is no feature for
> vibration.  Or is this inferred from the uses-permission:
> android.permission.VIBRATE entry?  Or does it mean that all android
> phones are required to have vibration capabilities?  If not, to ensure
> that my app degrades gracefully, how does one test to see if the
> current hardware supports vibration?  I have been Googling in vain
> trying to find the answers to these questions.
>
> Thanks in advance for any help.
>
> --Ken

-- 
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] apps with optional GoogleAnalyticsTracker, via reflection

2011-01-18 Thread Hari Edo


Almost everything on this group is a question, and not a discussion,
so I thought I'd do something a little different.  Here I share a
little code that I put together yesterday.

I have a general-purpose extension of the Android Application class,
where I put together useful capabilities that all of my projects tend
to share in common.

I recently added the Google Analytics for Mobile SDK jar file to my
application class.  (This could be done to an activity class as well.)
I implemented the following methods to support the tracker easily in
the rest of my app's activities.

  GoogleAnalyticsTracker tracker = null;

  public void trackApp(String identifier)
  {
if (tracker != null) return;
tracker = GoogleAnalyticsTracker.getInstance();
tracker.start(identifier, this);
  }

  public void trackActivity(String activity)
  {
if (tracker != null)
  tracker.trackPageView("/" + shortAppName() + "/" + activity);
  }

  public void trackEvent(String event, String arg1, int arg2)
  {
if (tracker != null)
  tracker.trackEvent(shortAppName(), event, arg1, arg2);
  }

  public void dispatchTracker()
{ if (tracker != null) tracker.dispatch(); }

I just throw the Analytics JAR file in my project's lib/ folder, add
the library to the Eclipse project, and now I can call these methods
to track events and activity invocations.  Simple enough.

There is one problem with this approach, and that is now a dependence
on an import of the GoogleAnalyticsTracker class, and therefore a
dependence on the Analytics JAR file in all of the projects that use
these methods.

Since my general-purpose class may be used by some other projects that
do not need Analytics, I thought I'd make these methods detect the JAR
file at runtime, rather than require the JAR in every project.

So I use the Java "reflection" mechanisms to detect if the JAR is
available, and if so, to indirectly invoke the methods instead.  If
the JAR is not present, then I decided that calling these methods
should just do nothing.

Here are the same methods, written to make Analytics an optional
component.  Some people may complain that it adds a lot of bloat to
the projects that don't use those features, but the difference in
size is equivalent to a very small PNG drawable file.

  Object tracker = null;
  private final Method gat_trackPageView;
  private final Method gat_trackEvent;
  private final Method gat_dispatch;
  private final Method gat_stop;

  /**
   * Register the app for analytics tracking on application startup.
   * @param activity the Google Analytics "web property ID" for app
   */
  public void trackApp(String identifier)
  {
if (tracker != null) return;
try
{
  String classname =
"com.google.android.apps.analytics.GoogleAnalyticsTracker";
  Class gat = Class.forName(classname);
  Class[] argTypes = null;
  Method tracker_getInstance = gat.getMethod("getInstance",
 argTypes);
  Object[] args = null;
  tracker = tracker_getInstance.invoke(null, args);
  argTypes = new Class[] { String.class, Context.class };
  Method tracker_start = gat.getMethod("start", argTypes);
  args = new Object[] { identifier, this };
  tracker_start.invoke(tracker, args);
  //
  argTypes = new Class[] { String.class };
  gat_trackPageView = gat.getMethod("trackPageView", argTypes);
  argTypes = new Class[] { String.class, String.class,
  String.class, Integer.TYPE };
  gat_trackEvent = gat.getMethod("trackEvent", argTypes);
  argTypes = null;
  gat_dispatch = gat.getMethod("dispatch", argTypes);
  gat_stop = gat.getMethod("stop", argTypes);
}
catch (Exception e)
{
  // ignored if the GoogleAnalyticsTracker jar is not found
  Log.w(shortAppName() +
"GoogleAnalyticsTracker not available. No tracking.");
  tracker = null;
}
  }

  /**
   * Track the user's use of a given activity (or any string).
   * @param activity the name of the activity to be logged
   */
  public void trackActivity(String activity)
  {
if (tracker == null) return;
final Object[] args = { null };
String page = "/" + shortAppName() + "/" + activity;
args[0] = page;
try { gat_trackPageView.invoke(args); }
catch (Exception e) { ; }
  }

  /**
   * Track an event that occurs in the application.
   * @param event the name of the event
   * @param arg1 an arbitrary string to be categorized
   * @param arg2 an arbitrary integer to be summed
   */
  public void trackEvent(String event, String arg1, int arg2)
  {
if (tracker == null) return;
final Object[] args = { null, null, null, null };
args[0] = shortAppName();
args[1] = event; args[2] = arg1; args[3] = new Integer(arg2);
try { gat_trackEvent.invoke(tracker, args); }
catch (Exception e) { ; }
  }

  /**
   * Post all pending tracking messages as network is available.
   */
  p

[android-developers] Re: Android Keyboard Hide event.

2011-01-18 Thread Hari Edo

Watch for any content change of the four EditTexts, with
addTextChangedListener().  Don't update your fields if the current
value in the field seems invalid (empty, non-numeric, etc.).

Note the user can hit the "Next" action on most soft keyboards
or tap each field to move from EditText to EditText.  There may
be a lot of times the user is hoping to see the updates you
calculate before they hide or stow their keyboard.

On Jan 18, 1:22 pm, Ankur Avlani  wrote:
> Hi All,
>
> I have been trying to get some event that would let me know, that the
> Keyboard was just hidden.  I tried onConfigurationChanged and onKeyDown.
>  But none of these help me.
>
> I have 4 EditText in my Activity.  On keyboard hide, i need to calculate
> based on the number(s) provided on the EditText.
>
> Any help is appreciated.
>
> Thanks,
> Ankur.

-- 
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: The curious case of the impossible ArrayIndexOutOfBoundsException

2011-01-18 Thread Hari Edo

(1) I agree that more core exceptions like AIOOBE should give better
 diagnostics, at the (rare) expense of the StringBuilder work to
do it.

(2) If multiple people are seeing it on the same line number, then
it's
 likely a real problem.  Now to figure out how to reproduce it.

(3) Any threading going on here?  None of your stuff is synchronized.
 I doubt it, and your stuff all seems private, but worth asking.

(4) I can't find anything about dalvik's float implementations being
 asynchronous, like the sqrt() call putting some sort of "hold" on
 the registers being read.  That said, try using two frustum
copies
 instead of working in-situ.  It may be a workaround.  If you
can't
 reproduce the case yourself, those users may be willing to try a
 private build.

(5) Side note:  dividing is usually a lot slower than multiplying, so
 calculate 1/sqrt(b) then multiply each of the row by that number.
 Maybe the compiler is smart enough to see that, but don't leave
 it to chance.  Also, line 175 seems to calculate a value in vain.

On Jan 18, 8:49 am, RyanMcNally  wrote:
> Hello all
>
> Hopefully someone out there can shed some light on this one, because
> it's got me completely stumped.
>
> I've received 5 reports, from 3 separate users on 2 different devices
> (ZTE blade and HTC Liberty), of an ArrayIndexOutOfBoundsException that
> I simply cannot explain.
>
> The stacktrace:
> java.lang.ArrayIndexOutOfBoundsException
> at com.ryanm.droid.rugl.util.geom.Frustum.extractFromOGL(Frustum.java:
> 180)
>

172:  frustum[ 3 ][ 0 ] = clip[ 3 ] - clip[ 1 ];
frustum[ 3 ][ 1 ] = clip[ 7 ] - clip[ 5 ];
frustum[ 3 ][ 2 ] = clip[ 11 ] - clip[ 9 ];
frustum[ 3 ][ 3 ] = clip[ 15 ] - clip[ 13 ];
/* Normalize the result */
t =
sqrt( frustum[ 3 ][ 0 ] * frustum[ 3 ]
[ 0 ] + frustum[ 3 ][ 1 ]
* frustum[ 3 ][ 1 ] +
frustum[ 3 ][ 2 ] * frustum[ 3 ][ 2 ] );
180:  frustum[ 3 ][ 0 ] /= t;
frustum[ 3 ][ 1 ] /= t;
frustum[ 3 ][ 2 ] /= t;
frustum[ 3 ][ 3 ] /= t;

> Line 180 is:
>    frustum[ 3 ][ 0 ] /= t;
> However, the frustum array is declared as:
>    private final float[][] frustum = new float[ 6 ][ 4 ];
> so 3 and 0 are perfectly valid indices. The frustum array is not
> altered after declaration - it's private and there are only 4 "new"s
> in that file, none of which are redeclaring any of the frustum[]
> arrays. In addition, line 172 is:
>     frustum[ 3 ][ 0 ] = clip[ 3 ] - clip[ 1 ];
> and no error is raised.
>
> Possible causes that I've eliminated:
> 1) Different versions of the class, so line numbers don't match up - I
> wish it were that easy. The code was copied wholesale (url in the
> class javadoc), javafied and committed. I haven't touched it since so
> there are no other versions of this class.
> 2) Someone else has taken the code, b0rked it, and is distributing
> broken APKs - Seems unlikely, and the one user who responded to me
> claims he downloaded directly from my site.
> 3) The crash report is being mangled somewhere in the reporting
> process - I'm using this 
> class:http://code.google.com/p/rugl/source/browse/trunk/droid/DroidRUGL/src...
> to capture exceptions. If someone can explain how that can mangle
> reports sufficiently, I'd be grateful.
>
> Remaining possibilities:
> 1) Malicious users fabricating error reports - I'd have hoped that
> three people would have better things to do than to conspire to troll
> me with bizarre crash reports, but I suppose anything is possible :-/
> 2) VM bug
>
> It's always a sad state of affairs when it comes down to blaming the
> VM, especially for such innocuous code. I very much enjoy trusting the
> VM and knowing that any bugs are my own, but I just don't know what
> else to make of this.
> I'd be enormously grateful if someone could point out where I've gone
> wrong.
>
> On a side note, having AIOOBEs report the value of the incorrect index
> -as in the JVM- would have been very handy in this case.
>
> Regards
>
> Ryan McNally

-- 
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: Android productivity with multi core processor

2011-01-18 Thread Hari Edo

While I don't know how dalvik really will hand this, but I expect
that if you make a new Thread or AsyncTask as required, it's done.

Now, it's up to you to architect your app to do this in a way that
makes sense.  It does not make sense to fire off ten or twenty
different AsyncTasks just to show a dialog box.  It is also a bit
cumbersome to do an AsyncTask just to fetch one row from a
SQLite table.  Do what makes sense.

I think the multi-core aspect will really just improve the tradeoff
between all the Services you don't see, and the one Activity that
you do see at any given time.  No coding required there.

On Jan 18, 10:30 am, viktor  wrote:
> Hi,
>
> Is it need additional api to work with multi core processor, or
> functionality is already embedded into OS?
>
> I know that for Java VM is no matter how many cores there, but what
> about dalvik VM?

-- 
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: Count of activities in App's stack

2011-01-17 Thread Hari Edo

If you make a new class MyActivity extending Activity, then you make
all of your activites extend MyActivity instead, then you can
implement whatever instance tracking you'd like to do.  But Java (and
thus Dalvik) have no way to reflect and iterate all object instances
of a class, extended class, or interface implementors.

I don't think the android stack is exposed for inspection either.

On Jan 17, 3:54 pm, Sudhakar Chavali 
wrote:
> Hello All
>
> Is there a way to know the count of activities exists in Application
> stack?
>
> Thanks & Regards
> Sudhakar Chavali

-- 
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 have a Service, un-killed by any task killer

2011-01-17 Thread Hari Edo

Please remember that your code is a guest on someone else's phone.
Your code should act accordingly.  Don't make features that depend on
just one way of ending the code.  Dead battery, force quit, kill
process,
all of these things are normal and your code should expect that.

On Jan 17, 2:04 am, Jawwad Farooq  wrote:
> Hi,
>
> I want to have a service that will not be killed by any task killer.
> Can you please give some code snippet for that
>
> Regards,
>
> Jawwad Farooq

-- 
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: AnimationSet - Scaling and moving at the same time

2011-01-16 Thread Hari Edo

It seems like whenever a  is done as a part of an animset,
the starting or ending scale is computed incorrectly, as the
reciprocal
of the ending scale.  I think they're calculating the anti-transform
for
each element, and doing it badly, messing up compound animations.

Thanks for posting good YouTube examples of the phenomenon.
Now post those to the bug tracker!

On Jan 16, 2:54 pm, "Oded O."  wrote:
> I'm building a new layout engine (and hopefully open-source it once I'm
> done)
> I need to scale and move a "tile" from one position on the screen to
> another.
>
> When I only move, the coordinates seems to be OK (the top-left corner of the
> "tile" is positioned exactly where it should 
> be)http://www.youtube.com/watch?v=MazxKnh83us
>
> When I only scale, the result size of the tile seems to be OK, and the
> tile's new size is exactly what it should 
> be.http://www.youtube.com/watch?v=bG3j0GdqbTI
>
> But when I combine these two animation to a single AnimationSet, something
> goes wrong, the top-left corner of the tile is off-setted to an unknown
> destination (couldn't figure out the logic behind the new 
> position)http://www.youtube.com/watch?v=JKn3jaATtww
>
> Has anyone came across this sort of issue?
>
> It's important that the two animation would happen at the same time (I don't
> want to move, and than scale, or vice-versa).
>
> Thanks!
>
> Oded

-- 
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 have your app overlayed on top of any other app?

2011-01-16 Thread Hari Edo

Another program called SoftKeys does this by way of a running
Service.  It offers access to the usually-mandated hardware keys
like MENU, BACK, HOME, SEARCH, even for those few oddball
devices like NOOKcolor that do not include those keys.

An IME keyboard is also a form of this kind of "UI overlay" that
people see all the time.  I am just guessing, but any soft keyboard
is likely another example of a service that spawns interface bits.

However, I can see this sort of thing being more nuisance than
godsend... one person's "great uses" is another person's clutter.

On Jan 16, 9:34 pm, pcm2a  wrote:
> That subject may sound crazy and before today I thought it was
> impossible.  There is a free app called Super Manager on the market.
> This app gives you a little button to press that is overlayed
> everywhere.  No matter if you are on your home screen, gmail or the
> browser that icon is overlayed.
>
> Pressing the icon brings up the app interface which is a little box.
> This box is also overlayed on top of your already running application
> like dolphin.
>
> While the icon overlay or app overlay is on the screen you can still
> interact with the app you were running!
>
> How can I accomplish something like this in my code?  I can think of
> many great uses.

-- 
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: Adding software to the phone OS?

2011-01-14 Thread Hari Edo

http://developer.android.com/guide/developing/tools/adb.html

On Jan 14, 11:58 am, Tobiah  wrote:
> I developed on a WebOS phone for a while.  The command line seemed to have 
> more
> of the usual Unix commands available then Android.  I was able to use a 
> command
> sort of like apt-get to suck down most of what I could imagine.  I put a 
> webserver
> on that phone with PHP.  I could SSH into it over the network.  How are the
> resources for Android?  Specifically, I'd rather like to put the sqlite client
> on my phone so that I can browse my databases without copying them off of the 
> phone.
>
> Thanks,
>
> Tobiah

-- 
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: Bottle neck in a Maps project

2011-01-14 Thread Hari Edo

Getting NullPointerException trying to start an Activity.
Check your manifest file to ensure you describe the Activity.

On Jan 11, 1:27 am, Asis  wrote:
> My project is totally error free but still the application is crashing
> as soon as it is launchingplease help me out...
> here is the logcat log of my application run
> name of application: hellogooglemap
>
> I/ActivityManager(   38): Starting activity: Intent
> { act=android.intent.action.
> MAIN cat=[android.intent.category.LAUNCHER] flg=0x1020
> cmp=com.android.hello
> googlemap/.hellogooglemap bnds=[83,238][157,317] }
> I/ActivityManager(   38): Start proc com.android.hellogooglemap for
> activity com
> .android.hellogooglemap/.hellogooglemap: pid=5486 uid=10026
> gids={3003, 1015}
> D/ddm-heap( 5486): Got feature list request
> E/ActivityThread( 5486): Failed to find provider info for
> com.google.settings
> E/ActivityThread( 5486): Failed to find provider info for
> com.google.settings
> E/ActivityThread( 5486): Failed to find provider info for
> com.google.settings
> D/AndroidRuntime( 5486): Shutting down VM
> W/dalvikvm( 5486): threadid=3: thread exiting with uncaught exception
> (group=0x4
> 001b188)
> E/AndroidRuntime( 5486): Uncaught handler: thread main exiting due to
> uncaught e
> xception
> E/AndroidRuntime( 5486): java.lang.RuntimeException: Unable to start
> activity Co
> mponentInfo{com.android.hellogooglemap/
> com.android.hellogooglemap.hellogooglemap}: java.lang.NullPointerException
>
> E/AndroidRuntime( 5486):        at
> android.app.ActivityThread.performLaunchActiv
> ity(ActivityThread.java:2496)
> E/AndroidRuntime( 5486):        at
> android.app.ActivityThread.handleLaunchActivi
> ty(ActivityThread.java:2512)
> E/AndroidRuntime( 5486):        at android.app.ActivityThread.access
> $2200(Activi
> tyThread.java:119)
> E/AndroidRuntime( 5486):        at android.app.ActivityThread
> $H.handleMessage(Ac
> tivityThread.java:1863)
> E/AndroidRuntime( 5486):        at
> android.os.Handler.dispatchMessage(Handler.ja
> va:99)
> E/AndroidRuntime( 5486):        at android.os.Looper.loop(Looper.java:
> 123)
> E/AndroidRuntime( 5486):        at
> android.app.ActivityThread.main(ActivityThrea
> d.java:4363)
> E/AndroidRuntime( 5486):        at
> java.lang.reflect.Method.invokeNative(Native
> Method)
> E/AndroidRuntime( 5486):        at
> java.lang.reflect.Method.invoke(Method.java:5
> 21)
> E/AndroidRuntime( 5486):        at com.android.internal.os.ZygoteInit
> $MethodAndA
> rgsCaller.run(ZygoteInit.java:860)
> E/AndroidRuntime( 5486):        at
> com.android.internal.os.ZygoteInit.main(Zygot
> eInit.java:618)
> E/AndroidRuntime( 5486):        at
> dalvik.system.NativeStart.main(Native Method)
>
> E/AndroidRuntime( 5486): Caused by: java.lang.NullPointerException
> E/AndroidRuntime( 5486):        at
> com.android.hellogooglemap.hellogooglemap.onC
> reate(hellogooglemap.java:39)
> E/AndroidRuntime( 5486):        at
> android.app.Instrumentation.callActivityOnCre
> ate(Instrumentation.java:1047)
> E/AndroidRuntime( 5486):        at
> android.app.ActivityThread.performLaunchActiv
> ity(ActivityThread.java:2459)
> E/AndroidRuntime( 5486):        ... 11 more
> I/Process (   38): Sending signal. PID: 5486 SIG: 3
> I/dalvikvm( 5486): threadid=7: reacting to signal 3
> I/dalvikvm( 5486): Wrote stack trace to '/data/anr/traces.txt'
> I/Process ( 5486): Sending signal. PID: 5486 SIG: 9
> I/ActivityManager(   38): Process com.android.hellogooglemap (pid
> 5486) has died
> .
> I/UsageStats(   38): Unexpected resume of com.android.launcher while
> already res
> umed in com.android.hellogooglemap
> W/InputManagerService(   38): Window already focused, ignoring focus
> gain of: co
> m.android.internal.view.IInputMethodClient$Stub$Proxy@43d86cc0

-- 
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 pogramatically enable GPS.

2011-01-14 Thread Hari Edo

The ability to turn on GPS by programs was removed from
Android after 1.5.  This is to ensure that (1) the power-hungry
GPS antenna does not drain the battery without the user
knowing it, (2) the user remains more consciously aware of
the risks of having GPS fine coordinates available to apps.

This change broke all sorts of widgets that let you toggle
the antenna on and off, though some more recent versions
have included a control panel for major phone toggles in
the notification bar pull-down.

On Jan 14, 7:17 am, ramzes0071  wrote:
> I used this code to turn on GPS:
>
> String allowedProviders = LocationManager.GPS_PROVIDER;
> Settings.Secure.putString(getContentResolver(),Settings.Secure.LOCATION_PRO 
> VIDERS_ALLOWED,
> allowedProviders);
>
> In AndroidManifest I set permission:
>
>  android:name="android.permission.WRITE_SECURE_SETTINGS"> permission>
>  uses-permission>
>  android:name="android.permission.ACCESS_FINE_LOCATION"> permission>
>
> But it doesn't work. I have a rooted phone.
>
> I tried yet this solution:
>
> Settings.Secure.setLocationProviderEnabled(getContentResolver(),LocationMan 
> ager.GPS_PROVIDER,
> 1);
>
> But Android doesn't see  this function: setLocationProviderEnabled();
>
> May I I do something wrong. If you know how it will work, help me, or
> if is another solution, please write me.

-- 
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: Lat/long coord to pixel screen XY coord without showing MapView

2011-01-14 Thread Hari Edo

This makes no sense.

The X Y on the screen depends on the scale, orientation, and
projection which a map view is using.  If you have no map view,
or don't know ALL of that information from the map view you are
using, then you can look at this two ways:

  (1) there's no way to know the X Y on the screen from the
   latitude and longitude,

-or-

  (2) you have infinite freedom to devise your own approach
   to scale, orient and project latitude and longitude onto
   the 2D screen space

On Jan 10, 1:40 pm, Machete  wrote:
> Hi guys, I need to convert the lat/long coord to pixel xy coord to
> show a dot on the top of some image, I know I can use the following
> code inside MapView to do that conversion:
>
> mapView.getProjection().toPixels(location.getPoint(), screenCoords);
> int x=screenCoords.x;
> int y=screenCoords.y;
>
> however, I don't want to show or use the MapView, I just want to
> extract the X and Y screen coord, because I have my own background, my
> app will use a simple ImageView to display that background and I want
> to draw a little dot on canvas, on the top of that background, that
> dot will only appear if that location respect some range.
>
> To better understand the question, imagine I have an aerial photo
> showing some building, I know the lat/long of that building, and I
> want to display a dot representing the building and a second dot if my
> actual position is near from that local.
>
> How I can get the XY pixel screen position of that location without
> showing the MapView?

-- 
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: Android: How can i put fonts of different size in a view?

2011-01-14 Thread Hari Edo

You win for the most terse question of the day.

Only a little bit of HTML markup is supported.  The Android docs
for Html.fromHtml() are almost as short as your question.  Try
simple tags like  and  instead of complicated ones
like .

On Jan 13, 9:21 am, rohan_lais  wrote:
> I tried  in string resource but it did not work.

-- 
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: Detect direction of shake movement in SensorListener

2011-01-14 Thread Hari Edo

What is your code giving you that's unsatisfactory?

Depending on your definition of "shake", you could probably
tell the difference between "side to side" vs "up and down"
but you will likely get very inconsistent results if you try to
distinguish "leftward" vs "rightward".  Your hand often
anticipates a little, moving left before a big rightward jerk.
(Google "anticipation animation" for more.)

On Jan 14, 6:27 am, TsEMaNN  wrote:
> Hello developers,
>
> I have got a problem concerning the SensorListener. At the moment I
> can already detect if the phone got shaken. Addtionally I now want to
> detect in which direction the phone is shaken. Do you maybe know which
> values I have to consider to detect this?

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


[android-developers] Re: Can't figure out this compile error

2011-01-14 Thread Hari Edo

> public class Sync extends IntentService
> {
--->       Integer counter;
>
>          public void Sync() {
>                  super("Sync");
--->   counter = 0;
>          }
...
> }

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


  1   2   >