[android-developers] Re: device fingerprinting

2010-10-30 Thread DanH
Well, there's the IMEI, the IMSI, and the ANDROID_ID.  Alas, the
ANDROID_ID isn't unique (and is in fact identical on many Droid2
units).

On Oct 30, 12:41 pm, bagelboy greg.do...@gmail.com wrote:
 Hello Devs,

 I'm working on an LVL implementation and I want to use as many
 different device identifiers as I can. I have considered using IMEI
 numbers but I've discarded that because a) it's intrusive and b) not
 all devices will have them.

 What might I use to fingerprint a phone for license verification?

 As an aside, how have your experiences with LVL been so far? Any
 pitfalls? I'm not asking for anyone to share their implementation
 details as that would give the hackers ideas.

 -BB

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 + sqllite : problem with accessing database

2010-10-29 Thread DanH
Oddly, you can't pre-load a database.  You have to create it on the
phone and load it up from a flat file or some other source.

On Oct 29, 6:13 am, Mad Troll trollheim.independ...@googlemail.com
wrote:
 I created database in sql lite with commands:
 sqlite.exe
 CREATE TABLE android_metadata (locale TEXT DEFAULT 'en_US');
 INSERT INTO android_metadata VALUES ('en_US');
 CREATE TABLE myTable (ID int);
 INSERT INTO myTable VALUES ('1');
 .
 etc.
 i saved to file myDatabase.db
 and i'm trying open it through android.
 I open new project in eclipse
 i put my database in assets folder
 and i tried open my db using code:

 SQLiteDatabase checkDB = null;
  String DB_PATH = /data/data/my.andoid.app/databases/;
  String DB_PATH = myDatabase.db;

         try{
                 String myPath =DB_PATH + DB_NAME;
                 checkDB = SQLiteDatabase.openDatabase(myPath, null,
 SQLiteDatabase.OPEN_READONLY);

         }catch(SQLiteException e){
                 return e.getMessage();
         }

 And i can't open my database.
 Could anyone help me and point me what i'm doing wrong?
 regards

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 + sqllite : problem with accessing database

2010-10-29 Thread DanH
I think the usual way is to put the SQLite DB file in raw, on the
phone create an empty DB and close it, then copy the raw copy over
this created version.  I've never done it myself, though.

On Oct 29, 9:36 am, Mad Troll trollheim.independ...@googlemail.com
wrote:
 so how i can do it?
 i remember in one of examples i saw file with line  structure:
 data 1 | data2 | data 3
 and application was created db from this file on phone
 so you suggest i should convert my db into text file, and try open
 text file im my app
 to placed content of this file into db created by phone

 but i cant create regular sql db and try to add it into project?

 bugger

 On 29 Oct, 13:35, DanH danhi...@ieee.org wrote:

  Oddly, you can't pre-load a database.  You have to create it on the
  phone and load it up from a flat file or some other source.

  On Oct 29, 6:13 am, Mad Troll trollheim.independ...@googlemail.com
  wrote:

   I created database in sql lite with commands:
   sqlite.exe
   CREATE TABLE android_metadata (locale TEXT DEFAULT 'en_US');
   INSERT INTO android_metadata VALUES ('en_US');
   CREATE TABLE myTable (ID int);
   INSERT INTO myTable VALUES ('1');
   .
   etc.
   i saved to file myDatabase.db
   and i'm trying open it through android.
   I open new project in eclipse
   i put my database in assets folder
   and i tried open my db using code:

   SQLiteDatabase checkDB = null;
    String DB_PATH = /data/data/my.andoid.app/databases/;
    String DB_PATH = myDatabase.db;

           try{
                   String myPath =DB_PATH + DB_NAME;
                   checkDB = SQLiteDatabase.openDatabase(myPath, null,
   SQLiteDatabase.OPEN_READONLY);

           }catch(SQLiteException e){
                   return e.getMessage();
           }

   And i can't open my database.
   Could anyone help me and point me what i'm doing wrong?
   regards

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Java101 strings and ints

2010-10-29 Thread DanH
It should be pointed out that this is a basic Java question, not an
Android question.  And more to the point it's a basic programming
question.

You'd be far better off learning more about programming on a desktop
system before digging into the ugliness that is Android (or any other
phone platform).  It will be much less frustrating for you.

On Oct 29, 10:55 am, acr acr...@gmail.com wrote:
 Hi all, Im new to android and java but moving along at full speed. My
 lack of experience is making some elementary tasks too repetitive.

 For example I want to be able to loop through the following snipit of
 code.. the problem is I want i  replace the number 1 in g1m0+=1;
 so through each iteration g1m0 would become g2mo

 for (Graphic grap : _toCompare) {
                         for(int i=1;i=7;i++){
                         if(grap.getCol()==i  grap.getRow()==1){
                                 g1m0+=1;
                         }else if(grap.getCol()==i  grap.getRow()==2){
                                 g1m0+=1;
                                 g1m1+=1;
                         }else if(grap.getCol()==i  grap.getRow()==3){ ..

 I know this is a simple to the novices out there can you please give
 me some insight to shorten up my code here..

 Thanks a bunch!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 pass objects around activities using A HashMap of WeakReferences to Objects?

2010-10-28 Thread DanH
You think the OP knows how to do a failover??

On Oct 28, 2:48 am, Doug beafd...@gmail.com wrote:
   I think the idea is that if you've just placed something in a (shared)
   HashMap with the value being a WeakReference to the object of
   interest, then immediately launch an activity to grab that value by
   id, the value you placed in the map will almost 100% be guaranteed be
   available by the time the activity's onCreate is called, but not
   permanently occupying space on the heap.  Sure, it's not 100% safe to
   assume it exists, but a likely bet if the gc uses any kind of LRU
   mechanism to clean up a weakly referenced object.

  Yeah, that's the kind of code I like -- it'll probably work most of
  the time.

 There are cases when it's agreeable to make a small sacrifice in
 reliability for great increases in speed and convenience.  And you may
 have heard of such a thing as a failover strategy.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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

2010-10-28 Thread DanH
A scheme I've seen used in other systems is to insert a dummy entry
for the key, having it rejected if it's a duplicate.  Ignore errors
from that operation and then update by key.

Depends on the specifics of the DB as to whether that will be more or
less efficient than doing a query first.

On Oct 17, 12:10 am, Hendrik Greving fourhend...@gmail.com wrote:
 I'd like to have a sqlite table with rows of 4 entries: a row id, a string 
 and 2 integers and possibly more data later. I want the string to be unique. 
 What's the easiest way to write an adapter that insert new rows with 
 automatically replacing if the string already exists? Does 
 DatabaseUtils.InsertHelper help? What is this for actually? How can I use 
 CONFLICT_REPLACE? I could probably get it working by making a query and then 
 delete and inserting or something like that, but I'm sure there is a better 
 way.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Child Thread Blocking Problems

2010-10-28 Thread DanH
The problem is that you should never wait or block in the main
thread.  Your background thread needs to somehow notify the main
thread that the connection is ready, and until then the main thread
should be spinning (in the figurative sense) in its event loop, not
sitting on a wait.

On Oct 28, 1:08 pm, Hank hwang...@gmail.com wrote:
 Within my service I created a new thread that will try to establish a
 internet connection, and I want it to wait for the connection to be
 established before doing anything. But when I call wait() or use
 ConditionalVariable.block(), it blocks the whole application and
 causes ANR. Does anybody know why it does that even though I created a
 child thread for this task? and do you have any solutions for this
 problem?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Child Thread Blocking Problems

2010-10-28 Thread DanH
Lemme guess:  You created a Thread but you never started it.

On Oct 28, 1:42 pm, Hank hwang...@gmail.com wrote:
 In my code, I don't have wait or block in the main thread, but in
 the child thread. So supposedly only the child thread should wait or
 block.

 On Oct 28, 2:37 pm, DanH danhi...@ieee.org wrote:

  The problem is that you should never wait or block in the main
  thread.  Your background thread needs to somehow notify the main
  thread that the connection is ready, and until then the main thread
  should be spinning (in the figurative sense) in its event loop, not
  sitting on a wait.

  On Oct 28, 1:08 pm, Hank hwang...@gmail.com wrote:

   Within my service I created a new thread that will try to establish a
   internet connection, and I want it to wait for the connection to be
   established before doing anything. But when I call wait() or use
   ConditionalVariable.block(), it blocks the whole application and
   causes ANR. Does anybody know why it does that even though I created a
   child thread for this task? and do you have any solutions for this
   problem?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Child Thread Blocking Problems

2010-10-28 Thread DanH
Assuming that post() or postDelayed() starts the Thread is even more
popular.

On Oct 28, 4:47 pm, fadden fad...@android.com wrote:
 On Oct 28, 12:35 pm, DanH danhi...@ieee.org wrote:

  Lemme guess:  You created a Thread but you never started it.

 Calling run() instead of start() is tremendously popular. :-)

 It also causes a memory leak, because Threads get added to ThreadGroup
 when they're created and don't get removed until they stop executing.
 If they never start executing, they never get removed.  (We're going
 to change this in a future release to use weak references, which isn't
 perfect but avoids this situation.)

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


[android-developers] Re: Is there anyway to pause a method in progress to wait for a button to be pressed?

2010-10-28 Thread DanH
 So please someone tell me
 there is some way I can have my method pause until a button is
 pressed?

You can't.  Though if you really want to you can, by placing your
main code in a secondary thread and having it communicate with the
UI thread.  It can send a message to the UI thread to display the
current configuration, then wait for the UI thread to respond that a
button has been pressed.

But the problem you run into is that the Android OS may want to deep-
six your thread to free up RAM if the app is backgrounded.  Dunno how
you handle that.

On Oct 25, 8:49 pm, Silverbullet999 jv487...@gmail.com wrote:
 Basically I have created a blackjack game (first using just java) and
 it falls under an infinite while loop (this is so that the deck data
 is kept and everything works well.  So first it deals the cards and
 then it needs to wait for either the hit button (which is displayed)
 or the stand button (which is displayed) to be clicked.  I initially
 did this with a while loop that would keep checking if buttons were
 hit (basically when a button was hit, a static int would change and
 stuff would occur).  However this just causes the droid to freeze up
 (thus far anyway) and also not refresh.  So please someone tell me
 there is some way I can have my method pause until a button is
 pressed?  I also need to know the proper way to use invalidate() so
 that my textviews, pictureviews and such can be updated as the methods
 change 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: inner classes in android

2010-10-27 Thread DanH
First you need to understand that inner classes and subclasses are
two distinctly different things.  Inner classes are mostly just a
convenience, simplifying coding without actually providing significant
additional function.  Subclasses, on the other hand, are the meat
and potatoes of OO programming and provide power, function, and
security advantages that are so substantial that few programmers ever
grasp their full potential.

On Oct 26, 9:27 pm, zeeshan mirza zeeshan.nabeel.mi...@gmail.com
wrote:
 Frank thank you for your answer. I know some points when do we need to
 create inner classes like we cant extend more than one class so if we
 create inner classes we can extend more classes. Am i right? is there
 any other advantage of inner classes ?

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


[android-developers] Re: Increase Ram Virtually

2010-10-27 Thread DanH
Wow!  Virtual memory!  Why, it seems only back in 1960 that was just a
gleam in the eye of computer designers.  And here we have it already!

On Oct 27, 8:19 am, Sami sami...@gmail.com wrote:
 http://softsami.blogspot.com/2010/09/increase-ram-virtually.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: Increase Ram Virtually

2010-10-27 Thread DanH
(Sami, virtual memory has been around for a looong time, even in
Windoze.  Generally there's no need/reason to muck with the Windows
defaults, since most machines have enough RAM that you don't need VM
to fudge having more, but simply use VM to swap inactive
applications out -- just as occurs on Android.  While you CAN
generally use an enlarged VM address space to run an application that
needs more RAM than you have installed, most applications are not
designed to be VM friendly and will page horribly if you do.  That
is, performance will degrade by at least 10x, and often 100x or more.)

On Oct 27, 8:19 am, Sami sami...@gmail.com wrote:
 http://softsami.blogspot.com/2010/09/increase-ram-virtually.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: Developing using Eclipse for Android and Java desktop application

2010-10-27 Thread DanH
You can certainly write a desktop application that will use any crypto
algorithm you can find the source for (or find a JAR for).  Writing
bare desktop Java is so easy there's no need to be constrained by a
particluar desktop tool set.

And somehow I find it hard to believe that javax.crypto would be
irretrievably incompatible between the two versions.  After all, it's
necessary (and possible) for Android to be able to interchange with
servers using encrypted data.  More likely it's just a matter of
getting both ends to use the same SPECIFIC algorithm, including not
just the named algorithm (like DES) but also the nitty-gritty details
of initialization vectors, salting, and the like.

On Oct 26, 1:31 pm, Vikas1976 vikas.shah.1...@gmail.com wrote:
 Hi everyone,

 I am writing because I am writing an application that uses crypto to
 encode information in files that will be stored and read on an Android
 device, and I would like to develop a desktop SWT app to generate
 these files.  It seems that the JRE6 library and the Android 1.6
 library implement javax.crypto.cipher differently, and I end up with
 error messages when I try to decode strings in SWT encrypted on the
 Android device or vice versa.  My question is whether you can force
 Eclipse to use the Android's javax.crypto.cipher in the SWT app, or
 use the JRE6 version in the Android app.

 Thanks!

 Vikas

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: inner classes in android

2010-10-27 Thread DanH
Android (and Java) would never have been built without subclasses.
True, with a good suite of APIs you may never need to subclass
anything, but that's simply because the people who designed the APIs
were skillful in using the full power of the OO model.

(Interfaces, by the way, are just a poor man's subclass -- very
little conceptual difference.)

On Oct 27, 5:20 pm, William Ferguson william.ferguson...@gmail.com
wrote:
 Sorry Dan, I have to strongly disagree with 'Subclasses, on the
 other hand, are the meat
 and potatoes of OO programming.

 IMHO subclasses are typically the most abused part of OO programming
 and are often a cause of obscure programming bugs. The Android API is
 a good case in point, many of the widget classes require you to
 subclass them in order to provide additional functionality but don't
 give you access to the attributes you need. IMO one of the main
 failures of the Android API is that it makes too heavy use of
 implementation inheritance (subclassing) rather than interfaces.

 I rarely subclass. I find I can get a much cleaner abstraction using
 interfaces and composition.
 And when I do subclass I keep the responsibilities and methods locked
 down tight.

 Subclassing is a slippery slope that gets steep really fast.

 On Oct 28, 3:50 am, DanH danhi...@ieee.org wrote:

  First you need to understand that inner classes and subclasses are
  two distinctly different things.  Inner classes are mostly just a
  convenience, simplifying coding without actually providing significant
  additional function.  Subclasses, on the other hand, are the meat
  and potatoes of OO programming and provide power, function, and
  security advantages that are so substantial that few programmers ever
  grasp their full potential.

  On Oct 26, 9:27 pm, zeeshan mirza zeeshan.nabeel.mi...@gmail.com
  wrote:

   Frank thank you for your answer. I know some points when do we need to
   create inner classes like we cant extend more than one class so if we
   create inner classes we can extend more classes. Am i right? is there
   any other advantage of inner classes ?

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


[android-developers] Re: SQLiteException thrown during rawQuery()

2010-10-27 Thread DanH
Thew SQLiteException generally contains some very useful text.  Might
be worthwhile telling us what it was.

On Oct 27, 6:40 pm, swgillan swgil...@gmail.com wrote:
 Hello,

 I got an SQLiteException when executing a rawQuery() function. I
 checked the API on this, and noticed that it is not documented that
 rawQuery would throw this (otherwise I would have put try/catch for
 this). Is this just something that was missed or is there something
 else in the documentation I need to be reading in regards handling to
 handling SQLite syntax errors?

 Thank you,

 Steven Gillan

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: inner classes in android

2010-10-27 Thread DanH
Interfaces were added to Java because they didn't want to (for reasons
I fully appreciate) do multiple inheritance, which would have provided
equivalent functionality (and then some).  Interfaces are, IMO, very
much worthwhile, but they do come at a significant performance cost vs
pure virtual calls.  They also provide nothing in the way of access
control.

On Oct 27, 7:26 pm, William Ferguson william.ferguson...@gmail.com
wrote:
  (Interfaces, by the way, are just a poor man's subclass -- very
  little conceptual difference.)

 *choke*

 Uh OK. I'll leave it there.
 I hope that one day you will see the difference.

 On Oct 28, 8:32 am, DanH danhi...@ieee.org wrote:

  Android (and Java) would never have been built without subclasses.
  True, with a good suite of APIs you may never need to subclass
  anything, but that's simply because the people who designed the APIs
  were skillful in using the full power of the OO model.

  (Interfaces, by the way, are just a poor man's subclass -- very
  little conceptual difference.)

  On Oct 27, 5:20 pm, William Ferguson william.ferguson...@gmail.com
  wrote:

   Sorry Dan, I have to strongly disagree with 'Subclasses, on the
   other hand, are the meat
   and potatoes of OO programming.

   IMHO subclasses are typically the most abused part of OO programming
   and are often a cause of obscure programming bugs. The Android API is
   a good case in point, many of the widget classes require you to
   subclass them in order to provide additional functionality but don't
   give you access to the attributes you need. IMO one of the main
   failures of the Android API is that it makes too heavy use of
   implementation inheritance (subclassing) rather than interfaces.

   I rarely subclass. I find I can get a much cleaner abstraction using
   interfaces and composition.
   And when I do subclass I keep the responsibilities and methods locked
   down tight.

   Subclassing is a slippery slope that gets steep really fast.

   On Oct 28, 3:50 am, DanH danhi...@ieee.org wrote:

First you need to understand that inner classes and subclasses are
two distinctly different things.  Inner classes are mostly just a
convenience, simplifying coding without actually providing significant
additional function.  Subclasses, on the other hand, are the meat
and potatoes of OO programming and provide power, function, and
security advantages that are so substantial that few programmers ever
grasp their full potential.

On Oct 26, 9:27 pm, zeeshan mirza zeeshan.nabeel.mi...@gmail.com
wrote:

 Frank thank you for your answer. I know some points when do we need to
 create inner classes like we cant extend more than one class so if we
 create inner classes we can extend more classes. Am i right? is there
 any other advantage of inner classes ?

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


[android-developers] Re: SQLiteException thrown during rawQuery()

2010-10-27 Thread DanH
Oh, I see -- you expect the Android documentation to be accurate!

never mind

On Oct 27, 7:20 pm, swgillan swgil...@gmail.com wrote:
 Sorry, perhaps I wasn't clear:

 It isn't the error that I am worried about, it is more that rawQuery
 isn't documented as throwing a particular exception.

 I can read my logcat and see plain as day that I had a syntax error in
 my function.

 I am trying to prevent something stupid like putting:

 try{
    rawQuery()}catch(bException e/b){

   something bad happened to get here

 }

 instead it would be nice to catch the correct Exception in the first
 place.

 On Oct 27, 4:56 pm, DanH danhi...@ieee.org wrote:

  Thew SQLiteException generally contains some very useful text.  Might
  be worthwhile telling us what it was.

  On Oct 27, 6:40 pm, swgillan swgil...@gmail.com wrote:

   Hello,

   I got an SQLiteException when executing a rawQuery() function. I
   checked the API on this, and noticed that it is not documented that
   rawQuery would throw this (otherwise I would have put try/catch for
   this). Is this just something that was missed or is there something
   else in the documentation I need to be reading in regards handling to
   handling SQLite syntax errors?

   Thank you,

   Steven Gillan

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: GK:How to give conditions in android XMLs

2010-10-26 Thread DanH
Are you sure they don't simply mean that they want different XML files
for different environments/devices?  There is a file suffix convention
that lets you specify different files for different environments, to
allow a single Android build to be targeted to several different
devices simultaneously.

On Oct 25, 10:38 pm, Jack Ganesh ganesh...@gmail.com wrote:
 Hi All.,

 My appication is used across different devices. For all device (SPH-
 D800,MOTO-Droid. etc) i force to make use of one string.xml and one
 android manefiest file for my application.

 Can any please tell me how can i make the conditions inside the all
 xml file.

 Thanks in advance  ! !

 Thanks.,
 Ganesh Kumar R.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Problem With Thread !

2010-10-26 Thread DanH
The JVM certainly could make use of the knowledge.  As it is, there
are some significant security holes, and the JVM must have some
special rules (loopholes) so that inner classes will work.  And the
scheme used is slower and much more cumbersome than would be an
implementation where the JVM is in on the secret and could implement
the access checking and outer class access directly.

On Oct 23, 2:57 pm, Bob Kerns r...@acm.org wrote:
 That's because the JVM doesn't NEED any other knowledge. The JVM
 doesn't define the language -- the compiler does.

 The JVM is the environment the compiler targets, but with a different
 compiler, you get, say, Scheme or AspectJ instead of Java.

 Taking your argument to the logical conclusion, nothing about C++ is
 real, because the hardware doesn't know about it. Hmmm

 Solipsism is fun, but not particularly useful.

 On Oct 23, 5:53 am, DanH danhi...@ieee.org wrote:

   Inner classes certainly exist

  Only as a fiction of javac.  The JVM has no knowledge of them, other
  than the InnerClasses attribute that's really just for debugging and
  reflections.

  On Oct 22, 11:17 pm, Bob Kerns r...@acm.org wrote:

   There's always been Runnable, yes, but there hasn't always been the
   cultural emphasis on composition rather than derivation. In other
   words, I agree it was a mistake, but it was a mistake born of its
   time, and not one that would be as likely to be repeated today.

   Inner classes certainly exist -- they're just broken (only capture
   final variables). The sense of unreality to which you refer is just an
   implementation technique, and only visible if you peek below the
   covers of reality. :) That's true of most any bit of programming
   semantics you choose to examine that closely.

   On Oct 22, 5:15 pm, DanH danhi...@ieee.org wrote:

But there's always been a Runnable, and it's no more difficult to
subclass a Runnable than a Thread.  Inner classes made it easier (if
more obscure) to define your subclasses, but didn't change the basic
nature of the beast.  (In fact, in reality inner classes don't exist.)

On Oct 22, 7:04 pm, Bob Kerns r...@acm.org wrote:

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 pass objects around activities using A HashMap of WeakReferences to Objects?

2010-10-26 Thread DanH
Don't know where you read that, but it sounds somewhat bogus.  A
WeakHashMap had weak keys -- when the key object no longer exists
then the map entry is removed (eventually) by GC.  If you use a Long
as a key, and send the Long via intent extras, my understanding is
that the Long is apt to be serialized/deserialized, meaning that the
object received on the other end may not be the same Long.  The
problem with this is that the entry might be discarded before it is
accessed.

Now, you could use a HashMap of Long keys referencing WeakReferences,
but that would be a different beast.  Then the entries in the HashMap
would persist, but the object referenced could evaporate if the
original reference to it is lost on the sending side before the
receiving side retrieves the object.

In any event, the idea is that a reference to the (Weak)HashMap is
separately passed to the other side, perhaps during initialization
of a background thread.  Then keys are passed via intents to identify
individual objects in the HashMap.  (Gotta admit that I don't quite
see the point in this either.)

On Oct 26, 5:11 pm, Anil anil.r...@gmail.com wrote:
 The FAQ mentions a method of passing objects around activities.
 (It is not clear to me):

 A HashMap of WeakReferences to Objects

 You can also use a HashMap of WeakReferences to Objects with Long
 keys. When an activity wants to pass an object to another activity, it
 simply puts the object in the map and sends the key (which is a unique
 Long based on a counter or time stamp) to the recipient activity via
 intent extras. The recipient activity retrieves the object using this
 key.

 Trying to pass a StringBuilder to another activity,
                        // trailBuilder is a StringBuilder
                         WeakHashMap wkmap = new 
 WeakHashMapString,StringBuilder();
                         wkmap.put(trailBuilder, trailBuilder);
                         alertIntent.putExtra(trailBundle,wkmap); // compile 
 ERROR here

 Can anyone point me to an example of how this is done?
 thanks,
 Anil

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 pass objects around activities using A HashMap of WeakReferences to Objects?

2010-10-26 Thread DanH
(Anyway, your attempt to use the WeakHashMap is totally hosed.  You
need to study up more on basic Java programming before you attempt any
more Android stuff.)

On Oct 26, 5:11 pm, Anil anil.r...@gmail.com wrote:
 The FAQ mentions a method of passing objects around activities.
 (It is not clear to me):

 A HashMap of WeakReferences to Objects

 You can also use a HashMap of WeakReferences to Objects with Long
 keys. When an activity wants to pass an object to another activity, it
 simply puts the object in the map and sends the key (which is a unique
 Long based on a counter or time stamp) to the recipient activity via
 intent extras. The recipient activity retrieves the object using this
 key.

 Trying to pass a StringBuilder to another activity,
                        // trailBuilder is a StringBuilder
                         WeakHashMap wkmap = new 
 WeakHashMapString,StringBuilder();
                         wkmap.put(trailBuilder, trailBuilder);
                         alertIntent.putExtra(trailBundle,wkmap); // compile 
 ERROR here

 Can anyone point me to an example of how this is done?
 thanks,
 Anil

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: inner classes in android

2010-10-26 Thread DanH
I'm afraid you need to go back to school -- this isn't an Android
question but a basic OO programming question.

On Oct 26, 5:01 pm, zeeshan mirza zeeshan.nabeel.mi...@gmail.com
wrote:
 Hello Friends,

 My Question is, why do we create inner classes or subclasses in
 android. Like the following example

 public class mainClass extends SomeClass implements SomeInterfaces{
 Some variables declaration ...
 public class subClass extends SomeOtherClass {
                 public SomeInterface someMethod() {
                         return mainClass.this;
                 }      
         }

 }

 Can we create this subClass as an individual class and later on use
 its methods in mainClass? if not Why?

 //Zeeshan

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Problem With Thread !

2010-10-23 Thread DanH
 Inner classes certainly exist

Only as a fiction of javac.  The JVM has no knowledge of them, other
than the InnerClasses attribute that's really just for debugging and
reflections.

On Oct 22, 11:17 pm, Bob Kerns r...@acm.org wrote:
 There's always been Runnable, yes, but there hasn't always been the
 cultural emphasis on composition rather than derivation. In other
 words, I agree it was a mistake, but it was a mistake born of its
 time, and not one that would be as likely to be repeated today.

 Inner classes certainly exist -- they're just broken (only capture
 final variables). The sense of unreality to which you refer is just an
 implementation technique, and only visible if you peek below the
 covers of reality. :) That's true of most any bit of programming
 semantics you choose to examine that closely.

 On Oct 22, 5:15 pm, DanH danhi...@ieee.org wrote:

  But there's always been a Runnable, and it's no more difficult to
  subclass a Runnable than a Thread.  Inner classes made it easier (if
  more obscure) to define your subclasses, but didn't change the basic
  nature of the beast.  (In fact, in reality inner classes don't exist.)

  On Oct 22, 7:04 pm, Bob Kerns r...@acm.org wrote:

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Problem With Thread !

2010-10-23 Thread DanH
You're still just running in the UI thread.  You need to start another
thread somehow (there are several ways, that others can enumerate
better than I can).

On Oct 23, 4:39 am, MarcoCanali marco.can...@gmail.com wrote:
 Ok i Implements Runnable for put the service in Waith() i call
 Thread.sleep()  in run() method of class that Implements Runnable and
 The Problem is the Same ;
 The stone don't hit the two Bird 

 On 22 Ott, 23:32, DanH danhi...@ieee.org wrote:

  Thread implements Runnable mainly as a convenience.  When you want to
  start a thread you need a Runnable to execute.  You can supply a
  separate Runnable, but, since you're already creating a Thread, why
  not just make it a Runnable too, and kill two birds with one stone?

  On Oct 22, 3:41 pm, Kostya Vasilyev kmans...@gmail.com wrote:

   Prakash is right - the thread needs to be started.

   Now, btw, why does Thead implement Runnable in Java? Seems like a recipe 
   for
   confusion.

   --
   Kostya Vasilyev --http://kmansoft.wordpress.com

   23.10.2010 0:33 пользователь DanH danhi...@ieee.org написал:

No, he's posting it as a Runnable to a Handler, it looks like.

   Yeah, there's a lot of that going around, and it causes a lot of
   confusion.  Stupid to use a Thread when a Runnable will do, but that's
   the way it is in some examples on the net, and those examples keep
   getting copied.

   And, of course, since it's not a separate thread (though the OP
   probably thinks it is), the sleep call holds up the UI.  Not a nice
   thing to do.

   On Oct 22, 2:59 pm, TreKing treking...@gmail.com wrote:

On Fri, Oct 22, 2010 at 8:02 AM, MarcoCanali marco.can...@gmail.com
   wrote:
 The Service Work ...
On Fri, Oct 22, 2010 at 8:34 AM, Prakash Iyer thei...@gmail.com wrote:
 Don't you need to sta...
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

   --
   You received this message because you are su...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Problem With Thread !

2010-10-23 Thread DanH
Of course, I can treat a String as a boolean.  Any class can be abused
by the ignorant.

But that's all beside the point.  Thread isn't going to change.  The
bizarre use of Thread as a Runnable, though (which appears to only
occur in Android), though, should be called out wherever it's seen.
Using the excuse that the class is too confusing is a bit of the
Android pot calling the Java kettle black.

On Oct 23, 5:00 am, Kostya Vasilyev kmans...@gmail.com wrote:
 23.10.2010 4:04, Bob Kerns пишет: Because you're left with two dead birds 
 instead of one?

 Or a ragout made out of two pigeons and marshmallows :) Perhaps pretty,
 but inedible.

 Runnable is an interface for packaging code into an object. There is
 nothing about threading inherent in Runnable.

 Having Thread implement Runnable makes using as a Runnable pretty
 obvious - and wrong. The entire reason for Thread class's existence is
 to be able to run code on a separate thread. That's clearly not the same
 as packaging code into an object, which is what Runnable does.

 So I'd say this is a case of inheritance for convenience of
 implementation, which is usually considered to be a bad. But it's worse
 than that, since treating Thread as a Runnable - as permitted by its
 derivation - causes Thread to completely break.

 Could have been something like this:

 class Thread /* does not implement Runnable */
 {
 // supply runnable to do background work
 Thread(Runnable r) {
 this.runnable = r;

 }

 // override worker() to do background work
 Thread() {

 }

 void start ()
 {
 // fork, call worker()

 }

 void worker() {
 if (this.runnable != null) {
 this.runnable.run();}

 else {
 throw new IllegalStateException(Either use Thread(Runnable) or override
 worker());

 }
 }
 }

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.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: Problem With Thread !

2010-10-23 Thread DanH
(The problem is that several of the authoritative examples of using
postDelayed that you'll find on the net make this error, and lead many
astray.)

On Oct 23, 5:00 am, Kostya Vasilyev kmans...@gmail.com wrote:
 23.10.2010 4:04, Bob Kerns пишет: Because you're left with two dead birds 
 instead of one?

 Or a ragout made out of two pigeons and marshmallows :) Perhaps pretty,
 but inedible.

 Runnable is an interface for packaging code into an object. There is
 nothing about threading inherent in Runnable.

 Having Thread implement Runnable makes using as a Runnable pretty
 obvious - and wrong. The entire reason for Thread class's existence is
 to be able to run code on a separate thread. That's clearly not the same
 as packaging code into an object, which is what Runnable does.

 So I'd say this is a case of inheritance for convenience of
 implementation, which is usually considered to be a bad. But it's worse
 than that, since treating Thread as a Runnable - as permitted by its
 derivation - causes Thread to completely break.

 Could have been something like this:

 class Thread /* does not implement Runnable */
 {
 // supply runnable to do background work
 Thread(Runnable r) {
 this.runnable = r;

 }

 // override worker() to do background work
 Thread() {

 }

 void start ()
 {
 // fork, call worker()

 }

 void worker() {
 if (this.runnable != null) {
 this.runnable.run();}

 else {
 throw new IllegalStateException(Either use Thread(Runnable) or override
 worker());

 }
 }
 }

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.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: Issue with Catch Handler

2010-10-22 Thread DanH
I vaguely recall this being mentioned as a feature of the emulator.
Seems odd, though, since it should be easy to fix and it makes
debugging that much harder.

On Oct 21, 9:58 pm, John Moline molinesys...@gmail.com wrote:
 Thanks Brad. I did narrow it down to my emulator. If I run the same
 process without using the emulator, it runs fine. It looks like some
 sort of permissions or framework issue within the emulator.

 On Thu, Oct 21, 2010 at 7:22 PM, Brad Gies rbg...@gmail.com wrote:
  I have had the same problem... It's not the Exception that is null, it's
  that getMessage() returns null.

  In some catch blocks (I think mainly or only to do with HTTPClient, but it
  may happen also with JSON Exceptions... I can't remember) calling
  e.getMessage() returns null since I updated my SDK to 2.2, and it caused
  major issues because I normally wrote that to a log file, which meant that
  my catch block was creating an exception

  Would love to know the reason... And would be even better if it got fixed.

  In the meantime, I'm doing this in my catch block if I use the message for
  ANYTHING:

                 String message = ex.getMessage();
                 if (message == null)
                     message = null;

  Then I write the message... It's a major pain...

  I don't have an answer for you either... just letting you know it's not just
  you :)

  Sincerely,

  Brad Gies
  ---
  Bistro Bot - Bistro Blurb
 http://bgies.com           http://nocrappyapps.com
 http://bistroblurb.com     http://forcethetruth.com
 http://ihottonight.com
  ---
  Everything in moderation, including abstinence (paraphrased)

  Every person is born with a brain... Those who use it well are the
  successful happy ones - Brad Gies

  Adversity can make or break you... It's your choice... Choose wisely - Brad
  Gies

  Never doubt that a small group of thoughtful, committed people can
  change the world. Indeed. It is the only thing that ever has - Margaret Mead

  On 19/10/2010 9:35 PM, Johnny Molina wrote:

  Hello,

  I have recently hit a snag using the Android plugin to Eclipse. For
  some reason, ALL of my errors being thrown don't initialize and show
  me the error. Has anyone ever seen this issue before and if so, what
  did you do to correct it?

  In particular, I am seeing it when I try to invoke the HTTPGet in a
  HTTPClient object. If I have no connectivity, then I should get an
  error. The Catch block does fire when this occurs...however, when I
  check my general Exception object, the object is NULL (NULL Pointer).
  Why would this happen if the catch is grabbing the exception?

  My exceptions used to be workingand I was able to see the stack
  trace. However, I can no longer see any stack trace regardless of the
  Exception class I am using. Can someone please help me understand what
  the heck is wrong with Eclipse, Android, or both? Is there something I
  am missing on the configuration side?...is this a bug?

  Mind you, I have already used Stack Overflow for this question. It has
  been viewed 40 times but no answer yet. I hope anybody on here can
  help me understand why this is occurring.

  Thanks in advance,

  John

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, 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: Problem With Thread !

2010-10-22 Thread DanH
 No, he's posting it as a Runnable to a Handler, it looks like.

Yeah, there's a lot of that going around, and it causes a lot of
confusion.  Stupid to use a Thread when a Runnable will do, but that's
the way it is in some examples on the net, and those examples keep
getting copied.

And, of course, since it's not a separate thread (though the OP
probably thinks it is), the sleep call holds up the UI.  Not a nice
thing to do.

On Oct 22, 2:59 pm, TreKing treking...@gmail.com wrote:
 On Fri, Oct 22, 2010 at 8:02 AM, MarcoCanali marco.can...@gmail.com wrote:
  The Service Work in Right mode but the other activity of application don't
  respond to command ...from  the sleep command add !!

 None of this makes any sense to me.

  Someone have an Idea of problem with Thread process, the sleep method
  intact the Application main core i think !!!

 None of this makes any sense to me either.

 On Fri, Oct 22, 2010 at 8:34 AM, Prakash Iyer thei...@gmail.com wrote:
  Don't you need to start the thread?

 No, he's posting it as a Runnable to a Handler, it looks like.

 -
 TreKing http://sites.google.com/site/rezmobileapps/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: Problem With Thread !

2010-10-22 Thread DanH
Thread implements Runnable mainly as a convenience.  When you want to
start a thread you need a Runnable to execute.  You can supply a
separate Runnable, but, since you're already creating a Thread, why
not just make it a Runnable too, and kill two birds with one stone?

On Oct 22, 3:41 pm, Kostya Vasilyev kmans...@gmail.com wrote:
 Prakash is right - the thread needs to be started.

 Now, btw, why does Thead implement Runnable in Java? Seems like a recipe for
 confusion.

 --
 Kostya Vasilyev --http://kmansoft.wordpress.com

 23.10.2010 0:33 пользователь DanH danhi...@ieee.org написал:

  No, he's posting it as a Runnable to a Handler, it looks like.

 Yeah, there's a lot of that going around, and it causes a lot of
 confusion.  Stupid to use a Thread when a Runnable will do, but that's
 the way it is in some examples on the net, and those examples keep
 getting copied.

 And, of course, since it's not a separate thread (though the OP
 probably thinks it is), the sleep call holds up the UI.  Not a nice
 thing to do.

 On Oct 22, 2:59 pm, TreKing treking...@gmail.com wrote:



  On Fri, Oct 22, 2010 at 8:02 AM, MarcoCanali marco.can...@gmail.com
 wrote:
   The Service Work ...
  On Fri, Oct 22, 2010 at 8:34 AM, Prakash Iyer thei...@gmail.com wrote:
   Don't you need to sta...
  TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
  transit tracking app for Android-powered devices

 --
 You received this message because you are su...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Problem With Thread !

2010-10-22 Thread DanH
But there's always been a Runnable, and it's no more difficult to
subclass a Runnable than a Thread.  Inner classes made it easier (if
more obscure) to define your subclasses, but didn't change the basic
nature of the beast.  (In fact, in reality inner classes don't exist.)

On Oct 22, 7:04 pm, Bob Kerns r...@acm.org wrote:
 Because you're left with two dead birds instead of one?

 A more serious answer would be that this stems from the early days of
 Java, and it was not so convenient to supply a Runnable, because there
 were no inner classes back then. A lack of experience with the
 language at that point left open the possibility that subclassing
 Thread to get various behaviours in addition to supplying the code to
 be run might be a sensible strategy.

 The documentation still offers extending thread as a co-equal option,
 but offers no reason why you would do that. To more modern eyes, doing
 so would be breaking down the separation of concerns. Not a serious
 failing, but offering no real advantages either.

 But at the time, the culture was much more focused in class hierarchy
 and inheritance. Gradually, over the years, we have learned that
 delegation, proxies, and related collaboration patterns are far more
 flexible and less fragile.

 On Oct 22, 2:32 pm, DanH danhi...@ieee.org wrote:

  Thread implements Runnable mainly as a convenience.  When you want to
  start a thread you need a Runnable to execute.  You can supply a
  separate Runnable, but, since you're already creating a Thread, why
  not just make it a Runnable too, and kill two birds with one stone?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Uploading an app to the Market for testing

2010-10-22 Thread DanH
Price at $199.

On Oct 21, 1:59 pm, MB manoj.bi...@gmail.com wrote:
 You would have to quickly publish and then un-publish the app  to test
 LVL in your app.
 This is the only way I could figure out.
 If you figure out something better please share it with the group.

 This is what I had to do for testing LVL even with the sample LVL
 code.

 --MB.

 On Oct 21, 8:49 am, Bret Foreman bret.fore...@gmail.com wrote:

  I've just added LVL and server-based licensing into my (as-yet
  unpublished) app. It appears that the license testing requires that
  the app exist in the Android Market. Is there a way to publish an
  app to the Market but keep it hidden while I test?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Type Conversion to Dalvik format failed: Unable to execute dex: null

2010-10-21 Thread DanH
This is a failure on build, right, not a failure of the installed app
or a failure to install?

Have you tried building a toy app, to verify that your development
setup hasn't gotten corrupted?

On Oct 21, 5:29 am, shuchi shuchimu...@gmail.com wrote:
 I am trying to create an Android maps project. Everything was working
 fine until i added Salesforce classes into it. Now it doesn't even
 compile. It gives me: Type Conversion to Dalvik format failed: Unable
 to execute dex: null error.

 I tried
 1) Increasing memory in the .ini file. That didn't help.
 2) Project - Clean option. It cleans, builds again and then gives me
 the same error.

 I am using Snow Leopard and i have the latest version of Android on my
 system. I just installed it last week. Plus, my eclipse is Ganymede. I
 even tried it with Galileo.

 Nothing seems to work. Did anyone face similar issues?
 Any help will be highly appreciated.

 Regards
 Shuchi

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


Re: 答复: [android-developers] Re: How to connect to a remote MySQL DB without webservices... ?

2010-10-21 Thread DanH
The first thing you should do is write an application on a desktop PC
to do the DB accesses you want (without using interfaces unavailable
on Android).  Work it out there, and then figure out how to map it to
Android.

On Oct 19, 4:58 am, goodwin weigoodw...@gmail.com wrote:
 Hi Kumar

 I don’t think google will let people lay any other .jar file , unless you 
 rebuild the source code of android.

 /

 i will try using sqldroid library to my needs, i will try to connect
 to a remote mysql dabatabase, not sqlite and not local

 but im having some problems, plz can someone help me?

 - how can i add  sqldroid-0.1.jar  to my project (sorry but i am
 newbie and i can't find nothing about adding this to a project)

 - where i have to put these two lines?
 Class.forName(SQLite.JDBCDriver);
 DriverManager.getConnection(jdbc:sqlite:/data/data/your-package/
 db.sqlite);

 - in the connection code, wich lines i have to change to connect to my
 remote database? my database is on 81.111.190.170:3306

 thanks

 On 19 oct, 11:33, Kumar Bibek coomar@gmail.com wrote:



  As far as I can imagine, the whole concept of having a library that could
  connect to a remote DB is not worth for a mobile platform. You are not
  writing a desktop app anyway, which would require the whole DB with all it's
  features exposed through a remote DB connection. It too much for a mobile
  app I would say. Apart from the security issues, if at all you get a direct
  connection to a remote DB, then there is no point in keeping a local DB,
  which is bad in various situations (no network connectivity). In case you
  are having a local DB as well, don't you think it's redundant duplication of
  data, and also, don't you think that your code will also be more? Well, if
  you have a webservice over your DB on your servers, you still have to write
  extra bit of code, but then, you will only deal with functions that the
  webservice exposes, and thus, you would be handling a subset of all possible
  situations, if it would have been a direct DB connection.

  Another issue I might think can come up very soon, is that you are looking
  for a MySQL version library. If at all there are any for Android, I am sure,
  they are not yet matured enough to use in an enterprise level setup. You
  might want to change the DB to Oracle, or SQL server, are you sure that
  these libraries can really handle that well? I personally don't think so.
  May be in the future, they will be available,

  BUT RIGHT NOW, Use a webservice and SQLite, I would suggest.

  On Tue, Oct 19, 2010 at 2:50 PM, saex elpablos...@gmail.com wrote:
   i check that library and it's for LOCAL SQLITE databases!

   i am talking about remote mysql dabatabases, not sqlite and not local

   greets

   On 19 oct, 08:36, Miguel Morales therevolti...@gmail.com wrote:
There is nothing implemented into the standard SDK to directly connect
to a MySQL database.
Your best bet might be to use something like an external library such
as:http://code.google.com/p/sqldroid/
I've never used this myself though.

On Mon, Oct 18, 2010 at 11:29 PM, JonFHancock jonfhanc...@gmail.com
   wrote:
 Not that I'm aware of, but remember that any code executed on a
 machine you do not control is untrusted.  It would be all too easy for
 someone to modify your code in a way that can make calls to your db
 that corrupt the db.

 Making a php or java server-side application that you can just send
 http post data to is way too easy to justify the risk.

 On Oct 18, 2:29 pm, saex elpablos...@gmail.com wrote:
 Hi

 can i do it? I just wanna make SELECT/INSERT into a remote database
 with my android phone application, i think it have to be easy but i
 can't find the way. I only find people that tell i have to make a
 webservice os romething like that, but that is another world for me,
 and i can't put a webservice in the database host...

 ¿there is not a normal way to do it without a webservice?

 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
~ Jeremiah:9:23-24
Android 2D MMORPG:
  http://developingthedream.blogspot.com/,http://www.youtube.com/user/r...

   --
   You received this message because you are subscribed to the Google
   Groups Android Developers group.
   To post to this group, send email to android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   

[android-developers] Re: Message not getting posted

2010-10-21 Thread DanH
Because this BBS sucks.  Google has a serious shoemaker's children
problem.

On Oct 18, 6:44 pm, Ray pamoned...@gmail.com wrote:
 Hello Moderators,

 I have been trying to send the message below since yesterday and I
 have tried posting it two times. I am not able to see it getting
 posted to the group. Can you please let me know why?

 Thanks,
 -Ray

 Posting the following e-mail:

 -- Forwarded message --
 From: Ray pamoned...@gmail.com
 Date: Mon, Oct 18, 2010 at 1:01 PM
 Subject: App design question for multiple data connections
 To: Android Developers android-developers@googlegroups.com

 Hello,

 I am working on developing an application that requires me to
 establish multiple client-server based connections. Connection can be
 of two types where the Android device can be a server or a client. I
 can have up to 6 - 8 connections. Once the connections are set-up they
 need to be running in the background and are not typically affected by
 UI actions.

 Since each connection can be blocking, I am wondering what is a good
 way to design this app. Should I have two services for handling the
 server and client connections? Each service could have a connection
 manager that can spawn new threads when necessary. Or does creating
 two services even help? I presume spawning new processes would not be
 good as they will be expensive.

 I would appreciate any suggestions. Also, if this use case is not
 typical please let me know if you need more information to make any
 recommendation.

 Thanks,
 -Balaji

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Always getting java.lang.VerifyError on 1.6 but fine on 2.1 and 2.2

2010-10-21 Thread DanH
Probably true on Android, not universally true.  Would fail on
standard Java, like I said, if -Xfuture were specified.

On Oct 21, 5:27 pm, fadden fad...@android.com wrote:
 On Oct 20, 11:10 am, DanH danhi...@ieee.org wrote:

  The wrapper class example is defective if the verifier is
  conventional -- doesn't have the  swizzle you describe since 1.6.

 It works because the code does something like:

   if (version is 2.0 or later)
     use wrapped stuff
   else
     feature not available, do nothing

 The wrapper class would fail verification and not be usable, but
 references *to* the wrapped class would be okay.  Verification happens
 between loading and initialization.  If class C refers to class D, the
 VM needs to be able to load D and examine it, but does not need to
 initialize and verify D in order to verify C.  This is still true in
 older versions of Android.

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


[android-developers] Re: stopping the GC from kicking in

2010-10-20 Thread DanH
I didn't view the video, but it sounds like he was on target.  Modern
programming techniques is often a euphemism for sloppy programming
techniques, and one sloppy technique is not adjusting your style to
the environment and environmental limitations.  In this case, on a
slow box with a clunky GC implementation, great effort needs to be put
into minimizing the rate of heap consumption if one wishes to avoid GC
pauses.

The guy may have been extreme in his suggestions, but the general
direction would be correct.

On Oct 20, 1:43 am, Peter Webb r.peter.w...@gmail.com wrote:
   The first thing I recommend watching is this google 
  presentation:http://www.google.com/events/io/2009/sessions/WritingRealTimeGamesAnd...

 I think the advice given in this video is basically wrong.

 It is a presentation done by a C++ programmer who has just written his
 first Java program. His idea of managing GC lag is to not instantiate
 any classes at all in real-time sections of the code. He spends a
 great deal of time explaining how difficult that is.

 This flies in the face of modern software design, which says build it
 right then build it fast. He basically says throw away most of the
 benefits of using auto-GC languages such as Java by writing your code
 in a very artifical way which avoids allocating memory.

 It is a pity because he could have told us some things we (or at least
 I) don't know, such as how the GC is triggered, whether it is device
 dependent, whather there are calls to suspend repacking the heap,
 practical stuff about how to best use a GC language for real-time
 apps. Trying to avoid anything at all which might cause GC to happen
 is throwing the baby out with the bathwater.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 visibility problem

2010-10-20 Thread DanH
Ah, how do you handle a problem like Maria??

On Oct 20, 9:40 am, Julie Andrews julieonli...@gmail.com wrote:
 This group is so helpful



 On Wed, Oct 20, 2010 at 6:30 PM, sisko adeod...@gmail.com wrote:
  You are right.
  When I move the TextView up it is squashed but visible.

  Can you advice on how I can make it visible beneath the relative
  layout

  On 20 Oct, 03:22, metal mikey coref...@gmail.com wrote:
   It might be because the TextView is positioned offscreen. Try putting
   it prior to the RelativeLayout, if you can see it then then it's
   likely the RelativeLayout is pushing it offscreen when the TextView
   is placed after the RelativeLayout.

   On Oct 20, 10:07 am,siskoadeod...@gmail.com wrote:

The following code is causing me problems as the last view, the
TextView, does not display :

LinearLayout
        xmlns:android=http://schemas.android.com/apk/res/android;
        android:id=@+id/LinearLayout01
        android:background=@drawable/bkgrnd
android:layout_height=fill_parent
android:layout_width=fill_parent
        RelativeLayout
                android:id=@+id/RelativeLayout01
                android:layout_width=wrap_content
android:layout_height=wrap_content
                        ImageView
                                android:id=@+id/ImageView01
                                android:layout_width=wrap_content
                                android:layout_height=wrap_content
                                android:background=@drawable/quizicon
                                android:layout_alignParentLeft=true
                                android:layout_alignParentTop=true
                        /ImageView
                        TextView
                                android:id=@+id/TextView01
                                android:layout_width=wrap_content
                                android:layout_height=wrap_content
                                android:text=@string/help
                                android:layout_alignParentTop=true
                                android:layout_centerHorizontal=true

  android:textSize=@dimen/menuxmlTitleSize

  android:textColor=@color/menuxmlTitleColor
                        /TextView
                        ImageView
                                android:id=@+id/ImageView02
                                android:layout_width=wrap_content
                                android:layout_height=wrap_content
                                android:background=@drawable/quizicon
                                android:layout_alignParentRight=true
                                android:layout_alignParentTop=true
                        /ImageView

/RelativeLayout
TextView
        android:text=@+id/TextView02
        android:id=@+id/TextView_HelpText
        android:layout_width=fill_parent
        android:layout_height=wrap_content
/TextView

/LinearLayout

Can anyone offer suggestions as to why the TextView does not showup in
the present format?
Also, please suggest good online resourse(s) that can help me learn
good Android XML layout techniques, please.

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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Juliehttp://tradinglogically.blogspot.comhttp://tradinglogically.blogspot.comhttp://vikitionary.blogspot.comhttp://gandhi-the-man-of-millenium.blogspot.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: Always getting java.lang.VerifyError on 1.6 but fine on 2.1 and 2.2

2010-10-20 Thread DanH
The wrapper class example is defective if the verifier is
conventional -- doesn't have the  swizzle you describe since 1.6.

On Oct 20, 12:53 pm, fadden fad...@android.com wrote:
 On Oct 19, 6:47 pm, DanH danhi...@ieee.org wrote:

  Even if you never actually execute the code that's causing the
  problem, the verifier will reject it, since it's doing a static check
  and can't tell what code is or isn't executed.

 That's a pretty concise explanation of the difference between 1.6 and
 2.0.

 In = 1.6, if the verifier couldn't find a field or decided that you
 didn't have access to a package/private method, it would reject the
 entire class immediately.

 In = 2.0, the verifier inserts an always throw instruction and
 verification continues.  Nothing fails unless you actually try to
 execute the code in question.

 It looks like xcxin.mysecret.mainSecretActivity.processContact() is
 attempting to access a static field
 android.provider.ContactsContract.CommonDataKinds.Phone.CONTENT_URI
 that didn't exist in 1.6.  (In fact, I don't think ContactsContract
 existed in 1.6.)

 Some notes about backward compatibility can be found here:

  http://developer.android.com/resources/articles/backward-compatibilit...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Always getting java.lang.VerifyError on 1.6 but fine on 2.1 and 2.2

2010-10-20 Thread DanH
(Though only, I suppose, if -Xfuture is specified/defaulted.)

On Oct 20, 1:10 pm, DanH danhi...@ieee.org wrote:
 The wrapper class example is defective if the verifier is
 conventional -- doesn't have the  swizzle you describe since 1.6.

 On Oct 20, 12:53 pm, fadden fad...@android.com wrote:

  On Oct 19, 6:47 pm, DanH danhi...@ieee.org wrote:

   Even if you never actually execute the code that's causing the
   problem, the verifier will reject it, since it's doing a static check
   and can't tell what code is or isn't executed.

  That's a pretty concise explanation of the difference between 1.6 and
  2.0.

  In = 1.6, if the verifier couldn't find a field or decided that you
  didn't have access to a package/private method, it would reject the
  entire class immediately.

  In = 2.0, the verifier inserts an always throw instruction and
  verification continues.  Nothing fails unless you actually try to
  execute the code in question.

  It looks like xcxin.mysecret.mainSecretActivity.processContact() is
  attempting to access a static field
  android.provider.ContactsContract.CommonDataKinds.Phone.CONTENT_URI
  that didn't exist in 1.6.  (In fact, I don't think ContactsContract
  existed in 1.6.)

  Some notes about backward compatibility can be found here:

   http://developer.android.com/resources/articles/backward-compatibilit...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 woes

2010-10-20 Thread DanH
It's theoretically possible that the phone is using your CPU to
assist the signal processor in separating signal from noise.  As the
signal gets weaker and weaker this would increase the load on the CPU,
and the phone is obviously going to give priority to signal processing
over UI stuff.

I don't know how modern phones are partitioned -- I assume that most
of the radio work is handed over to a dedicated signal processor, but
I can see that, to cost reduce the unit and cut it's size/weight/
power, mfgrs would tend to use the UI CPU for some signal processor
management functions.

On Oct 20, 4:29 pm, Kostya Vasilyev kmans...@gmail.com wrote:
 My Samsung Galaxy S also exhibits stuttering issues, launching applications
 often takes a few seconds. This happens with core phone apps, too, so
 reading an sms or making a phone call can sometimes be quite painful.

 On the other hand, my Motorola Milestone is always really snappy and is a
 joy to use.

 I think the difference has to do with Samsung's UI customizations, like the
 pageable application list, etc.

 The Milestone doesn't have those, running Android without enhancements of
 this kind.

 So my conclusion is - Android is pretty good, but phone makers can, and
 sometimes do, make it worse (or better, if you look at HTC, although not
 everyone likes their custom Sense UI either).

 Samsung is about to release an update to 2.2 for the Galaxy S, perhaps this
 will fix the stuttering issue. I'd advise you to wait for this update before
 making a final decision, and keep in mind that Android is not equally good
 (or bad) on every phone.

 --
 Kostya Vasilyev --http://kmansoft.wordpress.com

 21.10.2010 1:06 пользователь richie rich rich.al...@gmail.com написал:

 I have a Samsung Galaxy S. I'm a happy android developer, with a few
 marketplace apps. Hence, my frustration that overall, my experience
 with Getting the Galaxy S (after my G1) has been pretty fraught with
 performance sluggishness of the phone/overall OS.

 I find when the cel phone signal strength is anything less than 3
 bars, the phone is basically unusable. Want to look up a contact,
 press, and wait 10 seconds for anything. Open and App? Go grab a
 coffee.

 I thought it was something that would get better, but it has gotten
 worse.

 Overall, are people generally impressed with Android performance?
 After a year as an Android user, I'm thinknig of going back to the
 iPhone world. I never waited as long for apps to start/respond as I am
 now and wonder, if this something Froyo would fix?

 Are there settings to 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://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: Memory Leaks

2010-10-19 Thread DanH
Yes, size matters from the standpoint of triggering GC, simply because
GC is generally triggered when the total amount of allocated space
exceeds some threshold (or when the amount allocated since the last GC
exceeds some threshold).

I worked on a GC implementation off and on for 12 years, so I'm fairly
familiar with how things work.

On Oct 19, 4:27 am, Daniel Drozdzewski daniel.drozdzew...@gmail.com
wrote:
 On Mon, Oct 18, 2010 at 6:21 PM, DanH danhi...@ieee.org wrote:
  I doubt that adding content to the object would make it any more
  likely to be collected.  The garbage collector doesn't generally
  weigh objects as to whether they should be collected or not.  The
  only differentiating factors are 1) the absolute size of the object
  itself (not counting references to other objects), 2) the number of
  times the object has survived garbage collection, and (sometimes) 3)
  the class of the object.

 Dan,

 It is true that from a single object point of view, said object is
 either reachable from the root or is not, hence it can be garbage
 collected or it can not.
 However would you not agree, that from a heap management and GC
 strategy point of view size matters?
 Plenty of GC performance tuning tricks talk about the heap sizes,
 sizes of various generations and so on.
 From experience you can see, that GC kicks in much more often, when
 the amount of live objects on the heap increases (past certain
 thresholds).
 Heap resizing is also determined by the total size of life objects.

 I also know that in Android we don't have freedom to set those, which
 does not mean that they are not set.
 Please refer to following article:

 http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html

 --
 Daniel

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 connect to a remote MySQL DB without webservices... ?

2010-10-19 Thread DanH
It's kind of a hopeless cause:  Android does not implement remote DB,
and because of that it's considered unnecessary or unsafe.

But I think you can do the operations yourself, if you're willing to
get down and dirty with the protocols.

On Oct 18, 4:29 pm, saex elpablos...@gmail.com wrote:
 Hi

 can i do it? I just wanna make SELECT/INSERT into a remote database
 with my android phone application, i think it have to be easy but i
 can't find the way. I only find people that tell i have to make a
 webservice os romething like that, but that is another world for me,
 and i can't put a webservice in the database host...

 ¿there is not a normal way to do it without a webservice?

 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: Always getting java.lang.VerifyError on 1.6 but fine on 2.1 and 2.2

2010-10-19 Thread DanH
What did you compile against?  You should always compile/build against
the earliest version you hope to run on.

On Oct 19, 4:25 am, Alex Xin xinxi...@gmail.com wrote:
 Hi,

 I have an app that runs perfect on 2.2 and 2.2 but always getting
 VerifyError on 1.6 while startup, I don't think that my app cannot run under
 1.6 because I don't call any APIs that don't support 1.6.

 I'm really confused, does anybody has the same issue? How do you solve this
 problem?

 Thanks,

 Alex

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Always getting java.lang.VerifyError on 1.6 but fine on 2.1 and 2.2

2010-10-19 Thread DanH
Keep in mind that there are also Java version dependencies and library
dependencies.  I don't know what Java versions may correspond to what
Android versions, but you can't eg, compile with a Java 6 targeted
javac and expect to run on a Java 5 JDK.  And in some cases you can
run into trouble if you compile against a later version of something
like one of the org.apache interfaces and then try to run on earlier.
(In fact, with a few of the org.apache interfaces the problem can go
both ways.)

On Oct 19, 7:52 am, Tom Gibara tomgib...@gmail.com wrote:
 Yes. Temporarily changing the Project Build Target in the project's
 android properties (assuming you're using eclipse) should highlight any
 unexpected Java source incompatibilities.

 Tom.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: stopping the GC from kicking in

2010-10-19 Thread DanH
It kicks in because you used storage.  Use less storage.

(Actually not as dumb as that sounds -- you often can use,  eg, a
cache to avoid allocating new arrays and such and instead reuse old
ones.  And be a little less careless doing substrings, creating new
arrays when slicing an existing one, etc.  I've seen cases where
relatively minor modifications reduced heap consumption by a factor of
ten.  (Note that the amount of heap used remains fairly constant or
even increases a little, but the rate of creating new objects drops.))

But, having said that, sometimes the best approach for a situation
like this is to force GC early, at a time in your program when the
pause won't be noticed.

On Oct 19, 4:11 pm, kk kkostia...@gmail.com wrote:
 Hi all,

 When the GC kicks in during my game I sometimes get a noticeable
 framerate drop, which is to be expected.

 In logcat I get the usual:
    D/dalvikvm(   85): GC freed 55745 objects / 3149712 bytes in 709ms

 Is there any way to get more info as to what is causing this?
 I.e. what in my code is causing the GC to kick in...

 cheers,
 kk.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Always getting java.lang.VerifyError on 1.6 but fine on 2.1 and 2.2

2010-10-19 Thread DanH
Right ***above*** the exception trace should
be some arcane-looking messages with VFY in them.

On Oct 19, 6:36 pm, Alex Xin xinxi...@gmail.com wrote:
 Hi, thanks for helping me, here's the logcat, you could see it crashes prior
 to call my onCreate() method.

 10-20 07:32:27.490: ERROR/AndroidRuntime(204): java.lang.VerifyError:
 xcxin.mysecret.mainSecretActivity
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 java.lang.Class.newInstanceImpl(Native Method)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 java.lang.Class.newInstance(Class.java:1472)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 android.app.Instrumentation.newActivity(Instrumentation.java:1097)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 android.app.ActivityThread.access$2100(ActivityThread.java:116)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 android.os.Handler.dispatchMessage(Handler.java:99)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 android.os.Looper.loop(Looper.java:123)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 android.app.ActivityThread.main(ActivityThread.java:4203)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 java.lang.reflect.Method.invokeNative(Native Method)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 java.lang.reflect.Method.invoke(Method.java:521)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
 dalvik.system.NativeStart.main(Native Method)

 On Wed, Oct 20, 2010 at 7:11 AM, fadden fad...@android.com wrote:
  On Oct 19, 2:25 am, Alex Xin xinxi...@gmail.com wrote:
   I have an app that runs perfect on 2.2 and 2.2 but always getting
   VerifyError on 1.6 while startup, I don't think that my app cannot run
  under
   1.6 because I don't call any APIs that don't support 1.6.

  Post the output from logcat.  Right above the exception trace should
  be some arcane-looking messages with VFY in 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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Always getting java.lang.VerifyError on 1.6 but fine on 2.1 and 2.2

2010-10-19 Thread DanH
Like I said ...

Even if you never actually execute the code that's causing the
problem, the verifier will reject it, since it's doing a static check
and can't tell what code is or isn't executed.

If you want to include some code in your application that is
optionally loaded (because it's not compatible with all versions of
the platform) you need to use the factory approach where you write a
factory method that explicitly loads the class with ClassLoader calls
and then does a newInstance on the loaded class (and returns the
result of the newInstance).  Externally you only reference the class
by interface or superclass, so that the problematic class isn't loaded
while verifying the referencing code.

On Oct 19, 8:24 pm, Alex Xin xinxi...@gmail.com wrote:
 Thank you!  Now I know where I can get those messages.

 10-20 09:18:14.973: WARN/dalvikvm(210): VFY: unable to resolve static field
 0 (CONTENT_URI) in Landroid/provider/ContactsContract$CommonDataKinds$Phone;
 10-20 09:18:14.982: WARN/dalvikvm(210): VFY:  rejecting opcode 0x62 at
 0x0012
 10-20 09:18:14.982: WARN/dalvikvm(210): VFY:  rejected
 Lxcxin/mysecret/mainSecretActivity;.processContact
 (Landroid/database/Cursor;)V
 10-20 09:18:14.982: WARN/dalvikvm(210): Verifier rejected class
 Lxcxin/mysecret/mainSecretActivity;

 Now I know where I am wrong, ContactsContract.CommonDataKinds is only
 available on API Level 5 or higher.

 Thank you all

 Alex

 On Wed, Oct 20, 2010 at 7:39 AM, DanH danhi...@ieee.org wrote:
  Right ***above*** the exception trace should
  be some arcane-looking messages with VFY in them.

  On Oct 19, 6:36 pm, Alex Xin xinxi...@gmail.com wrote:
   Hi, thanks for helping me, here's the logcat, you could see it crashes
  prior
   to call my onCreate() method.

   10-20 07:32:27.490: ERROR/AndroidRuntime(204): java.lang.VerifyError:
   xcxin.mysecret.mainSecretActivity
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   java.lang.Class.newInstanceImpl(Native Method)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   java.lang.Class.newInstance(Class.java:1472)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   android.app.Instrumentation.newActivity(Instrumentation.java:1097)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at

  android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   android.app.ActivityThread.access$2100(ActivityThread.java:116)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   android.os.Handler.dispatchMessage(Handler.java:99)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   android.os.Looper.loop(Looper.java:123)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   android.app.ActivityThread.main(ActivityThread.java:4203)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   java.lang.reflect.Method.invokeNative(Native Method)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   java.lang.reflect.Method.invoke(Method.java:521)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at

  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
   10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
   dalvik.system.NativeStart.main(Native Method)

   On Wed, Oct 20, 2010 at 7:11 AM, fadden fad...@android.com wrote:
On Oct 19, 2:25 am, Alex Xin xinxi...@gmail.com wrote:
 I have an app that runs perfect on 2.2 and 2.2 but always getting
 VerifyError on 1.6 while startup, I don't think that my app cannot
  run
under
 1.6 because I don't call any APIs that don't support 1.6.

Post the output from logcat.  Right above the exception trace should
be some arcane-looking messages with VFY in 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.comandroid-developers%2bunsubscr...@googlegroups.com
  android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@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.comandroid-developers%2bunsubscr

[android-developers] Re: ConcurrentModificationException in SQLite

2010-10-19 Thread DanH
It's not a SQLite problem per se, it's a problem with the
android.database stuff, or the way you're using it.  (Has nothing to
do with database access.)

A HashMap referenced by
android.database.sqlite.SQLiteDatabase.getDbStats is getting modified
by another thread simultaneously.  HashTable is threadsafe, but not
HashMap.  Presumably there's a restriction on
android.database.sqlite.SQLiteDatabase.getDbStats and its kin with
regard to access from multiple threads.  (If not, there should be, or
a HashTable should be used instead of the HashMap.)

(Actually, looking at the SQLiteDatabase writeup I don't see any
restrictions on multithread access so long as you haven't done
setLockingEnabled(false), so this may well be an Android bug.)

On Oct 19, 6:51 pm, Bret Foreman bret.fore...@gmail.com wrote:
 I'm doing some stress testing of my SQLite database using the testing
 monkey and I got the following exception, which appears to be from
 inside SQLite. My app has many threads accessing the database but all
 of them do so in locking mode so I don't think this exception is my
 fault. Any opinions on whether I should worry about this exception or
 if it's just an artifact of the extremely fast monkey keyboard access?

 10-19 16:38:38.443: ERROR/JavaBinder(2035): *** Uncaught remote
 exception!  (Exceptions are not yet supported across processes.)
 10-19 16:38:38.443: ERROR/JavaBinder(2035):
 java.util.ConcurrentModificationException
 10-19 16:38:38.443: ERROR/JavaBinder(2035):     at java.util.HashMap
 $HashIterator.nextEntry(HashMap.java:795)
 10-19 16:38:38.443: ERROR/JavaBinder(2035):     at java.util.HashMap
 $KeyIterator.next(HashMap.java:822)
 10-19 16:38:38.443: ERROR/JavaBinder(2035):     at
 android.database.sqlite.SQLiteDatabase.getDbStats(SQLiteDatabase.java:
 2133)
 10-19 16:38:38.443: ERROR/JavaBinder(2035):     at
 android.database.sqlite.SQLiteDebug.getDatabaseInfo(SQLiteDebug.java:
 150)
 10-19 16:38:38.443: ERROR/JavaBinder(2035):     at
 android.app.ActivityThread$ApplicationThread.dump(ActivityThread.java:
 1793)
 10-19 16:38:38.443: ERROR/JavaBinder(2035):     at
 android.os.Binder.dump(Binder.java:222)
 10-19 16:38:38.443: ERROR/JavaBinder(2035):     at
 android.os.Binder.onTransact(Binder.java:201)
 10-19 16:38:38.443: ERROR/JavaBinder(2035):     at
 android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:
 407)
 10-19 16:38:38.443: ERROR/JavaBinder(2035):     at
 android.os.Binder.execTransact(Binder.java:288)
 10-19 16:38:38.443: ERROR/JavaBinder(2035):     at
 dalvik.system.NativeStart.run(Native Method)

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


[android-developers] Re: Memory Leaks

2010-10-18 Thread DanH
finalize isn't guaranteed to be called.  If you want to know if an
object has been GCed, create a WeakReference to it and test that after
the GC.

But note that full GC isn't guaranteed to occur when you do gc
either.  And some systems require two GCs to trigger finalize (or
clear a WeakReference).

And nulling out the only visible reference doesn't necessarily free
an object either.  There still may be a hidden temporary pointer to
the object in the method invocation.

On Oct 18, 10:58 am, John Gaby jg...@gabysoft.com wrote:
 I appear to have a memory leak(s) in my application, and I am trying
 to get a handle on it by trying to understand more about garbage
 collection.  I have created the following application.

 Here I have a class 'MyClass', and I create an instance of that class
 in my 'onCreate'.  I then null out the pointer which should leave no
 references to that instance.

 In 'MyClass', I override the finalize method so that I can see when
 the object is destroyed.  When I run this program, the finalize method
 is never called, even if I call System.gc(), from within my program,
 or use the 'Cause GC' button using DDMS.  (This is the same behavior
 that I see in my full application, by the way).

 Can someone explain to me more about what is going on here.  I believe
 that in my main application, that I have objects that are not being
 freed.  Is there some strategy for identifying those objects?

 Thanks.

 /*
  * Main Activity
  */

 package com.gabysoft.memoryleak;

 import android.app.Activity;
 import android.os.Bundle;

 public class MemoryLeak extends Activity {
     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState)
     {
         super.onCreate(savedInstanceState);

         MyClass mc = new MyClass();
         mc = null;

         setContentView(R.layout.main);

         System.gc();
     }

 }

 /*
  * My Class
  */

 package com.gabysoft.memoryleak;

 import android.util.Log;

 public class MyClass extends Object
 {
     MyClass()
     {
         Log.d(GabySoft, MyClass::MyClass()  + this);
     }

     @Override
     protected void finalize()
     {
         Log.d(Gabysoft, MyClass::finalize()  + 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: Storage

2010-10-18 Thread DanH
How do you handle a problem like Maria??

On Oct 18, 10:34 am, Julie Andrews julieonli...@gmail.com wrote:
 Scroll down slowly and be honest to yourself.

 *man
 1. 
 board*

 Ans. = man overboard

 *stand
 2. 
 i*

 Ans. = I understand

 OK?…. Got the drift?

 Let’s try a few now and see how you fair?

 *3. /r/e/a/d/i/n/ g/*

 .
 .
 .
 .
 .
 .
 .
 .
 .
 ..

 .
 Ans. = reading between the lines

 *4. r
 road
 a
 d*

 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 Ans. = cross road

 *5. cycle
 cycle
 cycle*

 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 Ans. = tricycle

 *0
 6. 
 M.D.
 Ph.D.*

 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .

 Ans. = two degrees below zero

 *knee
 7. 
 light*

 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .

 Ans. = neon light (knee-on-light)

 *ground
 8.  ——— —
 feet feet feet feet feet feet*

 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .

 Ans. = six feet underground

 *9. he’s / himself*

 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .

 Ans. = he’s by himself

 *10. ecnalg*

 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .

 Ans. = backward glance

 *11. death ….. life*

 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .

 Ans. = life after death
 12. THINK

 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .

 Ans. think big !!

 And the last one is real fundoo ..

 *13. ababaaa ababaabbaaa. …*

 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .

 Ans. long time no ‘C’ (see)



 On Mon, Oct 18, 2010 at 8:10 PM, Andy a...@fendley.com wrote:
  Hi,

  Does anyone know how to access programatically the internal(flash) and
  external(sd card) storage values such as space used and space
  available? I cant seem to find an api anywhere?

  Thanks for any help.

  Andy

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

 --
 Juliehttp://tradinglogically.blogspot.comhttp://tradinglogically.blogspot.comhttp://vikitionary.blogspot.comhttp://gandhi-the-man-of-millenium.blogspot.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: Memory Leaks

2010-10-18 Thread DanH
 What I really want
 is a way to find out whether an object has been freed (or will be
 freed) or not.  I believe that I must have objects that are not being
 freed, and I would like to try and identify them.

You can use WeakReferences for that.  Create a WeakReference for the
object.  If the WeakReference get method returns null the object has
been collected.  (Or you can get fancy and use the ReferenceQueue
feature.)

On Oct 18, 11:40 am, John Gaby jg...@gabysoft.com wrote:
 Thanks for the input.  I am a little confused about your comment:

 'The fact that you did not see the log from finalize() does not mean
 it did not happen.'

 Are you saying that the finalize can be called and yet I may not get
 the log?  How is that possible?

 I added the call to super.finalize() as you suggested (it didn't
 change anything), but please note that I really don't care about the
 finalize being called, except as a debugging tool.  What I really want
 is a way to find out whether an object has been freed (or will be
 freed) or not.  I believe that I must have objects that are not being
 freed, and I would like to try and identify them.

 Thanks

 On Oct 18, 9:26 am, Daniel Drozdzewski daniel.drozdzew...@gmail.com
 wrote:

  On Mon, Oct 18, 2010 at 4:58 PM, John Gaby jg...@gabysoft.com wrote:
   I appear to have a memory leak(s) in my application, and I am trying
   to get a handle on it by trying to understand more about garbage
   collection.  I have created the following application.

   Here I have a class 'MyClass', and I create an instance of that class
   in my 'onCreate'.  I then null out the pointer which should leave no
   references to that instance.

   In 'MyClass', I override the finalize method so that I can see when
   the object is destroyed.  When I run this program, the finalize method
   is never called, even if I call System.gc(), from within my program,
   or use the 'Cause GC' button using DDMS.  (This is the same behavior
   that I see in my full application, by the way).

   Can someone explain to me more about what is going on here.  I believe
   that in my main application, that I have objects that are not being
   freed.  Is there some strategy for identifying those objects?

   Thanks.

  Ok, few things first:
  - Android does not reclaim the memory straight away even after the
  application gets closed.
  - System.gc() does not guarantee garbage collection in a timely manner.
  - When overriding finalize() you have to call super.finalize().

  The fact that you did not see the log from finalize() does not mean it
  did not happen.

  Daniel

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Memory Leaks

2010-10-18 Thread DanH
I doubt that adding content to the object would make it any more
likely to be collected.  The garbage collector doesn't generally
weigh objects as to whether they should be collected or not.  The
only differentiating factors are 1) the absolute size of the object
itself (not counting references to other objects), 2) the number of
times the object has survived garbage collection, and (sometimes) 3)
the class of the object.

On Oct 18, 11:57 am, Daniel Drozdzewski daniel.drozdzew...@gmail.com
wrote:
 On Mon, Oct 18, 2010 at 5:54 PM, Daniel Drozdzewski



 daniel.drozdzew...@gmail.com wrote:
  On Mon, Oct 18, 2010 at 5:40 PM, John Gaby jg...@gabysoft.com wrote:
  Thanks for the input.  I am a little confused about your comment:

  'The fact that you did not see the log from finalize() does not mean
  it did not happen.'

  It is possible that the finalize() has been called at much later point.
  I should have probably said that lack of finalize() does not mean that
  the memory has not been regained.

  As Dan points out, finalizers don't necessary run.

  If Android decided to kill the process running finished application,
  then it would simply do it on a system level, without trying to clean
  the heap within that VM first.

  If you want to see finalizers at work, allocate many objects that you
  don't hold on to:

         for(int i=0; i1; i++ ) {
             MyClass x = new MyClass();
         }

  ...and then call the following:

         System.runFinalization();
         System.gc();

  You should see your log statements.

 btw, it would also help, if you made MyClass a bit heavier say by
 adding a member String and assigning to it some longish string literal
 in MyClass' constructor.

 --
 Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: NoClassDefFoundError when running the app

2010-10-18 Thread DanH
Note that NoClassDefFound can also occur because the class was found
but was incompatible with other classes it links to.

On Oct 18, 12:48 pm, ping bernd.warm...@gmail.com wrote:
 Hi.
 I have a problem with a library which i would like to use in my
 project.
 Here is the situtation:
 I have an android project which has another Java Project in its build
 path. Thats fine. The other java project reffers to another *.jar
 library on its buildpath. Eclipse does not show any errors. But when i
 try to call a method of the java project out of my android project it
 cannot find the classes which are in the *.jar file of the java
 project. It throws a NoClassDefFoundException.

 Android seems to doesnt find the *.jar file within the other java-
 project.

 Can anyone tell me what's the problem here

 Again: the projectstructure:

 ANDROID PROJECT ---uses--- JAVA PROJECT --uses--- *.jar
 when I call a method of the javaproject out of the android project a
 NoClassDefFoundException is thrown at the point where classes of the
 *.jar file were used :/

 greets

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Memory Leaks

2010-10-18 Thread DanH
You probably do need one of the tools that dumps the heap and shows
you the classes of the objects found.

And do note that Android (outside of the pure Java issues) has
issues of its own with regard to image storage.  You can obey all of
the Java rules on clearing references and still get bit by Android
images.

On Oct 18, 12:41 pm, John Gaby jg...@gabysoft.com wrote:
 So there is no way to force all objects that no longer have references
 to them to be garbage collected?

 Once again, I really don't need to know when the object is actually
 freed.  What I am interested in is finding out whether it CAN be
 freed.  That is whether all the references to it are gone.  In my real
 application, the objects in questions are much larger and more
 complex.  Yet, I never see the finalize called for them.  This make me
 think that I still have references to them, but since I don't see the
 finalize called even in a simple case where I am sure there are no
 references, I cannot be sure.  I definitely have a leak, however,
 since if I perform the same operation enough times, the application
 eventually gets an Out Of Memory error.

 I am taking a look at using ReferenceQueue, or PhantomReference for
 that purpose but they seem to be way more complicated that I need.

 Thanks again.

 On Oct 18, 10:21 am, DanH danhi...@ieee.org wrote:

  I doubt that adding content to the object would make it any more
  likely to be collected.  The garbage collector doesn't generally
  weigh objects as to whether they should be collected or not.  The
  only differentiating factors are 1) the absolute size of the object
  itself (not counting references to other objects), 2) the number of
  times the object has survived garbage collection, and (sometimes) 3)
  the class of the object.

  On Oct 18, 11:57 am, Daniel Drozdzewski daniel.drozdzew...@gmail.com
  wrote:

   On Mon, Oct 18, 2010 at 5:54 PM, Daniel Drozdzewski

   daniel.drozdzew...@gmail.com wrote:
On Mon, Oct 18, 2010 at 5:40 PM, John Gaby jg...@gabysoft.com wrote:
Thanks for the input.  I am a little confused about your comment:

'The fact that you did not see the log from finalize() does not mean
it did not happen.'

It is possible that the finalize() has been called at much later point.
I should have probably said that lack of finalize() does not mean that
the memory has not been regained.

As Dan points out, finalizers don't necessary run.

If Android decided to kill the process running finished application,
then it would simply do it on a system level, without trying to clean
the heap within that VM first.

If you want to see finalizers at work, allocate many objects that you
don't hold on to:

       for(int i=0; i1; i++ ) {
           MyClass x = new MyClass();
       }

...and then call the following:

       System.runFinalization();
       System.gc();

You should see your log statements.

   btw, it would also help, if you made MyClass a bit heavier say by
   adding a member String and assigning to it some longish string literal
   in MyClass' constructor.

   --
   Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: NoClassDefFoundError when running the app

2010-10-18 Thread DanH
Well, remember that the jar file CONTAINS class files.  In a normal
JDK environment the jar doesn't need to be compiled, since it
already is.  But in Android the contents of the jar does need to get
included into the dex file(s) which end up in the apk.

On Oct 18, 1:38 pm, ping bernd.warm...@gmail.com wrote:
 I figured out that no *.class files are generated when the project is
 building.
 I tried to clean the project but there are no *.class files of the
 *.jar in the bin folder of eclipse

 On Oct 18, 8:29 pm, DanH danhi...@ieee.org wrote:

  Note that NoClassDefFound can also occur because the class was found
  but was incompatible with other classes it links to.

  On Oct 18, 12:48 pm, ping bernd.warm...@gmail.com wrote:

   Hi.
   I have a problem with a library which i would like to use in my
   project.
   Here is the situtation:
   I have an android project which has another Java Project in its build
   path. Thats fine. The other java project reffers to another *.jar
   library on its buildpath. Eclipse does not show any errors. But when i
   try to call a method of the java project out of my android project it
   cannot find the classes which are in the *.jar file of the java
   project. It throws a NoClassDefFoundException.

   Android seems to doesnt find the *.jar file within the other java-
   project.

   Can anyone tell me what's the problem here

   Again: the projectstructure:

   ANDROID PROJECT ---uses--- JAVA PROJECT --uses--- *.jar
   when I call a method of the javaproject out of the android project a
   NoClassDefFoundException is thrown at the point where classes of the
   *.jar file were used :/

   greets

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Memory Leaks

2010-10-18 Thread DanH
Kostya's link was a good one.

On Oct 18, 2:17 pm, John Gaby jg...@gabysoft.com wrote:
 It is funny that you mention images, because I am pretty sure that my
 leak is associated with images not being freed.

 Can you point me to a reference that discusses the heap dumping tools?

 Thanks again

 On Oct 18, 11:35 am, DanH danhi...@ieee.org wrote:

  You probably do need one of the tools that dumps the heap and shows
  you the classes of the objects found.

  And do note that Android (outside of the pure Java issues) has
  issues of its own with regard to image storage.  You can obey all of
  the Java rules on clearing references and still get bit by Android
  images.

  On Oct 18, 12:41 pm, John Gaby jg...@gabysoft.com wrote:

   So there is no way to force all objects that no longer have references
   to them to be garbage collected?

   Once again, I really don't need to know when the object is actually
   freed.  What I am interested in is finding out whether it CAN be
   freed.  That is whether all the references to it are gone.  In my real
   application, the objects in questions are much larger and more
   complex.  Yet, I never see the finalize called for them.  This make me
   think that I still have references to them, but since I don't see the
   finalize called even in a simple case where I am sure there are no
   references, I cannot be sure.  I definitely have a leak, however,
   since if I perform the same operation enough times, the application
   eventually gets an Out Of Memory error.

   I am taking a look at using ReferenceQueue, or PhantomReference for
   that purpose but they seem to be way more complicated that I need.

   Thanks again.

   On Oct 18, 10:21 am, DanH danhi...@ieee.org wrote:

I doubt that adding content to the object would make it any more
likely to be collected.  The garbage collector doesn't generally
weigh objects as to whether they should be collected or not.  The
only differentiating factors are 1) the absolute size of the object
itself (not counting references to other objects), 2) the number of
times the object has survived garbage collection, and (sometimes) 3)
the class of the object.

On Oct 18, 11:57 am, Daniel Drozdzewski daniel.drozdzew...@gmail.com
wrote:

 On Mon, Oct 18, 2010 at 5:54 PM, Daniel Drozdzewski

 daniel.drozdzew...@gmail.com wrote:
  On Mon, Oct 18, 2010 at 5:40 PM, John Gaby jg...@gabysoft.com 
  wrote:
  Thanks for the input.  I am a little confused about your comment:

  'The fact that you did not see the log from finalize() does not 
  mean
  it did not happen.'

  It is possible that the finalize() has been called at much later 
  point.
  I should have probably said that lack of finalize() does not mean 
  that
  the memory has not been regained.

  As Dan points out, finalizers don't necessary run.

  If Android decided to kill the process running finished application,
  then it would simply do it on a system level, without trying to 
  clean
  the heap within that VM first.

  If you want to see finalizers at work, allocate many objects that 
  you
  don't hold on to:

         for(int i=0; i1; i++ ) {
             MyClass x = new MyClass();
         }

  ...and then call the following:

         System.runFinalization();
         System.gc();

  You should see your log statements.

 btw, it would also help, if you made MyClass a bit heavier say by
 adding a member String and assigning to it some longish string literal
 in MyClass' constructor.

 --
 Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Should I use synchronized for a boolean variable

2010-10-18 Thread DanH
BS.

On Oct 18, 3:59 pm, Bret Foreman bret.fore...@gmail.com wrote:
 Even if you just have one reader and one writer, you'll need to
 serialize access to the flag (with a mutex, for example). Otherwise,
 you might get an IOException if the flag is being written by one
 thread at the same time another thread tries to read 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: Should I use synchronized for a boolean variable

2010-10-18 Thread DanH
You need some sort of synchronization mechanism if you want to ASSURE
that the second thread sees the first thread's change of the flag
IMMEDIATELY.  Otherwise the value of the flag could be cached (to a
degree), even though declared volatile.  (However, one rarely runs
into a situation where twiddling a single flag isn't safe without
syncing.)


On Oct 18, 4:21 am, xeagle xeagle...@gmail.com wrote:
 Hi,

 I use a boolean variable flag both in main and child thread. This
 flag is used to notify child thread to exit. I only use simple
 operation, e.g., flag=false, if (flag) {}. As I know, in java,
 get and set a boolean variable is atomic. So synchronized is not
 needed for variable flag, declaring flag as volatile is enough.

 Is this still true in Android?

 Thanks
 Jason He

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Should I use synchronized for a boolean variable

2010-10-18 Thread DanH
Where did they say you could get an exception accessing an
unsynchronized value?

On Oct 18, 5:27 pm, Bret Foreman bret.fore...@gmail.com wrote:
 http://www.ibm.com/developerworks/java/library/j-jtp06197.html

 I'll stick with IBM's opinion. Note that they explicitly use a boolean
 as an example.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: OutOfMemoryError

2010-10-17 Thread DanH
Have you read what was written about calling onPause from onPause,
onStop from onStop, etc?

On Oct 17, 8:16 pm, Lisa lpk...@gmail.com wrote:
 hi, thank you very much、for your answers. (⌒.⌒)/

 I moved recycle in onStop.

 thanks, was solved this problem, the bitmap.
 Canvas: trying to use a recycled bitmap
 android.graphics.bit...@437d8e60
 thank you very very much. (@⌒.⌒@)/

 but OutOffMemory problems is cotinue. (;>_<;)
 please, it can also help me. (つД`;)ふぇ〜ん
 m(_ _)m

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 : Can we have Packages inside Layout

2010-10-15 Thread DanH
Nope -- with the exception of the raw subdirectory, everything in
the res directory must be flat.

On Oct 14, 10:54 am, Jatin D Patel depo.ja...@gmail.com wrote:
 I have multiple view. But for systematic distribution of views (.xml files
 inside layout folder). I would like to have different packages (/folders)
 inside Layout. Is It possible.

 @Attached : Screen shot

 IF that is possible, is the following statement correct ?. If Not whats the
 solution?

 setContentView(R.layout.payBill.payMyBill);

 Thanks for help.

 --
 Thanks,
 Jatin D N Patel
 Masters, Computer Sci.
 Suny Binghamton Univ, NY.

 You Got To Think HIGH to RISE.

  Untitled.jpg
 11KViewDownload

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: OutOfMemoryError

2010-10-15 Thread DanH
 but if I not put super.onPause (); show the following error:

 10-15 02:16:10.778: ERROR/AndroidRuntime(193):
 android.app.SuperNotCalledException: Activity {cai.eigojozu/
 cai.eigojozu.episode.EpisodeActivity} did not call through to
 super.onPause()
 Can I do? (・_・?)

I think you have a deeper problem here.  Generally each onXXX method
should call super of the SAME onXXX method.

On Oct 14, 11:21 pm, Lisa lpk...@gmail.com wrote:
 thank you very much、for your answers. (⌒.⌒)/
 --
 viktor :
 I switching image, implements the following:

 if (imgViewBG != null) {
    final Bitmap imageBG = BitmapFactory.decodeFile(strFile+.png);
    imgViewBG.setImageBitmap(imageBG);}

 --
 Daniel :
 the size of the image is
 Yes I using big image 854x480, I did display full screen, It's
 necesary in my app. f(・_・)
 I used BitmapFactory.Options for preferably to the size, but image
 quality not good.
 My image have letters, so image quality is important.should write
 letters?

 I sorry , the second question is do not quite understand, how to as
 checking
 My english is not good. p(~_~?)
 --
 Prakash Iyer:
 then where should reomever the bitmap? (・_・?)
 --
 DanH :
 but if I not put super.onPause (); show the following error:

 10-15 02:16:10.778: ERROR/AndroidRuntime(193):
 android.app.SuperNotCalledException: Activity {cai.eigojozu/
 cai.eigojozu.episode.EpisodeActivity} did not call through to
 super.onPause()
 Can I do? (・_・?)
 --
 fr4gus :
 I'm looking, but do not quite understand, for example the difference
 between hard and soft cahce. as used, etc.
 Can you explain me? m(_ _)m  please. ┌(_ _)┐

 thank you very much indeed.
 Thanks a lot for all your replies.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: OutOfMemoryError

2010-10-15 Thread DanH
And calling super.onPause in your onPause.

On Oct 15, 10:54 am, Prakash Iyer thei...@gmail.com wrote:
 I don't think you need to recycle the image in onPause. May be in onStop? If
 you want to do it onPause, then you might want to let the Canvas know that
 it's underlying image is no longer available in some fashion.

 You should call super.X() when you override X as a general rule, so I think
 DanH is referring to what looks like you are calling super.onPause in your
 override of onDestroy. So you should be calling super.onDestroy...

 On Fri, Oct 15, 2010 at 12:21 AM, Lisa lpk...@gmail.com wrote:
  thank you very much、for your answers. (⌒.⌒)/
  --
  viktor :
  I switching image, implements the following:

  if (imgViewBG != null) {
    final Bitmap imageBG = BitmapFactory.decodeFile(strFile+.png);
    imgViewBG.setImageBitmap(imageBG);
  }
  --
  Daniel :
  the size of the image is
  Yes I using big image 854x480, I did display full screen, It's
  necesary in my app. f(・_・)
  I used BitmapFactory.Options for preferably to the size, but image
  quality not good.
  My image have letters, so image quality is important.should write
  letters?

  I sorry , the second question is do not quite understand, how to as
  checking
  My english is not good. p(~_~?)
  --
  Prakash Iyer:
  then where should reomever the bitmap? (・_・?)
  --
  DanH :
  but if I not put super.onPause (); show the following error:

  10-15 02:16:10.778: ERROR/AndroidRuntime(193):
  android.app.SuperNotCalledException: Activity {cai.eigojozu/
  cai.eigojozu.episode.EpisodeActivity} did not call through to
  super.onPause()
  Can I do? (・_・?)
  --
  fr4gus :
  I'm looking, but do not quite understand, for example the difference
  between hard and soft cahce. as used, etc.
  Can you explain me? m(_ _)m  please. ┌(_ _)┐

  thank you very much indeed.
  Thanks a lot for all your replies.

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

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


[android-developers] Re: error code 5: database is locked

2010-10-15 Thread DanH
Where is the error being thrown from?  (You might include the
exception traceback.)

On Oct 15, 9:44 am, gcstang gcst...@gmail.com wrote:
 Has anyone encountered this and is there a solution to work around it?

 I'm creating a Thread and in that thread I open a database connection
 using the DBHelper, perform an update on a field in my database and
 close it. I create a separate one in the Thread because if the View is
 closed the global one for that view is closed, causing my Thread
 update to throw an error.

 The thread is in a View, that also has it's own instance of the
 DBHelper and
 opens the database onCreate
 closes it onPause
 opens it onResume
 closes it onDestroy

 The instance in my Thread is throwing this but not all the time :error
 code 5: database is locked

 Is there a known practice I should implement so I don't get this error?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 books

2010-10-14 Thread DanH
Nothing that counts as excellent (at least not that I've found).
I've not found any that are anywhere near true references (in the
sense of even one of the in a Nutshell books).  They're all pretty
much tutorials of one sort or another, some better organized and more
comprehensive than others.  Pro Android 2 is somewhat better than
the others I've looked at, but still leaves a lot to be desired.

On Oct 14, 7:52 am, MG my.android.a...@gmail.com wrote:
 Hi all.

 I am looking for an excellent Android references.
 What books and websites will you recommend that could be of great help
 even for a beginner like me?

 Thanks!

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


[android-developers] Re: sqlite with ç/ñ

2010-10-14 Thread DanH
I would guess that SQLite attempts to do a case-insensitive query, but
has a bug in converting non-Roman query values.

On Oct 13, 3:33 pm, iñaki inaki.s...@gmail.com wrote:
 Thanks Bret!!!

 Well, I´ve solved put my string in lowercase... Weird...
 I´ve try by SQLite Database Browser and i get the same response...
 With Ç don´t work but ç get rows...

  Why?

 On 13 October 2010 17:08, Bret Foreman bret.fore...@gmail.com wrote:

  Try using double quotes around your strings rather than single.
  Something like this:

  String myCondition = field == \Ç\;

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

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


[android-developers] Re: Detecting CB Radio Signals with Android Phones

2010-10-14 Thread DanH
It's conceivable that one could use some sort of passive resonant
frequency multiplier, but probably only in theory.

On Oct 13, 2:06 pm, Gerry gerry.t...@gmail.com wrote:
 CB is in the ~28 MHz frequency range which falls in the HF 10 meter
 brand.
 Bluetooth and wifi, are in GHz range
 and Cellular is in 800Mhz to 2 GHz.

 so I don't see how the on board circuit can detect CB signals.

 However, I can see one can convert a Ramsey 10 meter receiver kit to
 do just that !

 Gerry
  - FCC Licensed Amateur radio operator - Advanced Class and ARRL VE.

 On Oct 12, 4:07 am, Daniel Fung contentxtransl...@gmail.com wrote:

  Dear All,

  I was wondering whether it is possible to detect CB Radio signals with
  Android phones.  It just needs to detect the presence of and would not
  need to transmit.  Thanks in advance for any help that you could give
  me.

  Daniel

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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.R.string.yes/no returns OK/Cancel instead of yes/no?

2010-10-14 Thread DanH
They're defined like they're defined -- if they were changed then a
lot of applications would be broken, whether changing them makes
sense or not.

The only reason for using them (vs your own values) is to save
yourself the trouble of translating your own yes/no values should
you decide to support another language.

On Oct 14, 11:53 am, xZise javaxz...@googlemail.com wrote:
 I know that, but why there are constants named with yes and no but
 containing ok and cancel? Is it common to answer a yes/no question
 with ok/cancel? I hate this bad habit, because they sound not logical.

 Sincerely
 xZise

 On Oct 13, 8:19 pm, DanH danhi...@ieee.org wrote:

  Define your own application-local R.string values.  How to define
  string resources is one of the first things you should learn about
  Android development.

  On Oct 12, 3:23 pm, xZise javaxz...@googlemail.com wrote:

   Hello, I want to display a simple dialog to ask if somebody has done
   something.

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

           final AlertDialog.Builder b = new AlertDialog.Builder(this);
                   b.setIcon(android.R.drawable.ic_dialog_alert);
                   b.setTitle(Hello World);
                   b.setMessage(Did you done your homework?);
                   b.setPositiveButton(android.R.string.yes, null);
                   b.setNegativeButton(android.R.string.no, null);
                   b.show();
       }

   }

   Normally I would answer Yes or No, but the dialog only shows OK
   and Cancel. Is it easily possible to change it to Yes/No with
   localization?

   Sincerely
   xZise

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: OutOfMemoryError

2010-10-14 Thread DanH
Do you really want to do this:

protected void onDestroy () {
super.onPause ();

???

On Oct 12, 6:37 am, Lisa lpk...@gmail.com wrote:
 Hi, My name is Lisa .
 I am studying Android development.

 So I have a problem

 It immediately has trouble with memory.
 In the LogCat this error is displayed,

  java.lang.OutOfMemoryError: bitmap size exceeds VM budget

 I'm using recycle () and System.gc ()  but I get the same error.
 My application, is pressing a button switches to the next image and
 the images are 854x480
 Loading images from the SD Card.
 show the images as follows

 Bitmap imageB;
 ImageView imgV;

 imageB = BitmapFactory.decodeFile (sdcard / img.png);
 imgV.setImageBitmap (imageB);

 Release is as follow.

 @ Override
 protected void onDestroy () {
     super.onPause ();
     imageBG = null;
     System.gc ();

 }

 please help me out to solve the issu.
 sorry for my bad English

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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.R.string.yes/no returns OK/Cancel instead of yes/no?

2010-10-14 Thread DanH
Actually, my preference is to use graphics for those two, if one is
expecting to do much localization.  A left-pointing red arrow or an
X in a circle can mean cancel, while a right-pointing green arrow
or a check mark can mean OK.

On Oct 14, 12:27 pm, Kostya Vasilyev kmans...@gmail.com wrote:
   14.10.2010 21:13, DanH пишет: The only reason for using them (vs your own 
 values) is to save
  yourself the trouble of translating your own yes/no values should
  you decide to support another language.

 Even then, an application that only has those two strings in the current
 language, out of its whole UI, would look rather strange.

 And for proper localization, one might as well translate those two.

 --

 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.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: How can i set text in EditText

2010-10-14 Thread DanH
Other platforms have a facility for specifying prompt text to appear
in a text entry box, but I don't see an Android way to do it (though
I'm no expert).  You could easily fake it, though, by making the
background of the EditText transparent and placing a TextView behind
it containing the prompt text.  Clear the prompt text with the first
keystroke in the EditText.

On Oct 13, 4:43 pm, chcat vlyamt...@gmail.com wrote:
 Hi all,
 I am trying to implement simple user input validation in EditText,
 something like

 setText(type your password:)
 ...
 if ( user input != secretword)

 setText(incorrect, try again: )

 So i am using onTextChanged to validate keyboard input, but how can
 i set the text without going to infinite loop?
 Thank you,
 -V

 EditText tv = new EditText(this);
         tv.setText(type password );
         tv.addTextChangedListener(new TextWatcher() {
             public void afterTextChanged(Editable s) {
                 //XXX do something
    }
         public void beforeTextChanged(CharSequence s, int start, int
 count,
 int after) {
                Log.w(before text changed: , s.toString());
         }
         public void onTextChanged(CharSequence s, int start, int
 before, int count) {
                 //validate here and do what?

         }

 });

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


[android-developers] Re: How can i set text in EditText

2010-10-14 Thread DanH
Yep, that would appear to be it.  (Sorry I besmirched the good name of
Android ;) )

On Oct 14, 1:51 pm, Daniel Drozdzewski daniel.drozdzew...@gmail.com
wrote:
 On Thu, Oct 14, 2010 at 7:26 PM, DanH danhi...@ieee.org wrote:
  Other platforms have a facility for specifying prompt text to appear
  in a text entry box, but I don't see an Android way to do it (though
  I'm no expert).  You could easily fake it, though, by making the
  background of the EditText transparent and placing a TextView behind
  it containing the prompt text.  Clear the prompt text with the first
  keystroke in the EditText.

 Have a look at:

 TextView.setHint(int resid)

 --
 Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Differences between Android Button and JAVA buttons

2010-10-13 Thread DanH
The effective view area can be the whole screen with an alpha
channel.  I've had components layered 10 deep on other platforms.

On Oct 12, 11:28 pm, Kumar Bibek coomar@gmail.com wrote:
 You can have that, but again, the the effective view area is still a
 rectangle, isn't it?



 On Wed, Oct 13, 2010 at 9:44 AM, DanH danhi...@ieee.org wrote:
  I mean, eg, provide an image of a circle, and have only the area
  inside the circle (where alpha is non-zero) be sensitive.

  On Oct 12, 10:58 pm, Kumar Bibek coomar@gmail.com wrote:
   Ummm, What do you mean by modify that default? All the views take of a
   rectangular estate area. This is generally the way how widgets are laid
  out
   virtually everywhere. Even while you are designing HTML pages, everything
  is
   a rectangle.

   The boundaries of a view is always a rectangle.

   On Wed, Oct 13, 2010 at 9:22 AM, DanH danhi...@ieee.org wrote:
I know that's the default.  But other platforms have a way to modify
that default.

On Oct 12, 10:41 pm, Kumar Bibek coomar@gmail.com wrote:
 By default it is a rectangle. All the views are rectangles as well.
  As
Mark
 said, they look different because of the backgrounds.

 On Wed, Oct 13, 2010 at 9:02 AM, DanH danhi...@ieee.org wrote:
  That is an interesting question:  I haven't run across any way in
  Android to control the shape of the sensitive area of a button.  Is
  it
  always a rectangle, or can it be made circular, triangular, etc, by
  making it conform to the shape of an image?

  On Oct 11, 6:03 pm, Mark Murphy mmur...@commonsware.com wrote:
   A button is shaped like a button courtesy of its background. In
  the
   case of a button, that is a StateListDrawable consisting of a
  series
   of nine-patch (stretchable) PNG files representing different
  states
   (normal, pressed, focused, disabled, etc.).

   On Mon, Oct 11, 2010 at 7:01 PM, Dancing Fingers 
  batym...@gmail.com

  wrote:
Hi guys,
I'm working on my own Hexagonal button which works in JAVA.  I
  was
studying Android Button.java:

@RemoteView
public class Button extends TextView {
   public Button(Context context) {
       this(context, null);
   }

   public Button(Context context, AttributeSet attrs) {
       this(context, attrs,
com.android.internal.R.attr.buttonStyle);
   }

   public Button(Context context, AttributeSet attrs, int
  defStyle)
{
       super(context, attrs, defStyle);
   }
}

I don't understand where it gets it shape.  If you're adding an
anClickListener of does button know the geometry that's within
  it's
boundries?

Any enlightenment would be appreciated.

--
You received this message because you are subscribed to the
  Google
Groups Android Developers group.
To post to this group, send email to
  android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
  android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com

android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com
  android-developers%252bunsubscr...@googlegroups.comandroid-developers%25252bunsubscr...@googlegroups.com

For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en

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

 http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguyhttp://github.com/commonsguyhttp://commonsware.com/blog%7Chttp://twit...
  http://github.com/commonsguyhttp://commonsware.com/blog%7Chttp://twit...

 http://github.com/commonsguyhttp://commonsware.com/blog%7Chttp://twit...

   Android Training...At Your Office:
 http://commonsware.com/training

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to
android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
  android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com

android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com
  android-developers%252bunsubscr...@googlegroups.comandroid-developers%25252bunsubscr...@googlegroups.com

  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com

--
You received this message because

[android-developers] Description of how RelativeLayout works?

2010-10-13 Thread DanH
Can anyone point me to a good one?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: VerifyError: arbitrarily rejecting large method

2010-10-13 Thread DanH
From my knowledge of other Java verifiers/compilers, it's more the
complexity of the code rather than its absolute size that is likely to
be the problem.  Methods that branch into a lot of parallel paths (big
nested switch statements, eg) will cause problems, and things get
worse if there are a lot of nested exception handler ranges (try-
finally ranges are the worst).

In addition to somehow reducing the width of parallel branching (eg,
by placing inner switch statements in their own methods), if you can
reduce the number of global local variables (method local variables
that reach all branch paths) that's likely to help substantially.

On Oct 13, 11:42 am, MarVel marina.velik...@gmail.com wrote:
 Hi,

 I'm working on an android application for the analysis of measurements
 (e.g, blood pressure) using a Bayesian network model (PEModelOR is the
 class in my android application), which is embedded in a smart phone.
 Since the measurements are to be taken at sequential times, the model
 contains a number of variables referring to different time controls.
 With the initial version with 2 controls the model run without a
 problem but when I extended the model to 4 controls it crashed
 producing the following error:

 10-12 16:50:15.291: WARN/dalvikvm(4848): VFY: arbitrarily rejecting
 large method (regs=134 count=17618)
 10-12 16:50:15.291: WARN/dalvikvm(4848): VFY:  rejected Lcom/example/
 pregmonit/PEModelOR;.init ()V
 10-12 16:50:15.291: WARN/dalvikvm(4848): Verifier rejected class Lcom/
 example/pregmonit/PEModelOR;
 10-12 16:50:15.311: DEBUG/AndroidRuntime(4848): Shutting down VM
 10-12 16:50:15.311: WARN/dalvikvm(4848): threadid=1: thread exiting
 with uncaught exception (group=0x40027e08)
 10-12 16:50:15.341: ERROR/AndroidRuntime(4848): FATAL EXCEPTION: main
 10-12 16:50:15.341: ERROR/AndroidRuntime(4848): java.lang.VerifyError:
 com.example.pregmonit.PEModelOR
 10-12 16:50:15.341: ERROR/AndroidRuntime(4848):     at
 com.example.pregmonit.EBayes.init(EBayes.java:20)
 10-12 16:50:15.341: ERROR/AndroidRuntime(4848):     at
 com.example.pregmonit.EBayes.android_main(EBayes.java:78)
 10-12 16:50:15.341: ERROR/AndroidRuntime(4848):     at
 com.example.pregmonit.Status.onCreate(Status.java:54)

 I saw that in a recent 
 discussionhttp://groups.google.com/group/android-developers/browse_thread/threa...
 Dirk has encountered the same problem but unfortunately I could not
 see any solution to that.
 The extended PEModelOR method runs without problems in Java but it
 fails in the android application due to the dalvikvm verifier as far
 as I understood. The PEModelOR method is a description of a Bayesian
 Network in java and it simply contains definition of 62 variables and
 62 probability distribution tables (in total 700 lines and the java
 file is 41 KB); below is a sample of the code (note that BayesNet is a
 class loaded via external jar):

 import BayesianNetworks.*;
 public class PEModelOR extends BayesNet {
         public PEModelOR() {
         name = PEModelOR;
 ..
 final DiscreteVariable DB =
 new DiscreteVariable (DB,
 DiscreteVariable.CHANCE,
 new String[] { yes,no });
 ...
 DiscreteFunction p62=
 new DiscreteFunction(
 new DiscreteVariable[] {DB},
 new DiscreteVariable[] {FHDiab},
 new double[] {0.0052, 0.2, 0.9948, 0.8 });
 ...

 Does the size/definition of PEModelOR cause the problem? I'm not sure
 how I can split it as it needs to be loaded at once for creating the
 network and running the model with available measurements. The thing
 is that this is even not the final version of the model, where the
 goal is to have 11 time controls, ending up with 112 variables and
 probability tables, and 1245 lines.

 Is there a way out or alternative of implementing PEModelOR so that it
 does not fail at verification?
 I will highly appreciate any help and suggestions on solving this
 problem. Thanks a lot in advance.

 Cheers, MarVel

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Trouble with program - button only clickable once.

2010-10-13 Thread DanH
You do know, don't you, that you're generating a random number between
0 and 5, but only have switch cases 1-3?  IIRC, without a default
case the code will take an exception on an out-of-range switch value.

And I don't see the point of your if (!clicked) test in onCreate.

On Oct 10, 10:04 pm, Brian brian.corbin.o...@gmail.com wrote:
 I want the user to be able to click the generate button multiple
 times, but it can only be clicked once after the start screen.  I have
 my screen change to a different view based on which random number is
 made.  I want my program to generate another random number as many
 times as the user wants.  But my program only allows it to happen
 once.  Any way I can make it so that it is clickable an infinite
 number of times?

 My code is below:

 package org.factgenerator;

 import java.util.Random;
 import android.app.Activity;
 import android.os.Bundle;
 import android.view.View;
 import android.view.View.OnClickListener;

 public class Facts extends Activity implements OnClickListener{

         Random rand = new Random();
         int randomNumber;
         View generateButton;
         boolean clicked = false;

     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);

         View generateButton = findViewById(R.id.generate_button);
         if(!clicked){
         generateButton.setOnClickListener(this);
         }
     }

     public void generateNumber(){
         int n = 5;
                 randomNumber = rand.nextInt(n+1);
     }

         @Override
         public void onClick(View v) {
                 clicked = true;
                 generateNumber();
                 switch(randomNumber){
                 case 1:
                         setContentView(R.layout.fact1);
                         generateNumber();
                         clicked = false;
                 break;
                 case 2:
                         setContentView(R.layout.fact2);
                         generateNumber();
                         clicked = false;
                 break;
                 case 3:
                         setContentView(R.layout.fact3);
                         generateNumber();
                         clicked = false;
                 break;
                 }
                 //generateButton.setOnClickListener(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: android.R.string.yes/no returns OK/Cancel instead of yes/no?

2010-10-13 Thread DanH
Define your own application-local R.string values.  How to define
string resources is one of the first things you should learn about
Android development.

On Oct 12, 3:23 pm, xZise javaxz...@googlemail.com wrote:
 Hello, I want to display a simple dialog to ask if somebody has done
 something.

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

         final AlertDialog.Builder b = new AlertDialog.Builder(this);
                 b.setIcon(android.R.drawable.ic_dialog_alert);
                 b.setTitle(Hello World);
                 b.setMessage(Did you done your homework?);
                 b.setPositiveButton(android.R.string.yes, null);
                 b.setNegativeButton(android.R.string.no, null);
                 b.show();
     }

 }

 Normally I would answer Yes or No, but the dialog only shows OK
 and Cancel. Is it easily possible to change it to Yes/No with
 localization?

 Sincerely
 xZise

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Need I-phone app converted into an Android app.

2010-10-13 Thread DanH
Apple will reject an app if they don't like the way you tie your
shoes.

On Oct 13, 1:54 pm, Bret Foreman bret.fore...@gmail.com wrote:
 Can you give more details around the reason for rejection? Did it have
 to do with technology, security, or business?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Need I-phone app converted into an Android app.

2010-10-13 Thread DanH
Converting an app from iPhone to Android is non-trivial.  There may be
some companies that advertise the ability to do it (mostly)
automatically, but expect to pay for that, and don't expect
perfection.

On Oct 12, 4:02 pm, Murray sotadevelopm...@gmail.com wrote:
 An app that our company built for the I-phone was rejected. We would
 like to find someone who can convert the app over to the Android. The
 app was built using the Unity 3D engine. If any additional info is
 need then please feel free to post back. 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: Differences between Android Button and JAVA buttons

2010-10-12 Thread DanH
That is an interesting question:  I haven't run across any way in
Android to control the shape of the sensitive area of a button.  Is it
always a rectangle, or can it be made circular, triangular, etc, by
making it conform to the shape of an image?

On Oct 11, 6:03 pm, Mark Murphy mmur...@commonsware.com wrote:
 A button is shaped like a button courtesy of its background. In the
 case of a button, that is a StateListDrawable consisting of a series
 of nine-patch (stretchable) PNG files representing different states
 (normal, pressed, focused, disabled, etc.).



 On Mon, Oct 11, 2010 at 7:01 PM, Dancing Fingers batym...@gmail.com wrote:
  Hi guys,
  I'm working on my own Hexagonal button which works in JAVA.  I was
  studying Android Button.java:

  @RemoteView
  public class Button extends TextView {
     public Button(Context context) {
         this(context, null);
     }

     public Button(Context context, AttributeSet attrs) {
         this(context, attrs, com.android.internal.R.attr.buttonStyle);
     }

     public Button(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
     }
  }

  I don't understand where it gets it shape.  If you're adding an
  anClickListener of does button know the geometry that's within it's
  boundries?

  Any enlightenment would be appreciated.

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

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

 Android Training...At Your Office:http://commonsware.com/training

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Differences between Android Button and JAVA buttons

2010-10-12 Thread DanH
I know that's the default.  But other platforms have a way to modify
that default.

On Oct 12, 10:41 pm, Kumar Bibek coomar@gmail.com wrote:
 By default it is a rectangle. All the views are rectangles as well. As Mark
 said, they look different because of the backgrounds.



 On Wed, Oct 13, 2010 at 9:02 AM, DanH danhi...@ieee.org wrote:
  That is an interesting question:  I haven't run across any way in
  Android to control the shape of the sensitive area of a button.  Is it
  always a rectangle, or can it be made circular, triangular, etc, by
  making it conform to the shape of an image?

  On Oct 11, 6:03 pm, Mark Murphy mmur...@commonsware.com wrote:
   A button is shaped like a button courtesy of its background. In the
   case of a button, that is a StateListDrawable consisting of a series
   of nine-patch (stretchable) PNG files representing different states
   (normal, pressed, focused, disabled, etc.).

   On Mon, Oct 11, 2010 at 7:01 PM, Dancing Fingers batym...@gmail.com
  wrote:
Hi guys,
I'm working on my own Hexagonal button which works in JAVA.  I was
studying Android Button.java:

@RemoteView
public class Button extends TextView {
   public Button(Context context) {
       this(context, null);
   }

   public Button(Context context, AttributeSet attrs) {
       this(context, attrs, com.android.internal.R.attr.buttonStyle);
   }

   public Button(Context context, AttributeSet attrs, int defStyle) {
       super(context, attrs, defStyle);
   }
}

I don't understand where it gets it shape.  If you're adding an
anClickListener of does button know the geometry that's within it's
boundries?

Any enlightenment would be appreciated.

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

   --
   Mark Murphy (a Commons Guy)http://commonsware.com|
 http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguyhttp://github.com/commonsguyhttp://commonsware.com/blog%7Chttp://twit...

   Android Training...At Your Office:http://commonsware.com/training

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

 --
 Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.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: out of memory, VM won't let us allocate,.

2010-10-12 Thread DanH
I'm guessing it has to do with the bitmap size here:
 Out of memory: Heap Size=5639KB, Allocated=3134KB, Bitmap Size=18669KB

The Android has a mysterious and troublesome bitmap caching scheme,
and sometimes this requires the explicit issuance of System.gc
calls, even though the Java book says that should never be necessary.
And the programmer can exacerbate the situation by not cleaning up
old images properly, though I'm a babe in the woods in terms of
understanding that snake pit.

On Oct 12, 9:58 pm, n2v2rda2 l...@unimocnc.co.kr wrote:
 below is my code to make bitmap from network-jpeg-stream whose size
 is 360*288
 i don't know how to handle it ,
 ---
         private void makeImage() {
                 try {
                         System.arraycopy(BA.toByteArray(), 0, temporaryBA, 0, 
 BA.length());
                         int tempBALength = BA.length();

                         if (BA.byteAt(startJpeg) == (byte) 0xff  
 BA.byteAt(startJpeg + 1)
 == (byte) 0xD8) {
                                 if ((BA.byteAt(endJpeg - 1) == (byte) 0xff  
 BA.byteAt(endJpeg)
 == (byte) 0xD9)
                                                 || (BA.byteAt(endJpeg - 2) == 
 (byte) 0xff  BA.byteAt(endJpeg -
 1) == (byte) 0xD9)) {

                                         BitmapFactory.Options options = new 
 BitmapFactory.Options();
                                         options.inSampleSize = 2;
                                         options.inTempStorage = new byte[256];

                                         Bitmap orgBitmap = 
 BitmapFactory.decodeByteArray(temporaryBA,
 startJpeg, endJpeg - startJpeg +1,options);
                                         Bitmap bitmap = 
 Bitmap.createScaledBitmap(orgBitmap, width,
 (height / 2) , true);
                                         if (bitmap != null) {
                                                 screenshot = new byte[endJpeg 
 - startJpeg +1];
                                                 System.arraycopy(temporaryBA, 
 startJpeg, screenshot, 0, endJpeg
 - startJpeg +1);

                                                 Message msg = 
 Message.obtain(handler, 0, current_ch, 0, bitmap);
                                                 handler.sendMessage(msg);
                                         } else {
                                                 BA.clear();
                                         }
                                 }else{
                                         BA.clear();
                                 }
                         }else {
                                 BA.clear();
                         }
                         BA.clear();
                         BA.setLength(0);
                         BA.append(temporaryBA, iEndMarkIndex, tempBALength -
 iEndMarkIndex);
                 } catch (IllegalArgumentException e) {
                         BA.clear();
                 } catch (OutOfMemoryError om) {
                         BA.clear();
                 } catch (NullPointerException np) {
                         BA.clear();
                 } catch (IndexOutOfBoundsException io) {
                         BA.clear();
                 }
         }
 ---logcat -
 error

 10-13 11:22:03.472: ERROR/dalvikvm-heap(6060): 384000-byte external
 allocation too large for this process.
 10-13 11:22:03.472: ERROR/dalvikvm(6060): Out of memory: Heap
 Size=5639KB, Allocated=3134KB, Bitmap Size=18669KB
 10-13 11:22:03.472: ERROR/(6060): VM won't let us allocate 384000
 bytes
 10-13 11:22:03.582: INFO/DEBUG(5641): *** *** *** *** *** *** *** ***
 *** *** *** *** *** *** *** ***
 10-13 11:22:03.582: INFO/DEBUG(5641): Build fingerprint: 'skt_kr/
 htc_bravo/bravo/bravo:2.1-update1/ERE27/171460:user/release-keys'
 10-13 11:22:03.582: INFO/DEBUG(5641): pid: 6060, tid: 6081    rams
 
 10-13 11:22:03.582: INFO/DEBUG(5641): signal 11 (SIGSEGV), fault addr
 
 10-13 11:22:03.582: INFO/DEBUG(5641):  r0 003d48d0  r1   r2
   r3 003d48f4
 10-13 11:22:03.582: INFO/DEBUG(5641):  r4 003d48d0  r5   r6
   r7 
 10-13 11:22:03.582: INFO/DEBUG(5641):  r8 483b3d08  r9 42ea2ed4  10
 483b3e38  fp 42ea2ed4
 10-13 11:22:03.582: INFO/DEBUG(5641):  ip 003d48d0  sp 483b3ae8  lr
   pc ac04ab2c  cpsr 6010
 10-13 11:22:03.612: INFO/DEBUG(5641):          #00  pc 0004ab2c  /
 system/lib/libskia.so
 10-13 11:22:03.612: INFO/DEBUG(5641):          #01  pc 0004abf0  /
 system/lib/libskia.so
 10-13 11:22:03.612: INFO/DEBUG(5641):          #02  pc 000689d4  /
 system/lib/libskia.so
 10-13 11:22:03.622: INFO/DEBUG(5641):          #03  pc 00064154  /
 system/lib/libskia.so
 10-13 11:22:03.622: INFO/DEBUG(5641):          #04  pc 0004446c  /
 system/lib/libandroid_runtime.so
 10-13 11:22:03.622: 

[android-developers] Re: Differences between Android Button and JAVA buttons

2010-10-12 Thread DanH
I mean, eg, provide an image of a circle, and have only the area
inside the circle (where alpha is non-zero) be sensitive.

On Oct 12, 10:58 pm, Kumar Bibek coomar@gmail.com wrote:
 Ummm, What do you mean by modify that default? All the views take of a
 rectangular estate area. This is generally the way how widgets are laid out
 virtually everywhere. Even while you are designing HTML pages, everything is
 a rectangle.

 The boundaries of a view is always a rectangle.



 On Wed, Oct 13, 2010 at 9:22 AM, DanH danhi...@ieee.org wrote:
  I know that's the default.  But other platforms have a way to modify
  that default.

  On Oct 12, 10:41 pm, Kumar Bibek coomar@gmail.com wrote:
   By default it is a rectangle. All the views are rectangles as well. As
  Mark
   said, they look different because of the backgrounds.

   On Wed, Oct 13, 2010 at 9:02 AM, DanH danhi...@ieee.org wrote:
That is an interesting question:  I haven't run across any way in
Android to control the shape of the sensitive area of a button.  Is it
always a rectangle, or can it be made circular, triangular, etc, by
making it conform to the shape of an image?

On Oct 11, 6:03 pm, Mark Murphy mmur...@commonsware.com wrote:
 A button is shaped like a button courtesy of its background. In the
 case of a button, that is a StateListDrawable consisting of a series
 of nine-patch (stretchable) PNG files representing different states
 (normal, pressed, focused, disabled, etc.).

 On Mon, Oct 11, 2010 at 7:01 PM, Dancing Fingers batym...@gmail.com

wrote:
  Hi guys,
  I'm working on my own Hexagonal button which works in JAVA.  I was
  studying Android Button.java:

  @RemoteView
  public class Button extends TextView {
     public Button(Context context) {
         this(context, null);
     }

     public Button(Context context, AttributeSet attrs) {
         this(context, attrs,
  com.android.internal.R.attr.buttonStyle);
     }

     public Button(Context context, AttributeSet attrs, int defStyle)
  {
         super(context, attrs, defStyle);
     }
  }

  I don't understand where it gets it shape.  If you're adding an
  anClickListener of does button know the geometry that's within it's
  boundries?

  Any enlightenment would be appreciated.

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to
android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
  android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com

  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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

 http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguyhttp://github.com/commonsguyhttp://commonsware.com/blog%7Chttp://twit...
  http://github.com/commonsguyhttp://commonsware.com/blog%7Chttp://twit...

 Android Training...At Your Office:http://commonsware.com/training

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to
  android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
  android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com

For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en

   --
   Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.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: Proper way to use Non-Extended Classes?

2010-10-11 Thread DanH
SharedPreferences pref
=ctcx.getSharedPreferences(MyPref,Context.MODE_PRIVATE);

On Oct 7, 2:23 pm, Ehask ehas...@gmail.com wrote:
 I have an app I am working on and being new to Android Dev I am
 running into a situation

 I have a Scores class not extended from anything (Activity,Service,
 etc) but in the same package that needs to access SharedPreferences

 public class Scores {

 Context ctcx;

 public Scores(Context context) {
       ctcx = context;

 }

 public void resetScores(){

      SharedPreferences pref =
 getSharedPreferences(MyPref,ctcx.MODE_PRIVATE);

 }
 }

 Always results in constructor not defined? All the imports are there
 and Eclipse doesnt flag until it tries to run on emulator. Does
 everything have to extend something in android?

 Thx for any guidance
 Eric

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: usb connection issues

2010-10-10 Thread DanH
I have Vista 64 and the Google phone (forget the name).  Have not seen
this problem.  I do have assorted shutdown problems, but generally of
the opposite nature -- powers off (hard) rather than hibernating.

On Oct 10, 11:07 am, dashman erjdri...@gmail.com wrote:
 my platform is vista 64 + droid.

 it connects and i can download apps 3-4 times and then
 cannot send - times out.

 i cannot even restart vista - the shutdown screen just
 hangs. i have to shut it down manually.

 any help appreciate - this is throwing a real kink
 in my dev cycle.

 i have usb driver #3.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Buying numbers vs developing numbers

2010-10-10 Thread DanH
You figuring that if we each bought each other's apps it would improve
business??

On Oct 10, 10:25 am, Bret Foreman bret.fore...@gmail.com wrote:
 It would be interesting to know if the number of people buying apps is
 growing as fast as the number developing them. Has anyone seen data
 about either?

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


[android-developers] Re: Is it possible

2010-10-10 Thread DanH
 (provided you code uses its public IP address to connect to it).

That is the key.  The internal Android-to-host IP address (I forget
what it is) cannot be used.

On Oct 10, 6:22 am, David Turner di...@android.com wrote:
 If the server is addressable from the Internet (i.e. not under a NAT or
 firewall that hides it), then it should work
 (provided you code uses its public IP address to connect to it).

 On Sat, Oct 9, 2010 at 4:57 AM, Jatin D Patel depo.ja...@gmail.com wrote:

  I have developed an android app which calls the web service which runs
  smoothly on my emulator.

  Will the same appl work if i installed the same application on android
  mobile device and call the webservice. (server running on my laptop)

  --
  Thanks,
  Jatin D N Patel
  Masters, Computer Sci.
  Suny Binghamton Univ, NY.

  You Got To Think HIGH to RISE.

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

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


[android-developers] Re: Looking for help testing an app

2010-10-10 Thread DanH
Sounds like a worthwhile concept, but I don't listen to music on my
phone (or iPod or anything else).

On Oct 10, 1:04 am, Mike M mike.mos...@gmail.com wrote:
 Hey everyone,

 I don't know if this is kosher, but I wanted to see if anyone would
 want to test an app I built.  I don't want to release an app to the
 market without getting out all the bugs I can, but I'm a lone
 developer trying to build apps on the side in my free time.  I don't
 know many people with Droids, so I'm trying to reach out to the
 community.

 I built an app I call Next Track on Shake.  Not a good name, (and
 I'm up for suggestions for a better name) but I can't think of
 anything else to explain its function.  I listen to alot of music,
 usually on shuffle, and I hate having to wake the phone up, unlock the
 screen, open the music player, and change the track.  The new versions
 of Android require PIN or Password when you use a corporate account,
 and that adds another step in changing tracks.

 I built an app that allows you to shake the phone, whether awake or
 not, and it will move to the next track for you.  I also added the
 ability to customize the shake; you can set how hard or how fast you
 need to shake the phone to change the track.  The default shake is a
 good setting for most people, but alot of people jog with the phone on
 their arm or hip and would need to adjust the strength of the shake so
 as to not accidentally change tracks.  I've also added the ability to
 stop/start the service when needed, and I display an ongoing
 notification when the service is running.  When the phone is rebooted,
 the app checks the preferences, and only starts the app if you had the
 service running before reboot.

 That's my app in a nutshell. As I said, I'd love it to be as bug-free
 as possible when I release it, so I'm looking for some help.  Please
 leave comments with any feedback, issues, or suggestions you have.  I
 appreciate everyone's help.

 Here's the link to the app:  http://www.megaupload.com/?d=E1YXV89X

 Thanks,

 Mike M

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 dreaded error: Error parsing XML: XML or text declaration not at start of entity

2010-10-10 Thread DanH
Export the project, delete it, then import it?

On Oct 10, 12:51 pm, Bret Foreman bret.fore...@gmail.com wrote:
 I accidentally imported a resource file with a capital letter in the
 name (SDK 8) and as we all know, that corrupts the R.java file in a
 way that rebuilding the project doesn't fix (I renamed the file to
 something legal from within Eclipse, of course). So now the build
 chokes with the error above when it hits the first xml file in res. In
 SDK 7 the only fix was to build a fresh project and move everything
 over. I'm hoping there is something better in SDK 8. Anyone know of
 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: The dreaded error: Error parsing XML: XML or text declaration not at start of entity

2010-10-10 Thread DanH
Though seems like cleaning the project should work.

On Oct 10, 12:51 pm, Bret Foreman bret.fore...@gmail.com wrote:
 I accidentally imported a resource file with a capital letter in the
 name (SDK 8) and as we all know, that corrupts the R.java file in a
 way that rebuilding the project doesn't fix (I renamed the file to
 something legal from within Eclipse, of course). So now the build
 chokes with the error above when it hits the first xml file in res. In
 SDK 7 the only fix was to build a fresh project and move everything
 over. I'm hoping there is something better in SDK 8. Anyone know of
 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: Accessing the apk-signing certificate from inside the program

2010-10-10 Thread DanH
Supposedly you can fetch your public keys from
PackageInfo.signatures.  (Should only be one if the package is only
signed once.)  (Yeah, I know -- key != signature, but I have it from
the Highest Authority that that interface returns the keys.)

On Oct 7, 10:58 am, BGraversen br...@digital-identity.dk wrote:
 Hi.

 I've posted this on Android Security as well, but that group does not
 appear to have as much activity, so I'm hoping someone here can help
 me. Actually I guess my question belongs in this group anyway, even
 though it touches on some of the security aspects of android packages.

 My goal is to access the certificate that was used to sign the apk
 package; and ordinarily, I would do that from inside the program like
 this

 Certificates[] signingCertificates =
 getClass().getProtectionDomain().getCodeSource().getCertificates();

 Unfortunately it appears that getProtectionDomain() returns null on
 android - according to the specs

 http://developer.android.com/reference/java/lang/Class.html#getProtec...

 this method might return null (to converse space?), but only for
 system classes. Since I'm calling this from one of my own classes, I
 would expect to get a non-null value, but unfortunately not :(

 I have tried from the emulator, and from an application deployed on my
 phone using adb through a USB cable. I'm using the latest SDK (2.2)
 and targeting android 1.6.

 So I guess I have two questions, the first being: why does
 getProtectionDomain return null, and have anyone had any success using
 this method from inside an android application.

 And the second: Is there some other way to access the certificate that
 a given apk package was signed with (I can live with the restriction
 that only a given package can know its own certificate).

 Kind regards
 Brian Graversen

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Buying numbers vs developing numbers

2010-10-10 Thread DanH
So long as it works long enough for me to retire ...

On Oct 10, 1:27 pm, Kostya Vasilyev kmans...@gmail.com wrote:
 I think it was shown - by the NASDAQ crash in March 2000 - that this
 particular economic model does not work for too long... :)

 --
 Kostya Vasilyev --http://kmansoft.wordpress.com

 10.10.2010 21:06 пользователь Bret Foreman bret.fore...@gmail.com
 написал:

 Well, yeah, and we each buy our own too. So everybody gets two
 downloads.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers ...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Unable to sign jar

2010-10-09 Thread DanH
It might have worked out to just clean your app.

On Oct 9, 3:43 am, Ali Chousein ali.chous...@gmail.com wrote:
 It seems that it's a bug in Eclipse. I use 3.5. Besides the
 corrupted apk, my eclipse started behaving quite weird (like
 remembering the contents of the manifest file of a project I removed
 and also erased from my hard disk). Anyway, I erased the instance of
 eclipse from my hard drive, reconfigured it and things went back to
 normal again. Unfortunately I don't know how to reproduce 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 convert xml to svg in Android

2010-10-09 Thread DanH
 Isn't svg based on xml ?

From what little I understand, yes.  Examine the file with a source
browser and see if it looks OK.

On Oct 8, 11:01 pm, 大风 jindafeng2...@gmail.com wrote:
 Now I just parse the svg file the same way as xml file , in order to
 get some information and the draw the picture on the Android by
 myself , I can parse xml file but failed in svg file , Isn't svg based
 on xml ?

 On Oct 8, 11:43 pm, DanH danhi...@ieee.org wrote:

  If at all possible you should use a utility to convert the SVG to some
  other format before loading it onto the phone.

  On Oct 8, 9:11 am, 大风 jindafeng2...@gmail.com wrote:

   So I want to write it myself, there are already apps that implement it
   but no source code.

   On Oct 8, 9:15 pm, jamesc jame...@gmail.com wrote:

Android doesn't currently have SVG 
support:http://developer.android.com/guide/appendix/media-formats.html

On Oct 8, 1:03 pm, 大风 jindafeng2...@gmail.com wrote:

 Well,Now I want to parse the svg file in Android.What do I need to do?
 On Oct 8, 7:06 pm, DanH danhi...@ieee.org wrote:

  Rename it from .xml to .svg?  (Of course, this will only work if 
  it's
  the valid XML for an SVG image.)

  On Oct 8, 2:12 am, 大风 jindafeng2...@gmail.com wrote:

   How to convert xml to svg in Android, Anybody anyideas?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Exception every time I launch the application

2010-10-09 Thread DanH
This exception doesn't occur until the problem layout is actually
loaded, meaning if it occurs before the first screen comes up it's the
layout for the first screen.

And the exception is raised when setContentView is done with the
problem layout ID.  If you step through your code you'll likely see it
blow up when setContentView is being done for your first screen.

On Oct 9, 5:01 pm, Pankaj pankajiit...@gmail.com wrote:
 Ya I got that much from the exception, But in which XML ? I could not
 figure that out that is why I have provided the xml files

 On Oct 9, 4:00 am, DanH danhi...@ieee.org wrote:

  Speak of the devil! (Just had this problem myself.)  Read carefully
  the first few lines in yourexceptionstack:

  Binary XML file line #25: You must supply a layout_height attribute.

  On Oct 8, 4:42 pm, Pankaj pankajiit...@gmail.com wrote:

   Hi all,

   I get anexceptioneverytimeIlaunchtheapplication. Here is the
   stacktrace for theexception

   10-01 14:49:35.321: WARN/WindowManager(61):Exceptionwhen adding
   starting window
   10-01 14:49:35.321: WARN/WindowManager(61):
   java.lang.RuntimeException: Binary XML file line #25: You must supply
   a layout_height attribute.
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.content.res.TypedArray.getLayoutDimension(TypedArray.java:438)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:
   3468)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.ViewGroup$MarginLayoutParams.init(ViewGroup.java:3547)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.widget.LinearLayout$LayoutParams.init(LinearLayout.java:
   1265)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:
   1191)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:45)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.LayoutInflater.inflate(LayoutInflater.java:407)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.LayoutInflater.inflate(LayoutInflater.java:320)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.LayoutInflater.inflate(LayoutInflater.java:276)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:
   2153)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:
   2207)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:
   1395)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.internal.policy.impl.PhoneWindowManager.addStartingWindow(PhoneWindowManager.java:
   818)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.server.WindowManagerService
   $H.handleMessage(WindowManagerService.java:8794)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.os.Handler.dispatchMessage(Handler.java:99)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.os.Looper.loop(Looper.java:123)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.server.WindowManagerService
   $WMThread.run(WindowManagerService.java:531)

   I am also posting the XML files I'm using.

   ?xml version=1.0 encoding=utf-8?

   RelativeLayout xmlns:android=http://schemas.android.com/apk/res/
   android
       android:id=@+id/arw_layout android:orientation=horizontal
       android:layout_width=fill_parent
   android:layout_height=wrap_content
       ImageView android:id=@+id/arw_logo android:layout_width=30px
           android:layout_height=40px
   android:layout_alignParentRight=true /
       LinearLayout xmlns:android=http://schemas.android.com/apk/res/
   android
           android:orientation=horizontal
   android:layout_width=fill_parent
           android:layout_height=wrap_content android:gravity=center
           android:layout_alignParentLeft=true
           TextView android:id=@+id/arw_left
   android:layout_width=wrap_content
               android:layout_height=wrap_content android:text=@string/
   arw_left
               android:textSize=25sp android:paddingLeft=10dp
               android:paddingRight=10dp
   android:gravity=center_vertical /
           TextView android:id=@+id/arw_title
   android:layout_width=wrap_content
               android:layout_height=wrap_content android:minEms=10
               android:text=@string/arw_title
   android:paddingLeft=10dp
               android:paddingRight=10dp android:gravity=center /
           TextView android:id=@+id/arw_right
   android:layout_width=wrap_content
               android:layout_height

[android-developers] Re: Exception every time I launch the application

2010-10-09 Thread DanH
Also keep in mind that one occasionally slips up (or Eclipse slips up)
and the project is not rebuilt before running.  Or you can simply
forget which XML is which.  Try rebuilding, and verify for yourself
which XML is being used for which screen.

On Oct 9, 5:01 pm, Pankaj pankajiit...@gmail.com wrote:
 Ya I got that much from the exception, But in which XML ? I could not
 figure that out that is why I have provided the xml files

 On Oct 9, 4:00 am, DanH danhi...@ieee.org wrote:

  Speak of the devil! (Just had this problem myself.)  Read carefully
  the first few lines in yourexceptionstack:

  Binary XML file line #25: You must supply a layout_height attribute.

  On Oct 8, 4:42 pm, Pankaj pankajiit...@gmail.com wrote:

   Hi all,

   I get anexceptioneverytimeIlaunchtheapplication. Here is the
   stacktrace for theexception

   10-01 14:49:35.321: WARN/WindowManager(61):Exceptionwhen adding
   starting window
   10-01 14:49:35.321: WARN/WindowManager(61):
   java.lang.RuntimeException: Binary XML file line #25: You must supply
   a layout_height attribute.
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.content.res.TypedArray.getLayoutDimension(TypedArray.java:438)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:
   3468)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.ViewGroup$MarginLayoutParams.init(ViewGroup.java:3547)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.widget.LinearLayout$LayoutParams.init(LinearLayout.java:
   1265)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:
   1191)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:45)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.LayoutInflater.inflate(LayoutInflater.java:407)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.LayoutInflater.inflate(LayoutInflater.java:320)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.view.LayoutInflater.inflate(LayoutInflater.java:276)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:
   2153)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:
   2207)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:
   1395)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.internal.policy.impl.PhoneWindowManager.addStartingWindow(PhoneWindowManager.java:
   818)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.server.WindowManagerService
   $H.handleMessage(WindowManagerService.java:8794)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.os.Handler.dispatchMessage(Handler.java:99)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   android.os.Looper.loop(Looper.java:123)
   10-01 14:49:35.321: WARN/WindowManager(61):     at
   com.android.server.WindowManagerService
   $WMThread.run(WindowManagerService.java:531)

   I am also posting the XML files I'm using.

   ?xml version=1.0 encoding=utf-8?

   RelativeLayout xmlns:android=http://schemas.android.com/apk/res/
   android
       android:id=@+id/arw_layout android:orientation=horizontal
       android:layout_width=fill_parent
   android:layout_height=wrap_content
       ImageView android:id=@+id/arw_logo android:layout_width=30px
           android:layout_height=40px
   android:layout_alignParentRight=true /
       LinearLayout xmlns:android=http://schemas.android.com/apk/res/
   android
           android:orientation=horizontal
   android:layout_width=fill_parent
           android:layout_height=wrap_content android:gravity=center
           android:layout_alignParentLeft=true
           TextView android:id=@+id/arw_left
   android:layout_width=wrap_content
               android:layout_height=wrap_content android:text=@string/
   arw_left
               android:textSize=25sp android:paddingLeft=10dp
               android:paddingRight=10dp
   android:gravity=center_vertical /
           TextView android:id=@+id/arw_title
   android:layout_width=wrap_content
               android:layout_height=wrap_content android:minEms=10
               android:text=@string/arw_title
   android:paddingLeft=10dp
               android:paddingRight=10dp android:gravity=center /
           TextView android:id=@+id/arw_right
   android:layout_width=wrap_content
               android:layout_height=wrap_content android:text=@string/
   arw_right
               android:textSize=25sp android:paddingLeft=10dp

[android-developers] Re: Wierd memory leak

2010-10-08 Thread DanH
Well, I would hope that the Java threadsafe classes are still
threadsafe.  But essentially none of the UI is, and the structure of
the system greatly discourages sharing data between threads.

On Oct 8, 5:00 am, Daniel Drozdzewski daniel.drozdzew...@gmail.com
wrote:
 On Thu, Oct 7, 2010 at 6:40 PM, DanH danhi...@ieee.org wrote:
  Right.  The main difference is that StringBuffer is threadsafe, and
  nothing else in Android is threadsafe, so little point in using
  StringBuffer.

 Well,
 there are few places, where Java (Android) are thread safe (Vector,
 Stack, few classes in javax.nio.* and quite few classes in
 java.util.concurrent.*)
 If String modification is happening by multiple actors (user generated
 events, network) then it makes sense using StringBuffer.

  (That said, the performance edge of StringBuilder over StringBuffer is
  unlikely to be noticed.)

 True

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 xml to svg in Android

2010-10-08 Thread DanH
Rename it from .xml to .svg?  (Of course, this will only work if it's
the valid XML for an SVG image.)

On Oct 8, 2:12 am, 大风 jindafeng2...@gmail.com wrote:
 How to convert xml to svg in Android, Anybody anyideas?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Possible to check .apk signature?

2010-10-08 Thread DanH
What I mean is that if the bad actor can manipulate the apk bytes
while still maintaining the same checksum, then the whole scheme is
insecure -- there's no point in having it signed.  A CRC32 checksum is
easily spoofed -- the apk bytes need to be checksummed with a
cryptographic checksum of some sort.

On Oct 8, 1:01 am, Dianne Hackborn hack...@android.com wrote:
 On Thu, Oct 7, 2010 at 6:22 PM, DanH danhi...@ieee.org wrote:
  So what is protecting the application from forgery?

 What do you mean?  This is the cert it is signed with.  Do you have some way
 to force the cert?

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


<    1   2   3   4   5   6   7   8   9   >