[android-developers] Re: how to list files on SD card

2010-09-15 Thread cindy
ANy example to use the api? I am confused.

On Sep 15, 11:26 pm, Vinay S  wrote:
> Pl. look athttp://developer.android.com/reference/java/io/FilenameFilter.html
>
> On Sep 16, 8:40 am, cindy  wrote:
>
> > Hi all,
>
> >  My application needs to do some clean up. I need to list the files
> > such as  " ls voice*.amr", and then delete those files. How could I do
> > it in Android?
>
> > Thanks !
>
> > Cindy

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

2010-09-15 Thread Michael MacDonald
On 09/16/10 00:48, Jiang wrote:
> Hello, guyes.
>
> I need to get android version programmtically & dynamically when my
> application is running on device.
>
> I tried android.os.Build.Version, but it doesn't exist in Android sdk 1.6.
>
> How to get android version?
>
> Thanks.
> Jiang
>
>  
android.os.Build.VERSION.SDK

is deprecated now but it is the SDK number as a string, and it has been
available since 1.0

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

[android-developers] Re: HttpURLConnection or HttpClient

2010-09-15 Thread Indicator Veritatis
When you say 'speed', do you mean development time or runtime? If the
former, Apache's wins. If the latter, the speed is going to depend
much more heavily on what you the programmer write (regardless of
which package you choose) and on network conditions at the time you
run.

That said, lots of programmers have found that Apache's package is
easier to use for high performance code. That is why Manning Press's
"Unlocking Android" says, after briefly discussing the Java package,
"Fortunately, Android provides another set of APIs in the form of the
Apache HttpClient library that abstract the java.net classes further
and that are designed to offer more robust HTTP support and help
handle the separate-thread issue."

The authors then show how it helps with concrete examples, which you
can download from their website even without purchasing the book: it
is ch.6 you want. See http://code.google.com/p/unlocking-android/ for
more details. In particular, see how he uses ApacheHTTPViaHelper with
the "Swiss-army knife" of thread management, Android's Handler and
Looper. But see also HTTPRequestHelper and ResponseHandler.

As an exercise, think of how you would re-write this example using
AsyncTask instead of Looper and Handler;)

Now OTOH, if you tried writing all that with the java.net package's
classes, you would have to take on a lot more of the thread management
yourself, because the APIs are all synchronous; it CAN be done, it is
just more tedious and error-prone.

On Sep 15, 8:34 pm, cindy  wrote:
> How about speed? which one is fast?
>
> On Sep 15, 5:59 pm, Indicator Veritatis  wrote:> Yes, we 
> know why. Because Apache's HttpClient (and other closely
> > assoc. classes in the org.apache.http package) is a much better API
> > than Sun's own HttpUrlConnection (and the rest of java.net's Http
> > support). You can do far more work with less code, and it reads much
> > better too.
>
> > So, for example, HttpClient has helper classes that help you deal with
> > spinning off a worker thread and doing all the waiting on HTTP there;
> > it is designed to work well asynchronously. Sun's HttpUrlConnection
> > has nothing of the sort.
>
> > That said, you don't get to depart from using java.net entirely. You
> > should still use it for dealing with URIs and URLs. But not for much
> > more.
>
> > On Sep 15, 2:41 pm, cindy  wrote:
>
> > > Hi,
>
> > > I was told it was prefer to use Apache's library HttpClient, instead
> > > of java's Http URLConnection. Does any one know why?
>
> > > Thanks!
>
> > > Cindy
>
>

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

2010-09-15 Thread String
You're missing the inner (single) quotes around the temp string. Also,
your variable names aren't consistent, but I'm assuming that's just in
your post here - the compiler would have caught that for you. In any
case, your code should be:

  String temp = "temp";
  db.execSQL("INSERT INTO " + TABLE_NAME + " VALUES (0 'A',
'Hello', '', '" + temp + "', '');");

On Sep 16, 6:37 am, Mystique  wrote:
> Hi,
>
> I want to insert a String value call temp but I don't seems to get it
> working for the INSERT INTO statement.
> Anything wrong with the code?
>
> This is the initialization to create table and insert some default
> values into the table if the database doesn't exist.
>
> Many Thanks.
>
> ---code---
>   @Override
>    public void onCreate(SQLiteDatabase db) {
>       db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + _ID
>             + " INTEGER PRIMARY KEY AUTOINCREMENT, " + FIELD1 + "
> VARCHAR(1), " + FIELD2
>             + " TEXT, " + FIELD3 + " TEXT, " + FIELD4 + " TEXT, " +
> FIELD5 + " TEXT);");
>
>       String tmp = "temp";
>       db.execSQL("INSERT INTO " + TABLE_NAME + " VALUES (0 'A',
> 'Hello', '', " + temp + ", '');");
>    }
> ---code---

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

2010-09-15 Thread Vinay S
Pl. look at http://developer.android.com/reference/java/io/FilenameFilter.html

On Sep 16, 8:40 am, cindy  wrote:
> Hi all,
>
>  My application needs to do some clean up. I need to list the files
> such as  " ls voice*.amr", and then delete those files. How could I do
> it in Android?
>
> Thanks !
>
> Cindy

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


[android-developers] Re: system_server debugging using eclipse.

2010-09-15 Thread FrankG
As non native speaker this means that this is the wrong group for such
a question :-)


On 15 Sep., 09:07, Dianne Hackborn  wrote:
> You wouldn't use the NDK or SDK for this.
>
> On Tue, Sep 14, 2010 at 10:43 PM, kiran  wrote:
> > Hi
> > how can  i  debug the android telephony and radio service part  of android
> > (system_server) using eclipse debugging tool.
> > Regards
> > Kiran
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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


[android-developers] Re: Uploading file through HTTP Post

2010-09-15 Thread Vinay S
Hi,

See this page..

http://rapidandroid.org/wiki/HttpUpload

-vinay

On Sep 16, 8:55 am, perumal316  wrote:
> Hi All,
>
> I am writing an application to upload a file from Android phone to a
> web server.
>
> I have tried the example from:
>
> http://www.anddev.org/novice-tutorials-f8/doing-http-post-with-androi...
>
> But it will only work for SDK 1.0 (why? Not Sure?).
>
> Can this be done for Android 2.1? Or is there any other method to load
> a file from Android to a webserver?
>
> Thanks In Advance,
> Perumal

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


[android-developers] Re: How to get android version programmtically

2010-09-15 Thread cool.manish
I also want to add some more query in this.

1. Where and how can I add version info of my application? So that I
can check for the upgraded version and can upgrade my application.

 2. And if there is upgraded version of the application is available
in the Android Market then will I get any notification on my mobile or
I have to check in manually.

Thanks,
Mansih

On Sep 16, 9:48 am, Jiang  wrote:
> Hello, guyes.
>
> I need to get android version programmtically & dynamically when my 
> application is running on device.
>
> I tried android.os.Build.Version, but it doesn't exist in Android sdk 1.6.
>
> How to get android version?
>
> Thanks.
> Jiang

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


[android-developers] Re: Edittext Cursor and Highlight Problem

2010-09-15 Thread SurtaX
Ahh I see what you meant, but no I am trying to do something
different. I want the cursor to be none existent.

I'm trying to display (read-only) a page of text in which they are
free to select and copy text from thus that is why I don't want the
cursor to be visible at all.

On Sep 14, 10:51 pm, TreKing  wrote:
> On Mon, Sep 13, 2010 at 9:44 PM, SurtaX  wrote:
> > Could you tell me what modifications have you made to it?
>
> None. I see the same behavior when using the built-in messaging app.
>
> > Because by default the cursor is definitely there to allow people to know
> > where they are editing. By cursor I am referring to the " | " which blinks/
> > flashes.
>
> Yes, it's there when you first opt to select text and have not highlighted
> anything. Once you start selecting text, it goes away. Is this the problem?
>
> --- 
> --
> 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: Find the location in Android Map

2010-09-15 Thread Per
Hi there,

I see at least two issues:
1: your button click listener takes lat/long from the EditText's, then
effectively starts the Maps app (Intent url is geo:lat,long).
2: The GeoPoint constructor takes coordinates that are scaled by
100, i.e. 45.7 N would be 4570. (see e.g.
http://developer.android.com/resources/tutorials/views/hello-mapview.html)

BR
Per



On 15 Sep., 19:59, Dhrumil Shah  wrote:
> Hey TreKing,
>
> If you dont mind, just refer this code.
> You exactly got what is going on here. I am new in Android so I dont know
> what is stack trace and log? How to check stack trace?
>
> So here is my code.
>
> public class ShowLocation extends MapActivity {
> private EditText lat;
> private EditText lng;
>  GeoPoint gp=null;
>  MapController  mapcontroller;
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>
>         Button btn = (Button)findViewById(R.id.btnShow);
>         lat = (EditText)findViewById(R.id.lat);
>         lng = (EditText)findViewById(R.id.lng);
>
>         MapView mapView = (MapView)findViewById(R.id.myGMap);
>
>         mapcontroller = mapView.getController();
>
>         //gp = new GeoPoint(lat.intValue(), lng.intValue());
>         mapView.setSatellite(true);
>         mapView.setTraffic(true);
>         mapView.setStreetView(true);
>         mapView.displayZoomControls(true);
>         mapView.setBuiltInZoomControls(true);
>
>         //mapcontroller.animateTo(gp);
>         mapcontroller.setZoom(2);
>         LocationManager locationManager;
>         String context = Context.LOCATION_SERVICE;
>         locationManager = (LocationManager)getSystemService(context);
>
>         Criteria criteria = new Criteria();
>         criteria.setAccuracy(Criteria.ACCURACY_FINE);
>         criteria.setAltitudeRequired(true);
>         criteria.setBearingRequired(false);
>         criteria.setCostAllowed(true);
>         criteria.setPowerRequirement(Criteria.POWER_HIGH);
>         String provider = locationManager.getBestProvider(criteria, true);
>
>      Location location = locationManager.getLastKnownLocation(provider);
>
>         btn.setOnClickListener(new View.OnClickListener() {
> �...@override
> public void onClick(View v) {
> // TODO Auto-generated method stub
> String _lat = lat.getText().toString();
> String _lng = lng.getText().toString();
> Uri uri = Uri.parse("geo:"+_lat+","+_lng);
>  startActivity(new Intent(Intent.ACTION_VIEW, uri));
> //mapcontroller.animateTo(gp);
> mapcontroller.setZoom(2);}
> });
>
>         String _lat,_lng;
>         MapOverlay mylocationoverlay = new MapOverlay();
>         List list = mapView.getOverlays();
>         list.add(mylocationoverlay);
>     }
>  protected class MapOverlay extends com.google.android.maps.Overlay{
>  public boolean draw(Canvas canvas, MapView myGMap, boolean shadow, long
> when){
> Paint paint = new Paint();
> //mapcontroller.animateTo(gp);
> super.draw(canvas, myGMap, shadow);
>  Point myScreenCoords = new Point();
> //mapview.getProjection().toPixels(gp, myScreenCoords);
> //paint.setARGB(255, 255, 255, 255);
> Drawable marker = getResources().getDrawable(R.drawable.marker);
> Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
> R.drawable.marker);
> canvas.drawBitmap(bitmap, myScreenCoords.x, myScreenCoords.y, paint);
> canvas.drawText("Location is at here..", myScreenCoords.x, myScreenCoords.y,
> paint);
> return true;}
> }
>
> �...@override
> protected boolean isRouteDisplayed() {
> // TODO Auto-generated method stub
> return false;
>
> }
> }
>
> ~Dhr
>
>
>
> On Wed, Sep 15, 2010 at 11:17 PM, TreKing  wrote:
> > On Wed, Sep 15, 2010 at 12:42 PM, Dhrumil Shah 
> > wrote:
>
> >> You can change this at any time.
> >> - Ya, i know that thing, but its not working in my this application.
>
> > "It's not working" is not useful information.
>
> >> Or you can animate or snap to the exact location.
> >> - I used this method but it generates and force close error on my
> >> emulator.
>
> > Did you check the stack trace?
>
> >> Why not?
> >> -I dont know why not. I try to debug it but it gives me nothing.
>
> > Nothing? No logs, no stack trace?
>
> > --- 
> > --
> > 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 > cr...@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 

[android-developers] How to do this correctly in SQLite?

2010-09-15 Thread Mystique
Hi,

I want to insert a String value call temp but I don't seems to get it
working for the INSERT INTO statement.
Anything wrong with the code?

This is the initialization to create table and insert some default
values into the table if the database doesn't exist.

Many Thanks.

---code---
  @Override
   public void onCreate(SQLiteDatabase db) {
  db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + _ID
+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + FIELD1 + "
VARCHAR(1), " + FIELD2
+ " TEXT, " + FIELD3 + " TEXT, " + FIELD4 + " TEXT, " +
FIELD5 + " TEXT);");

  String tmp = "temp";
  db.execSQL("INSERT INTO " + TABLE_NAME + " VALUES (0 'A',
'Hello', '', " + temp + ", '');");
   }
---code---

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

2010-09-15 Thread Shashidhar
Yes, You can do it. While setting the dropdownviewresource for the adapter
of your spinner, define your own xml layout instead of the android's inbuilt
resource xml. Your xml can simply have a textview with your required layout
parameters.

-Shashidhar

On Thu, Sep 16, 2010 at 9:55 AM, Karteek N  wrote:

> When we select spinner it shows a display of  items which almost the device
> screen size
>
> Can we minimize its width or height, I think this question was already
> posted by some one. But i am unable to find solution
>
> Thanks,
> Karteek
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
I thought you want to to display a mark on a map from the latitude and
longitude a user entered in two text fields. But I don't understand if you
want to display that on a MapActivity in your app or in another app.
- I want to display that  on a MapActivity in my app. Not in another
activity.


One thing that may help is if you try to display a mark on a map foir a
given latitude and longitude instead of from a user's input. Have you been
able to do that successfully?
- Yes, I tried with that also. Firstly, I entered hardcore values in the app
of latitude and longitude. Its working.
But everytime we have to change it for different locations. Thats why I put
EditText and button so user can enter its own latitude and longitude.

~Dhr.

On Thu, Sep 16, 2010 at 9:27 AM, Frank Weiss  wrote:

> I want to help you, but I don't clearly understand what you want to do.
>
> I thought you want to to display a mark on a map from the latitude and
> longitude a user entered in two text fields. But I don't understand if you
> want to display that on a MapActivity in your app or in another app.
>
> One thing that may help is if you try to display a mark on a map foir a
> given latitude and longitude instead of from a user's input. Have you been
> able to do that successfully?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] How to get android version programmtically

2010-09-15 Thread Jiang
Hello, guyes.

I need to get android version programmtically & dynamically when my application 
is running on device. 

I tried android.os.Build.Version, but it doesn't exist in Android sdk 1.6.

How to get android version?

Thanks.
Jiang



  

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

[android-developers] Can we customize spinner dialog

2010-09-15 Thread Karteek N
When we select spinner it shows a display of  items which almost the device
screen size

Can we minimize its width or height, I think this question was already
posted by some one. But i am unable to find solution

Thanks,
Karteek

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

[android-developers] Re: Any way to animate a 2D Game Smooth without OpenGL ?

2010-09-15 Thread Jason
OK.. so the important point in the "two-threads" theory is that the
work IS done concurrently.

The GameThread does all the calcs for the next frame WHILE the render
thread is rendering the previous frame.  So that you don't modify game
objects while the render thread is rendering, you separate the concept
of a "game" object from a "render" object.  So you basically have two
objects representing things in your game world.  One is responsible to
maintaining the state of the relevant game element, the other is JUST
responsible for drawing.  So in your case you would split your current
object (that has the update and draw methods) into two objects.

The GameThread updates the state-based object (the one with the update
method) and the render thread just draws the render object.

When the GameThread has updated all objects for the next frame, it
waits until the previous frame has completed, then locks the render
thread while it updates all the renderable objects.  So basically you
loop through all the game objects and set the x,y coordinates etc of
the corresponding render object.

This means you are only pausing the render thread for as long as it
takes to loop through the objects and essentially just copy a few
floats across.  This should be super quick.

In terms of storage.. that is, how do you maintain a "List" of objects
(in both the render thread and game thread), again I took a lot from
the Replica Island example.  Chris Pruett has a thing called a
"FixedSizeArray" which he uses to avoid memory allocations at run
time.  I didn't end up using this and wrote my own, but basically the
idea is that you allocate an array up front, and never change it's
size.  I just have a global variable which tells me the MAX_SPRITES I
will ever have (currently at 300 I think).. so at game launch I create
an array of size 300.  My implementation is wrapped in a bunch of
logic so that I can use it like a list (ie add/remove/delete etc) but
actually all it's doing is setting indexes in the fixed size array (or
setting them to null to remove).  I then have the concept of an
iterator which knows how to loop over the array (avoiding nulls etc),
and can be created in a ThreadLocal to allow concurrent access from
multiple threads.

Skype chat is ok.. but what timezone are you in?  I'm GMT+10
(Australian Eastern Standard Time).





On Sep 16, 6:53 am, Andreas  wrote:
> Hey Jason,
>
> thank you "so much" for the Feedback. I would love to  see your game
> skeleton, to see how you solve some common problems. Or how you store
> and iterate your gameObjects.
>
> In My case every GameObject, like a Missle or Enemy has update(long
> difftime) and draw(Canvas c) method implemented. In the game thread
> the thread iterates over all objects and updates them (via update) and
> after that the Thread iterates over all Gameobjects an calls the draw
> method.
>
> Basically i don't see the big advantage to separate those to Methods
> in 2 Threads- because at the end draw() is called after update() -
> (while true)-  if you have 2 threads you kind of loop over 2 threads.
> because 1 is started, finished, stops, starts thread 2, finishes,
> starts thread 1
>
> I you can spare some time i would be "very" thankful to maybe have a
> Skype or TeamSpeak Chat  with you =)
>
> On 15 Sep., 15:34, Jason  wrote:
>
>
>
> > Hi Andreas,
>
> > Sorry to jump in late, but I thought I'd share my experiences with non-
> > opengl on Android.
>
> > I have a game "engine" which uses both open gl and the canvas system
> > depending on the device capabilities (some devices, like HTC Tattoo
> > have software implementations of opengl which is actually slower than
> > canvas).  I get reasonable performance from the canvas api, but the
> > important thing is that the bottle-neck has always been draw speed and
> > nothing else.
>
> > I pretty much followed the replica island approach whereby I have two
> > threads, one which just draws and the other where all the game calcs
> > are done.  My game thread routinely outperforms my render thread, but
> > I am drawing quite a lot so this may not be everyone's experience.
>
> > I'd say you do have a slight architectural flaw in that (it appears)
> > that your game logic is being computed in the same thread as the
> > rendering.  This means that the render thread has to wait each frame
> > for the game to update state.  It's much better to separate these
> > two.  Have your game logic updated in a separate thread, then just
> > notify the render thread when it's time to draw (you can do this by
> > sending a message to your surface view using a Handler and then
> > invalidating the canvas).
>
> > Basically what I do is this:
>
> > I have a separation of game objects, and "renderable" objects.  A game
> > object is the real representation of the in-game element (eg the
> > player).  The renderable object is simple a set of x,y coords, plus
> > scale, rotation etc and a reference to the image that represents the
> > sprite (I h

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Frank Weiss
I want to help you, but I don't clearly understand what you want to do.

I thought you want to to display a mark on a map from the latitude and
longitude a user entered in two text fields. But I don't understand if you
want to display that on a MapActivity in your app or in another app.

One thing that may help is if you try to display a mark on a map foir a
given latitude and longitude instead of from a user's input. Have you been
able to do that successfully?

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

[android-developers] Uploading file through HTTP Post

2010-09-15 Thread perumal316
Hi All,

I am writing an application to upload a file from Android phone to a
web server.

I have tried the example from:

http://www.anddev.org/novice-tutorials-f8/doing-http-post-with-android-t492.html

But it will only work for SDK 1.0 (why? Not Sure?).

Can this be done for Android 2.1? Or is there any other method to load
a file from Android to a webserver?

Thanks In Advance,
Perumal

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

2010-09-15 Thread Dhrumil Shah
Hey Frank,

Then you told me what do I do??

~Dhr

On Thu, Sep 16, 2010 at 12:43 AM, Frank Weiss  wrote:

> I see a couple of issues with your code.
>
> 1) The location variable set in the following line does not appear to be
> used anywher:
>
> Location location = locationManager.getLastKnownLocation(provider);
>
> 2) Are you trying to send an intent to the Maps or Browser app, of handle
> the location display yourself? In one place the code has:
>
> startActivity(new Intent(Intent.ACTION_VIEW, uri));
>
> yet in another line, the code goes:
>
> canvas.drawBitmap(bitmap, myScreenCoords.x, myScreenCoords.y, paint);
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] how to list files on SD card

2010-09-15 Thread cindy
Hi all,

 My application needs to do some clean up. I need to list the files
such as  " ls voice*.amr", and then delete those files. How could I do
it in Android?

Thanks !

Cindy

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


[android-developers] Re: HttpURLConnection or HttpClient

2010-09-15 Thread cindy
How about speed? which one is fast?

On Sep 15, 5:59 pm, Indicator Veritatis  wrote:
> Yes, we know why. Because Apache's HttpClient (and other closely
> assoc. classes in the org.apache.http package) is a much better API
> than Sun's own HttpUrlConnection (and the rest of java.net's Http
> support). You can do far more work with less code, and it reads much
> better too.
>
> So, for example, HttpClient has helper classes that help you deal with
> spinning off a worker thread and doing all the waiting on HTTP there;
> it is designed to work well asynchronously. Sun's HttpUrlConnection
> has nothing of the sort.
>
> That said, you don't get to depart from using java.net entirely. You
> should still use it for dealing with URIs and URLs. But not for much
> more.
>
> On Sep 15, 2:41 pm, cindy  wrote:
>
> > Hi,
>
> > I was told it was prefer to use Apache's library HttpClient, instead
> > of java's Http URLConnection. Does any one know why?
>
> > Thanks!
>
> > Cindy

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


[android-developers] how do I load an image for a softkeyboard

2010-09-15 Thread Saied
Hi,

I am trying to develop a softkeyboard, which uses and image, senses
the onTouch events, and sends characters to the input stream.

So I have created the essentials of the keyboard and I want to load an
image. Here's what I do:


public class mekb extends InputMethodService   implements
View.OnTouchListener {

  @Override public void onCreate() {
super.onCreate();
}

   @Override public View onCreateInputView() {
return (KeyboardView)
getLayoutInflater().inflate(R.layout.main, null);
}
}

And this is what I have in my layout/main.xml (essentially an image
view on the bottom of the screen)


http://schemas.android.com/apk/res/android";
>




This loads and let me select the softkeyboard, but errors and stops
when I invoke the keyboard.

Is this how to load an image and return it in onCreateInputView()?

 @Override public View onCreateInputView() {
return (KeyboardView)
getLayoutInflater().inflate(R.layout.main, null);
}


Any help, hint or pointer is much 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


[android-developers] Re: Choosing background for Live Wallpaper.

2010-09-15 Thread Joel Duggan
Here's an update on where I am with this.  I have to say it's pretty
"hackish" and I'm not proud of it but it works, sorta.

I created a Preference in my Settings dialog to choose the background.  From
the callback I call 'startActivityForResult' with
the Intent.ACTION_SET_WALLPAPER.

This launches the default wallpaper chooser allowing the user to select
whatever they want for the wallpaper, with the caveat that the "Live
Wallpapers" shows up also, which I don't want.

In the 'onActivityResult' callback i check for RESUT_OK and do the
following:
- Get an instance of the wallpaper manager.
- Get the drawable from it.
- Turn it into a BitmapDrawable and write it to a private file (for
persistence) also storing it in a variable.
- During my regular draw function I draw that to the canvas and then draw my
overlay.

On startup of my wallpaper I check if the file exists.  If it does then I
read it into my bitmap variable and continue as normal.
If it doesn't exist then I get the wallpaper drawable and do the same things
as above (file, variable).

This works wonderfully for most situations.  But it breaks horribly when the
user selects a live wallpaper in my settings dialog.

In the Emulator things keep working.  My 'onActivityResult' gets a
RESULT_CANCEL event and nothing changes for me.  I'm able to back out of the
settings screen and continue no problem.

On my device however (HTC Desire w/ 2.1) it crashes the phone when I select
a live wallpaper from within my settings.

Why the discrepancy between the two?  The only difference that I can tell
between the two is that my device has more live wallpapers installed.

What can I do?

Can I detect that a live wallpaper was selected and handle it differently?
I didn't debug the app on my phone so I don't know exactly what was
happening.

My exact call to start the activity looks like this:

private void startWallpaper() {
   final Intent pickWallpaper = new Intent(Intent.ACTION_SET_WALLPAPER);
   startActivityForResult(Intent.createChooser(pickWallpaper,
getString(R.string.rain_background)),REQUEST_PICK_BACKGROUND);
}

The Live wallpaper chooser has two intents; ACTION_SET_WALLPAPER
and ACTION_LIVE_WALLPAPER_CHOOSER.  Is there a way, when I call
Intent.createChooser to filter out based on an intent even though an item
matches another intent?

If not then Google seriously needs to give us this.

Not sure what to do next.

I'm so close I can feel it.

Joel


On Thu, Sep 9, 2010 at 2:11 PM, JoelDuggan  wrote:

> Hello all,
>
> I've asked this question twice already but it didn't seem to get
> posted.  I don't know if it just takes a while for the moderators to
> approve or if it got lost so I'll try again.
>
> I'm writing a live wallpaper that creates an effect over a
> background.  I want the user to be able to choose the background from
> any of the system wallpapers and camera photos.  What I would like is
> for the user to be able to press a button in the Settings menu, have
> the list of options show up just like setting the wallpaper from the
> home screen, minus the Live Wallpapers options.  Once the user
> navigates the choices and picks an actually image I would load it to
> my canvas.
>
> How do I do this?
>
> I can't find an API anywhere for getting a list of wallpapers.
>
> I've been able to come up with a list of wallpaper providers using
> Intents.  I then get a list of live wallpaper providers also using
> Intents and remove those from my first list.  The gives me a list of
> wallpaper providers that are not live.
>
> Now what?  Are there other ways to do this that I'm missing?
>
> Please help.

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

[android-developers] Re: notification..!

2010-09-15 Thread Indicator Veritatis
As close as possible to a Windows Registry, and not very close, is it?
All it has in common with the Windows Registry is that it is a
searchable, editable list of properties, i.e., name-value pairs. No
system-wide standard for naming keys, no hierarchical organization, no
predefined root keys...

Really, in order to answer the OP's real question, we need to know
what he is trying to do, that he thinks he needs a Windows-style
Registry to do it.

On Sep 15, 9:26 am, Kostya Vasilyev  wrote:
>   This:
>
> http://developer.android.com/guide/topics/data/data-storage.html#pref
>
> is as close as you can get to Windows Registry. Persistent storage for
> small amounts of data, accessed by string keys.
>
> -- Kostya
>
> 15.09.2010 20:07, Pent пишет:
>
> >>> I want to store information in the registry
> >> What registry?
> > I think he wants to get married ?
>
> > Pent
>
> > p.s. Rubin, there is no central registry in Android
>
> --
> 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: Loading raw resource text file hang...

2010-09-15 Thread Mystique
Right, it was suppose to be:

while ((strLine = dataIO.readLine()) != null) {
sBuffer.append(strLine + "\n");

I don't know why it was change. Thanks you guys.

On Sep 16, 3:18 am, DanH  wrote:
> And, of course, DataInputStream.readLine is deprecated.
>
> On Sep 15, 1:53 pm, Mystique  wrote:
>
>
>
> > Hi, I use this method couples of occasion to load text file to display
> > as help file.
> > But I don't know why the following code didn't work. It seems to hang
> > and logcat says "OutOfMemoryError"?
>
> > All I did was break this out as an separate activity...
> > Can anyone help me to catch the problem?
>
> > ---xml---
> > 
> > http://schemas.android.com/apk/res/android";
> >         android:id="@+id/helptab"
> >     android:orientation="vertical"
> >     android:layout_width="fill_parent"
> >     android:layout_height="fill_parent">
> >  >         android:id="@+id/helptext"
> >     android:layout_width="fill_parent"
> >     android:layout_height="wrap_content" />
> > 
>
> > ---code---
> > import java.io.DataInputStream;
> > import java.io.IOException;
> > import java.io.InputStream;
>
> > import android.app.Activity;
> > import android.os.Bundle;
> > import android.widget.TextView;
>
> > public class Help extends Activity {
> >     /** Called when the activity is first created. */
> >     @Override
>
> >     protected void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
> >         setContentView(R.layout.help);
>
> >         InputStream iFile =
> > getResources().openRawResource(R.raw.help);
> >         try {
> >             TextView helpText = (TextView)
> > findViewById(R.id.helptext);
> >             String strFile = inputStreamToString(iFile);
> >             helpText.setText(strFile);
> >         } catch (Exception e) {
> >         }
> >     }
>
> >     public String inputStreamToString(InputStream is) throws
> > IOException {
> >         StringBuffer sBuffer = new StringBuffer();
> >         DataInputStream dataIO = new DataInputStream(is);
> >         String strLine = "";
> >         while ((strLine = dataIO.readLine()) != "") {
> >             sBuffer.append(strLine + "\n");
> >         }
> >         dataIO.close();
> >         is.close();
> >         return sBuffer.toString();
> >     }
>
> > }

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


[android-developers] Re: ADT master version

2010-09-15 Thread Indicator Veritatis
On Sep 15, 11:28 am, Xavier Ducrohet  wrote:
> On Wed, Sep 15, 2010 at 3:43 AM, Indicator Veritatis  
> wrote:
> > Do I really have to explain something so elementary? "8" is not the
> > same as "8.0.0" is not the same as "8(.0.0)". So yes, you did make it
> > more confusing instead of less.
>
> You are seriously confused indeed.

Thanks to your own careless wording, yes. But that was and still is my
point. You are making it more confusing, not less, even now, though
this latest post of yours is a considerable improvement.

> Tools r8 will ship with ADT 8.0.0. The version that comes after will
> be Tools r9 with ADT 9.0.0, and then r10 and ADT 10.0.0, etc...
> Since both are meant to work together, it seems to me like it's a
> pretty straight forward versioning scheme.

Your wording this time does make it more clear, yes. But what remains
not at all "straight forward" is what you think to achieve by
numbering the Tools in an "r" format, where n is an integer, but
numbering the things -in- the Tools with "n.0.0". What will you ever
use the other two digits for, if new versions are only released with
an entire new Tools release, which is always numbered with an integer?
Or have you simply forgotten to use the terms "minor revision number"
and "major revision number"? Did you really mean to say the the -
major- revision number of each tool will match the revision number of
the entire Tools package?

> When we release r8 we will
> clearly explain this new scheme so that users know what to expect.

That will be a welcome improvement, I am sure.


> I fail to see how it's more confusing that previous releases of r7
> with ADT 0.9.8, r6 with ADT 0.9.7, etc... where the ADT version was
> completely unrelated to the SDK tools revision number.

It is more confusing because in the earlier scheme, we knew it was
unrelated. But with the incomplete and poorly worded explanations you
gave to date of the new scheme, it was clear that there was a
relationship, but with the apparently superfluous extra digits, it was
not clear whether that relation was really meant to be identity,
forever kept in lockstep.

> > For that matter, are they sharing the same version number, or the same
> > API level? The version number is 2.2, the API level 8. Based on what
> > you have said so far, it sounds like you are using the API level as
> > the version number for the tools, which is not the same as making "all
> > tools and plug-ins share the same version number".

> What are you talking about? Tools don't have an API level, so there's
> certainly none to share between the SDK Tools and ADT, and, obviously,
> the API level for the platform has *nothing* to do with revision
> number for the tools!

No, it is not obvious that it has -nothing- to do with it. Especially
not when both happen to be '8'. That could be coincidence (as you now
confirm that it is), but without the further information you now
supply, we had no way of -knowing' that. For all we knew, you could
have decided that in the future, you would release new versions of the
Tools only with new version of the API also. That is hardly more
arbitrary than deciding that you will release new versions of any tool
only with a new version of the whole Tools package.

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

2010-09-15 Thread lloyd
That is also a part of my problem. I am running in debug mode. I can see the
disconnect message in the debug window occur the instant I take the picture.
However Activity 3 ( the one that fired the ACTIVITY_IMAGE_CAPTURE gets the
result and finishes up nicely. When that task terminates, I get the dreaded
FC on the device. It should be noted that after the Disconnect message
appears, even though I have several breakpoints set in Task 3 including at
the very beginning of the onActivityResult(), none of them is taken,
presumably because the debugger has been disconnected?

 

BTW I can tell that Task 3 is finishing properly even though the breakpoints
are not being taken. You see one of the last things that Task 3 does in it's
onPause() is to save the path to the new picture in the database. When I
restart after the FC, the proper image is always present. It is as if
something goes haywire and even causes the debugger to get disconnected. I
guess that is what the "Disconnect from local host means"

 

Again I point out that I can do iterations all day as long as I do not use
the camera feature. However the instant that I use the Camera feature the
App runs into trouble as soon as the Shutter is clicked on the phone.

 

THANKS MUCH FOR RESPONDING. 

 

  _  

From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of Frank Weiss
Sent: Wednesday, September 15, 2010 7:26 PM
To: android-developers@googlegroups.com
Subject: Re: [android-developers] ACTION_IMAGE_CAPTURE intent

 

I'll compare this with similar code I have running, but meanwhile, could you
run in debug and give the stack trace or at least identify the exception.
That should also give you the line number in your code.

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

2010-09-15 Thread Chris Stratton
An apk is a zip file (try opening it as one) so the .so is stored
inside it compressed.

The savings from removing the apk would count both the compressed apk
and any parts of it that get uncompressed during installation, such as
shared libraries and the dexopted version of the class file.

pgil wrote:
> I would like to know why the size of my shared library .so is bigger
> than my .apk file generated with Eclipse? Approximatly the so size is
> twice the apk one. What is strange is after having installed it in the
> device (2.1 firmware) I checked the size of the apk when I uninstalled
> it from the device and surprisingly the apk size indicated is bigger
> even than the .so one. Is there any explaination of that?

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


[android-developers] Droid Losing Values When I Load Image Picker

2010-09-15 Thread GregAZ
I have an Android app that is mostly a WebView except for a few
things.  One of them is uploading pictures.

After the user picks an image I get the filepath and pass that along
with the webview's url to a new method in a new thread.

For some reason, in the onActivityResult method I can't get the value
from the webview to know what page they're on.  It's null.  It works
on my HTC Hero (2.1), just not on Droid's.(those are the only users
with the problem).

I've tried setting a global variable to the url before showing the
image picker, but when I try to read it in the onActivityResult method
it's just an empty string.  On my HTC Hero it still has the value.

I need the url so where can I put it where it won't get lost on Droid
phones?  This is all in an Activity.

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

2010-09-15 Thread joebowbeer
Have you tried adding "alwaysRetainTaskState" to your Activity
declaration?

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

"When this attribute is 'true', users will always return to the task
in its last state, regardless of how they get there."

On Sep 14, 11:40 pm, viktor  wrote:
> Hi,
>
> I have next problem, I have got parent activity and few sub-
> activities, if app goes to the background by pressed HOME button for
> long time, all children will be killed, and my app restart from parent
> activity.
>
> For example: A1 - parent, A2,A3,A4 - sub-activities. A1-->A2-->A3(top), from 
> A3 I go to the background (HOME). wait 30-40 min and
>
> restart app.
>
> Only A1 displayed.
>
> Could you please explain how to resolve my problem?
>
> Thanks

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


[android-developers] Re: HttpURLConnection or HttpClient

2010-09-15 Thread Indicator Veritatis
Yes, we know why. Because Apache's HttpClient (and other closely
assoc. classes in the org.apache.http package) is a much better API
than Sun's own HttpUrlConnection (and the rest of java.net's Http
support). You can do far more work with less code, and it reads much
better too.

So, for example, HttpClient has helper classes that help you deal with
spinning off a worker thread and doing all the waiting on HTTP there;
it is designed to work well asynchronously. Sun's HttpUrlConnection
has nothing of the sort.

That said, you don't get to depart from using java.net entirely. You
should still use it for dealing with URIs and URLs. But not for much
more.

On Sep 15, 2:41 pm, cindy  wrote:
> Hi,
>
> I was told it was prefer to use Apache's library HttpClient, instead
> of java's Http URLConnection. Does any one know why?
>
> Thanks!
>
> Cindy

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


[android-developers] Re: ANR keyDispatchingTimedOut

2010-09-15 Thread Dan Barnett
I found a fair amount of reading about this in the following links:

http://android-developers.blogspot.com/2009/05/painless-threading.html

http://stackoverflow.com/questions/704311/android-how-do-i-investigate-an-anr

http://developer.android.com/guide/appendix/faq/commontasks.html#threading

Thanks,

Dan Barnett
Xoise Solutions, Inc.
(516) 469-9430
www.xoise.com



On Wed, Sep 15, 2010 at 8:32 PM, Dan  wrote:

> Hi all,
>
> I've got an application with an alarming number of users reporting
> force closes. I've tested multiple devices numerous times and never
> had this happen, so it's very difficult to test. Luckily, the new
> stack trace reporting features seem to give me an idea, but I am not
> familiar with "ANR keyDispatchingTimedOut" and Google doesn't seem to
> be much help. I can debug when I see the error just fine, but I'm not
> sure what information these stack traces are providing me. Is it just
> saying where each thread "was" when the crash occurred?
>
> Any help would be greatly appreciated - not just by me, but by a lot
> of my users!
>
> Dan
>
>
> Example Trace:
>
> ---
>
> DALVIK THREADS:
> "main" prio=5 tid=1 NATIVE
>  | group="main" sCount=1 dsCount=0 s=N obj=0x4001d8c0 self=0xccc8
>  | sysTid=27792 nice=0 sched=0/0 cgrp=default handle=-1345017816
>  | schedstat=( 184875489 298065182 95 )
>  at java.net.InetAddress.getaddrinfo(Native Method)
>  at java.net.InetAddress.lookupHostByName(InetAddress.java:508)
>  at java.net.InetAddress.getAllByNameImpl(InetAddress.java:280)
>  at java.net.InetAddress.getByName(InetAddress.java:310)
>  at java.net.InetSocketAddress.(InetSocketAddress.java:110)
>  at java.net.InetSocketAddress.(InetSocketAddress.java:89)
>  at
>
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.(HttpConnection.java:
> 62)
>  at
>
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:
> 88)
>  at
>
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:
> 927)
>  at
>
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:
> 909)
>  at
>
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:
> 1152)
>  at com.xoise.mancala.Mancala.checkUpdate(Mancala.java:186)
>  at com.xoise.mancala.Mancala.onCreate(Mancala.java:43)
>  at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1047)
>  at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2627)
>  at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> 2679)
>  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
>  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
> 2033)
>  at android.os.Handler.dispatchMessage(Handler.java:99)
>  at android.os.Looper.loop(Looper.java:123)
>  at android.app.ActivityThread.main(ActivityThread.java:4627)
>  at java.lang.reflect.Method.invokeNative(Native Method)
>  at java.lang.reflect.Method.invoke(Method.java:521)
>  at com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:868)
>  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
>  at dalvik.system.NativeStart.main(Native Method)
>
> "SoundPool" prio=5 tid=8 NATIVE
>  | group="main" sCount=1 dsCount=0 s=N obj=0x44779df8 self=0x225b18
>  | sysTid=27798 nice=0 sched=0/0 cgrp=default handle=1193848
>  | schedstat=( 366211 18005371 4 )
>  at dalvik.system.NativeStart.run(Native Method)
>
> "SoundPoolThread" prio=5 tid=7 NATIVE
>  | group="main" sCount=1 dsCount=0 s=N obj=0x44779720 self=0x225148
>  | sysTid=27799 nice=0 sched=0/0 cgrp=default handle=1194040
>  | schedstat=( 13824466 69000242 13 )
>  at dalvik.system.NativeStart.run(Native Method)
>
> "Binder Thread #2" prio=5 tid=6 NATIVE
>  | group="main" sCount=1 dsCount=0 s=N obj=0x447696c0 self=0x11fd68
>  | sysTid=27797 nice=0 sched=0/0 cgrp=default handle=1297576
>  | schedstat=( 1434329 7904050 6 )
>  at dalvik.system.NativeStart.run(Native Method)
>
> "Binder Thread #1" prio=5 tid=5 NATIVE
>  | group="main" sCount=1 dsCount=0 s=N obj=0x44764488 self=0x124880
>  | sysTid=27796 nice=0 sched=0/0 cgrp=default handle=1198144
>  | schedstat=( 3723144 5554199 5 )
>  at dalvik.system.NativeStart.run(Native Method)
>
> "Compiler" daemon prio=5 tid=4 VMWAIT
>  | group="system" sCount=1 dsCount=0 s=N obj=0x447632a0 self=0x121930
>  | sysTid=27795 nice=0 sched=0/0 cgrp=default handle=1174160
>  | schedstat=( 1220703 9277344 4 )
>  at dalvik.system.NativeStart.run(Native Method)
>
> "Signal Catcher" daemon prio=5 tid=3 RUNNABLE
>  | group=

Re: [android-developers] A hand of cards

2010-09-15 Thread Mark Murphy
Use a RelativeLayout (for the overlapping cards) and a
TranslateAnimation (for the movement of a card).

On Wed, Sep 15, 2010 at 8:33 PM, ClarkBattle  wrote:
> Imagine that you had five overlapped playing cards horizontally fanned
> so that you could see the top card and the right edges of the other
> four.  Now you slide over the top card until its right edge is on the
> left of the screen, revealing the body of the second card with the
> right edges of the remaining three cards on the right.
>
> Any idea how to do this? I dont want to fake it with a plain old view
> flipper and dummy images that pop up on the side.  It has to animate
> and scroll as if it were a real card.   Is there any code that does
> something similar?

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

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


[android-developers] shared library so size versus apk size

2010-09-15 Thread pgil
I would like to know why the size of my shared library .so is bigger
than my .apk file generated with Eclipse? Approximatly the so size is
twice the apk one. What is strange is after having installed it in the
device (2.1 firmware) I checked the size of the apk when I uninstalled
it from the device and surprisingly the apk size indicated is bigger
even than the .so one. Is there any explaination of that?

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


[android-developers] How to switch the mobile network in program?

2010-09-15 Thread M.Allam
Peace upon you ,
I searched more  but didn't get the answer. Currently I have 2 mobile
networks for my mobile say they are A and B.
Is there a way to automatically detect the mobile networks if there
are A and B then choose A? Or just simplely choose A no matter whether
there is B availible? I want to search for gsm networks operators
available and select the preferred one.

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: Upgrade non-market app with a new market version.

2010-09-15 Thread laminina
Hi psyke,

You can perform OTA just following the same requirements Android
Market performs.

VersionCode greater than the one is already installed, signing
certificates need to match.package name needs to match...

Later after all the bureaucratic things are done you can publish the
app in the android market with a greater version code and this will
update the second version that was installed as OTA.

I've tried my self already...just don;t forget to follow the same
requirements from the Android Market.
Remember that the user can disabled the option of "Installed app that
doesn't come from the android market", if this is check OTA cannot be
executed because it doesn't come from the Android market..

good luck
On Sep 15, 9:18 am, psyke  wrote:
> Hello Guys,
>
> I am developping (for my company) an app included on a project that
> will have 2 versions:
>
>      - 1st  simple version to download using a OTA server, clients
> accesss to an URL to download.
>      - 2nd version more complex to be published on the Market.
>
> The question here is that the process to publish on the Android Market
> is under bureaucratic internal process and it takes a long time, so
> the idea do reduce the time to market is to provide an OTA version.
>
> There is any possibility for users that download application via OTA
> to upgrade the application for version published later on the Market?
> (Both Application will be signed with the same key).
>
> Thanks in advance
>
> 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] A hand of cards

2010-09-15 Thread ClarkBattle
Imagine that you had five overlapped playing cards horizontally fanned
so that you could see the top card and the right edges of the other
four.  Now you slide over the top card until its right edge is on the
left of the screen, revealing the body of the second card with the
right edges of the remaining three cards on the right.

Any idea how to do this? I dont want to fake it with a plain old view
flipper and dummy images that pop up on the side.  It has to animate
and scroll as if it were a real card.   Is there any code that does
something similar?

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] ANR keyDispatchingTimedOut

2010-09-15 Thread Dan
Hi all,

I've got an application with an alarming number of users reporting
force closes. I've tested multiple devices numerous times and never
had this happen, so it's very difficult to test. Luckily, the new
stack trace reporting features seem to give me an idea, but I am not
familiar with "ANR keyDispatchingTimedOut" and Google doesn't seem to
be much help. I can debug when I see the error just fine, but I'm not
sure what information these stack traces are providing me. Is it just
saying where each thread "was" when the crash occurred?

Any help would be greatly appreciated - not just by me, but by a lot
of my users!

Dan


Example Trace:
---

DALVIK THREADS:
"main" prio=5 tid=1 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x4001d8c0 self=0xccc8
  | sysTid=27792 nice=0 sched=0/0 cgrp=default handle=-1345017816
  | schedstat=( 184875489 298065182 95 )
  at java.net.InetAddress.getaddrinfo(Native Method)
  at java.net.InetAddress.lookupHostByName(InetAddress.java:508)
  at java.net.InetAddress.getAllByNameImpl(InetAddress.java:280)
  at java.net.InetAddress.getByName(InetAddress.java:310)
  at java.net.InetSocketAddress.(InetSocketAddress.java:110)
  at java.net.InetSocketAddress.(InetSocketAddress.java:89)
  at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.(HttpConnection.java:
62)
  at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:
88)
  at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:
927)
  at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:
909)
  at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:
1152)
  at com.xoise.mancala.Mancala.checkUpdate(Mancala.java:186)
  at com.xoise.mancala.Mancala.onCreate(Mancala.java:43)
  at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
  at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2627)
  at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2679)
  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
2033)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4627)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  at dalvik.system.NativeStart.main(Native Method)

"SoundPool" prio=5 tid=8 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x44779df8 self=0x225b18
  | sysTid=27798 nice=0 sched=0/0 cgrp=default handle=1193848
  | schedstat=( 366211 18005371 4 )
  at dalvik.system.NativeStart.run(Native Method)

"SoundPoolThread" prio=5 tid=7 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x44779720 self=0x225148
  | sysTid=27799 nice=0 sched=0/0 cgrp=default handle=1194040
  | schedstat=( 13824466 69000242 13 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #2" prio=5 tid=6 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x447696c0 self=0x11fd68
  | sysTid=27797 nice=0 sched=0/0 cgrp=default handle=1297576
  | schedstat=( 1434329 7904050 6 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #1" prio=5 tid=5 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x44764488 self=0x124880
  | sysTid=27796 nice=0 sched=0/0 cgrp=default handle=1198144
  | schedstat=( 3723144 5554199 5 )
  at dalvik.system.NativeStart.run(Native Method)

"Compiler" daemon prio=5 tid=4 VMWAIT
  | group="system" sCount=1 dsCount=0 s=N obj=0x447632a0 self=0x121930
  | sysTid=27795 nice=0 sched=0/0 cgrp=default handle=1174160
  | schedstat=( 1220703 9277344 4 )
  at dalvik.system.NativeStart.run(Native Method)

"Signal Catcher" daemon prio=5 tid=3 RUNNABLE
  | group="system" sCount=0 dsCount=0 s=N obj=0x447631e8 self=0x11ede0
  | sysTid=27794 nice=0 sched=0/0 cgrp=default handle=1208144
  | schedstat=( 6805420 6011962 4 )
  at dalvik.system.NativeStart.run(Native Method)

"HeapWorker" daemon prio=5 tid=2 VMWAIT
  | group="system" sCount=1 dsCount=0 s=N obj=0x431a7b90 self=0x11e950
  | sysTid=27793 nice=0 sched=0/0 cgrp=default handle=1203280
  | schedstat=( 16723632 11505128 11 )
  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 gr

[android-developers] Re: HttpURLConnection or HttpClient

2010-09-15 Thread cindy
Thanks for all the reply.

On Sep 15, 3:39 pm, Filip Havlicek  wrote:
> You can do that with URLConnection too of course, although it takes a little
> bit more effort to make it work.
>
> Best regards,
> Filip Havlicek
>
> 2010/9/16 Frank Weiss 
>
> > For simple requests, URLConnection works fine. Use HttpClient if you need
> > to manage basic auth, cookies, headers, etc.
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, 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


Re: [android-developers] Re: OpenGL lockups in 2.2

2010-09-15 Thread Leigh McRae
 I don't use GLSurfaceView and I am not really sure why anyone would 
use it for anything other than a demo.  It makes your code less portable 
and takes control away from you.


With that said, I do get people with HTC complaining about freezes.  So 
it would seem that it's not a GLSurfaceView problem.



On 9/14/2010 8:38 PM, timedilation wrote:

This appears to be an HTC specific bug. My app never freezes on the
Motorla Droid. EVER. It is very stable on the Droid and I have tested
it for about 4months without a single freeze. Interestingly though it
never froze on my G1 either. The G1 I have is the ADP1 phone I bought
directly from Google.

All other HTC phones that I have exhibit the freezing - Evo, Desire
and Nexus One (which is also from HTC I believe).

Apart from that I tested it for a month on Samsung Moment. There was
NO freezing there either.
I have been in touch with a Google developer advocate and I have
submitted the bug report to his team. They are looking into this as
well.



On Sep 14, 8:23 pm, Jeremy Statz  wrote:

That's my experience as well.  All my log results say that there's no
loading or anything necessary -- the frame it dies on is bog standard,
with drawFrame going from beginning to end.  Any loading is long since
done.

I'm currently wondering if this is an HTC driver bug.  I'm going to
let this run on a Motorola Droid all night and see if it crashes.  Not
sure I'm expecting it to, as my fiance has been using my wallpapers on
her Droid since forever and says she's never seen it lock and reboot
like we're describing.  Is there anyone at HTC to take something like
that to, if I gather some evidence?

On Sep 14, 3:32 pm, timedilation  wrote:




That's interesting..
Although I know for sure that all my gl* calls are happening only in
the GL thread. And this freezing happens even when I simply leave the
device (HTC Desire) running my app with zero user interaction
whatsoever. All the app renders is a scenery with a single animation.
No texture changes or geometry changes are taking place in this
scenario. But because of the animation, I have to render continuously
and this is why I have not used the Render_when_dirty approach.
I did notice that when the app freezes, my main UI thread as well as a
secondary thread (that talks to a game server) are still running and
alive. The main UI thread does register touches until a point and then
hangs while the secondary thread stays alive. I tried to send an
interrupt() to the GLThread from this secondary thread but that did
not help. The GLThread remained stuck in eglSwapBuffer();
On Sep 14, 3:42 pm, String  wrote:

On Sep 13, 11:24 pm, Jeremy Statz  wrote:

The big problem here, in my eyes, is that this appears to
affect any OpenGL using application, and is tremendously discouraging,
to the point that people pull things off the market and avoid using
OpenGL.

I've been chasing this in a couple of my own OpenGL apps for a couple
of months as well. It's summed up well in this thread - extremely
intermittent, but extremely serious when it does happen. And I'm one
of the devs who has pulled an app from the Market as a result.
At the moment, I'm provisionally optimistic that I've worked around
the issue in my case. Given it's a race condition, I took the approach
of maximum thread-safety: I put a whole load of semaphores into my
code, added "synchronized" and "volatile" modifiers all over the
place, that sort of thing. And it seems to have been successful... I
can't be sure (because of the intermittency), but I haven't seen it
happen for a couple of weeks now.
If I had to speculate, I'd say that the problem finally went when I
synchronized some code which re-generates geometry within my OpenGL
model. I added semaphores to ensure that textures, geometry, and
rendering never happened concurrently. There's no way to know that was
the end problem, but that SEEMED to be it. If that helps anyone.
Just to reiterate, I agree that this is a serious platform-level bug
that needs to be fixed by Google. And it has gotten worse since 2.2,
although I have (rarely) seen it happen on my G1 running 1.6.
String


--
Leigh McRae
www.lonedwarfgames.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


RE: [android-developers] Re: Scrolling broken in 2.2 ?

2010-09-15 Thread Peter Carpenter
Hi Kumar,

I the short term, it would.  We're not a consumer application so we do have a 
reasonable amount of control over the devices that we ultimately deploy on.  
It's not out of the question for us to say that we don't support 2.2.  But 
obviously it's not in our interests to lock ourselves out of any future android 
releases.

Cheers,

Peter.

-Original Message-
From: android-developers@googlegroups.com 
[mailto:android-develop...@googlegroups.com] On Behalf Of Kumar Bibek
Sent: Wednesday, 15 September 2010 5:19 PM
To: Android Developers
Subject: [android-developers] Re: Scrolling broken in 2.2 ?

Umm, Well, Getting back to 2.1 will not fix your problems. I would
reckon the best approach would be to re-design your UI.

-Kumar Bibek
http://techdroid.kbeanie.com

On Sep 15, 12:05 pm, Peter Carpenter
 wrote:
> Hey Romain,
>
> Thanks for the reply,
>
> I can understand why this is not an ideal ui design - I entirely agree.  But 
> this doesn't change the fact that there seems to be some regression with the 
> Android UI code.  On researching further I've found that there are a number 
> of registered bugs for 2.2 to do with browsers exhibiting similar problems 
> whilst showing pages containing frames.  Looks like something fundamental has 
> changed here.
>
> As far as our use case goes - I need to be able to display whatever a user 
> requires in their screen.  Currently we can show these screens on Windows, 
> iPhone & Blackberry and Android < 2.1 without any issues.  But Android 2.2 
> suddenly has this issue with the nesting.  Whilst we *could* design the app 
> to work around this bug by using a popup editor - this does not help us keep 
> things consistent, and your architecture bug free.
>
> As a workaround - do you know of any way to reset Nexus ones back to 2.1?
>
> Cheers, :)
>
> Peter.
>
> -Original Message-
> From: android-developers@googlegroups.com 
> [mailto:android-develop...@googlegroups.com] On Behalf Of Romain Guy
> Sent: Wednesday, 15 September 2010 4:42 PM
> To: android-developers@googlegroups.com
> Subject: Re: [android-developers] Scrolling broken in 2.2 ?
>
> Hi,
>
> You should never have a scrolling widget inside a scrolling widget;
> for instance a ListView inside a ScrollView. The behavior for such a
> setup is pretty much guaranteed to not work (and definitely not
> guaranteed to work.)
>
> On Tue, Sep 14, 2010 at 11:39 PM, Peter Carpenter
>  wrote:
> > My app builds up a custom screen as dictated to me via the users
> > 'application'.  This means that I can end up in the situation where I have a
> > parent scrollview and somewhere down the heirachy I can have a listView or a
> > multiline TextView.
>
> > Both of these scenarios continue to work fine under 2.1, however are broken
> > in 2.2 (both device and emulator).  The symptoms are that the child (list or
> > textview) is unable to scroll using touch gestures although they can be
> > scrolled using the keypad.
>
> > Has anyone else experienced this behaviour and/or have a work around??  It
> > appears that the onTouchEvent function in View has been changed
> > substantially but I am currently delving into the code...
>
> > Cheers,
>
> > Peter.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> 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

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

RE: [android-developers] Re: Scrolling broken in 2.2 ?

2010-09-15 Thread Peter Carpenter
Thanks Mike,

Yep it's definitely a cross platform framework.  At its simplest, I don't think 
it's too much to expect from a UI to have a scrolling textView within a parent 
scrollview. 

I'll delve into the source today and see if I can spot what's messing with the 
touch events.

Cheers,

Peter.

-Original Message-
From: android-developers@googlegroups.com 
[mailto:android-develop...@googlegroups.com] On Behalf Of Mike dg
Sent: Wednesday, 15 September 2010 7:58 PM
To: Android Developers
Subject: [android-developers] Re: Scrolling broken in 2.2 ?

It sounds like Peter is working on so,e framework for "cross platform"
applications, si it's probably less than ideal to make Android just
act different.

You are probably out of luck for 2.2 if the browser exhibits the same
behavior.

On Sep 15, 3:18 am, Kumar Bibek  wrote:
> Umm, Well, Getting back to 2.1 will not fix your problems. I would
> reckon the best approach would be to re-design your UI.
>
> -Kumar Bibekhttp://techdroid.kbeanie.com
>
> On Sep 15, 12:05 pm, Peter Carpenter
>
>
>
>  wrote:
> > Hey Romain,
>
> > Thanks for the reply,
>
> > I can understand why this is not an ideal ui design - I entirely agree.  
> > But this doesn't change the fact that there seems to be some regression 
> > with the Android UI code.  On researching further I've found that there are 
> > a number of registered bugs for 2.2 to do with browsers exhibiting similar 
> > problems whilst showing pages containing frames.  Looks like something 
> > fundamental has changed here.
>
> > As far as our use case goes - I need to be able to display whatever a user 
> > requires in their screen.  Currently we can show these screens on Windows, 
> > iPhone & Blackberry and Android < 2.1 without any issues.  But Android 2.2 
> > suddenly has this issue with the nesting.  Whilst we *could* design the app 
> > to work around this bug by using a popup editor - this does not help us 
> > keep things consistent, and your architecture bug free.
>
> > As a workaround - do you know of any way to reset Nexus ones back to 2.1?
>
> > Cheers, :)
>
> > Peter.
>
> > -Original Message-
> > From: android-developers@googlegroups.com 
> > [mailto:android-develop...@googlegroups.com] On Behalf Of Romain Guy
> > Sent: Wednesday, 15 September 2010 4:42 PM
> > To: android-developers@googlegroups.com
> > Subject: Re: [android-developers] Scrolling broken in 2.2 ?
>
> > Hi,
>
> > You should never have a scrolling widget inside a scrolling widget;
> > for instance a ListView inside a ScrollView. The behavior for such a
> > setup is pretty much guaranteed to not work (and definitely not
> > guaranteed to work.)
>
> > On Tue, Sep 14, 2010 at 11:39 PM, Peter Carpenter
> >  wrote:
> > > My app builds up a custom screen as dictated to me via the users
> > > 'application'.  This means that I can end up in the situation where I 
> > > have a
> > > parent scrollview and somewhere down the heirachy I can have a listView 
> > > or a
> > > multiline TextView.
>
> > > Both of these scenarios continue to work fine under 2.1, however are 
> > > broken
> > > in 2.2 (both device and emulator).  The symptoms are that the child (list 
> > > or
> > > textview) is unable to scroll using touch gestures although they can be
> > > scrolled using the keypad.
>
> > > Has anyone else experienced this behaviour and/or have a work around??  It
> > > appears that the onTouchEvent function in View has been changed
> > > substantially but I am currently delving into the code...
>
> > > Cheers,
>
> > > Peter.
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > Romain Guy
> > Android framework engineer
> > romain...@android.com
>
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support.  All such questions should be posted on
> > public forums, where I and others can see and answer them
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > 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/gr

[android-developers] Re: setImageURI is changing the size of the image!

2010-09-15 Thread sdphil
oh, and when I look at it on an actual display, it is small (48x48).

On Sep 15, 3:56 pm, sdphil  wrote:
> I am running into a very weird thing.  I have an ImageView, and when I
> call setImageURI with an image, it seems to change the size of the
> image view.
>
>                                                          android:id="@+id/MyImage"
>                                 android:layout_width="wrap_content"
>                                 android:layout_height="wrap_content"
>                                 android:layout_gravity="center_horizontal"
>                                 android:src="@drawable/default_image"/>
>
> the default image is 195 x 195, i am trying to set the image to be 200
> x 200, after setting the image using setImageURI, i get the dimensions
> back and it says it's 48 x 48.
>
> I have tried a bunch of different android:scaleType parameters, and I
> couldn't find anything that worked.
>
> I also tried explicitly setting the size (layout_width="200px") and it
> seems to work.
>
> any ideas?
>
> tia.

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

2010-09-15 Thread Frank Weiss
I'll compare this with similar code I have running, but meanwhile, could you
run in debug and give the stack trace or at least identify the exception.
That should also give you the line number in your code.

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

[android-developers] context menu is black

2010-09-15 Thread rh4games
I followed the instructions how to create a context menu but mine
shows up completely black and nothing in it. Anyone has already had
the same issue and can help me how he/she solved it?

Thanks

Here my class .java and menu .xml files

package com.MyProject;

import android.view.MenuInflater;
import android.view.MenuItem;
import android.app.Activity;
import android.view.ContextMenu;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;

public class ColorsActivity extends Activity {

@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
  super.onCreateContextMenu(menu, v, menuInfo);
  MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.context_menu, menu);
  registerForContextMenu(v);

}
public boolean onContextItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.red:
if (item.isChecked()) item.setChecked(false);
else item.setChecked(true);
return true;
case R.id.blue:
if (item.isChecked()) item.setChecked(false);
else item.setChecked(true);
return true;
case R.id.green:
if (item.isChecked()) item.setChecked(false);
else item.setChecked(true);
return true;
case R.id.yellow:
if (item.isChecked()) item.setChecked(false);
else item.setChecked(true);
return true;
case R.id.black:
if (item.isChecked()) item.setChecked(false);
else item.setChecked(true);
return true;
case R.id.white:
if (item.isChecked()) item.setChecked(false);
else item.setChecked(true);
return true;
case R.id.orange:
if (item.isChecked()) item.setChecked(false);
else item.setChecked(true);
return true;
default:
return super.onContextItemSelected(item);
}
}
}


http://schemas.android.com/apk/res/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] setImageURI is changing the size of the image!

2010-09-15 Thread sdphil
I am running into a very weird thing.  I have an ImageView, and when I
call setImageURI with an image, it seems to change the size of the
image view.



the default image is 195 x 195, i am trying to set the image to be 200
x 200, after setting the image using setImageURI, i get the dimensions
back and it says it's 48 x 48.

I have tried a bunch of different android:scaleType parameters, and I
couldn't find anything that worked.

I also tried explicitly setting the size (layout_width="200px") and it
seems to work.

any ideas?

tia.

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


[android-developers] ACTION_IMAGE_CAPTURE intent

2010-09-15 Thread lloyd1949
I have created an app that uses the ACTION_IMAGE_CAPTURE intent to
take an image and write to my specified path on the SD Card. This
appears to work fine in the emulator giving me the default image.

When I go to test on a real device (Droid by Motorola) my main app is
aborted. From within the debugger, I see the following:

1. Main Activity 1 Starts Activity 2
2. Activity 2 Starts Activity 3
3. Activity 3 decides that a picture must be taken and fires the
ACTION_IMAGE_CAPTURE intent
1. The Camera Activity starts up
2. Everything looks fine with the debugger environment, nothing seems
to be wrong
3. Next I point the camera at the object. However the instant I press
the camera shutter to take the picture, the debugger reports the
following:

---
MyAppName [Android Application]
DalvikVM[localhost:8602]


and from what I see it seems that all activitiess have been killed.
This happens without my pressing the OK button to accept the image
from the Camera app. The proper image (size etc) is captured at the
requested pathname but something is causing my app to die.
Any comments, suggestions will be greatly appreciated as I have been
frustrated by this now for 2 days.
Thanks in advance.

Here are the routines:
_
private void TakePicture () {
String mDirectoryname = null;
Intent cameraIntent;

try {
// Make our directory
File ExternalDir = 
Environment.getExternalStorageDirectory();
File myDir = new 
File(ExternalDir,"/Download/MyReceiptImages");
myDir.mkdirs();

// Make the temp file and delete it if it exists
mDirectoryname = ExternalDir.toString() + "/Download/
MyReceiptImages";
File tempfile = new File(mDirectoryname, ".jpg");
if (tempfile.isFile()) tempfile.delete();
Uri Imagefile = Uri.fromFile(tempfile);

// Fire up the Camera

cameraIntent = new 
Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, 
Imagefile);
startActivityForResult (cameraIntent, 
Globals.ACTIVITY_CAMERA);

}
catch (Exception e){
Log.v(TAG, e.toString());
}
return;

}

@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);

if (resultCode == RESULT_CANCELED){
 return;
}
switch (requestCode) {
case Globals.ACTIVITY_CAMERA:
File ExternalDir =
Environment.getExternalStorageDirectory();
File myDir = new File(ExternalDir,"/Download/
MyReceiptImages");
myDir.mkdirs();

// Make the permanent filename
String mDirectoryname = ExternalDir.toString() + "/
Download/MyReceiptImages";
String filename = "d_" +
String.valueOf(Globals.getCurrentRowId()) + ".jpg" ;
ImageFilename = new File(mDirectoryname, filename);
if (ImageFilename.isFile()){
ImageFilename.delete();
   }
  File takenFile = new File(mDirectoryname, ".jpg");
  takenFile.renameTo(ImageFilename);
  break;

}
}


I am sure (I hope) that it is something simple but I just cannot spot
it. It seems to be related to memory usage. My app has been running
for about 4 months. This started recently when I introduced the
Camera. Why android is killing the entire app is beyond me.


Heee somebody please.

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


[android-developers] Re: Easiest way to know if SD card has been prepared?

2010-09-15 Thread HaMMeReD
Perfect, the getExternalStorageState tells me everything I need to fix
my bug, thanks.

Adam

On Sep 15, 7:51 am, Kumar Bibek  wrote:
> I guess, you can also check for Broadcasts, if you mount-remount your
> sdcard frequently when your application/service is running.
>
> But, checking for the storage state is the surest way.
>
> -Kumar Bibekhttp://techdroid.kbeanie.com
>
> On Sep 15, 4:51 pm, Mark Murphy  wrote:
>
> > On Wed, Sep 15, 2010 at 7:46 AM, HaMMeReD  wrote:
> > > How would one know if the SD card has been mounted at startup.
>
> > Environment.getExternalStorageState().
>
> > > Perhaps some sort of callback/event/message that I can grab that tells
> > > me when SD has been mounted/unmounted?
>
> > See the ACTION_MEDIA_* broadcast Intents, documented on the Intent class:
>
> >http://developer.android.com/reference/android/content/Intent.html
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

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

2010-09-15 Thread Filip Havlicek
You can do that with URLConnection too of course, although it takes a little
bit more effort to make it work.

Best regards,
Filip Havlicek

2010/9/16 Frank Weiss 

> For simple requests, URLConnection works fine. Use HttpClient if you need
> to manage basic auth, cookies, headers, etc.
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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

Re: [android-developers] HttpURLConnection or HttpClient

2010-09-15 Thread Frank Weiss
For simple requests, URLConnection works fine. Use HttpClient if you need to
manage basic auth, cookies, headers, etc.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Sharing a stream object between activities of a tab view

2010-09-15 Thread Mark Murphy
On Wed, Sep 15, 2010 at 5:35 PM, mastergap  wrote:
> But if the content of a tab is a list view i need to put it in a list
> activity. I'm wrong?

No, you do not need to put a ListView in a ListActivity. Nor do you
need to put tabs in a TabActivity.

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

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


[android-developers] eclipse - parseSDKContent failed message

2010-09-15 Thread dashman
i'm getting an eclipse startup error message

'Android SDK Content Loader' has encountered a problem

parseSDKContent failed.

org/eclipse/jdt/core/JavaCore

Could not create the view: Plug-in org.eclipse.jdt.ui was unable to
load class
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.

all this was working before...

basically the Package Explorer window is inop.

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


[android-developers] HttpURLConnection or HttpClient

2010-09-15 Thread cindy
Hi,

I was told it was prefer to use Apache's library HttpClient, instead
of java's Http URLConnection. Does any one know why?

Thanks!

Cindy

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


[android-developers] Re: Sharing a stream object between activities of a tab view

2010-09-15 Thread mastergap
But if the content of a tab is a list view i need to put it in a list
activity. I'm wrong?

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


Re: [android-developers] Re: Fil-rate workaround with FBOs?

2010-09-15 Thread Leigh McRae
 Fill rate does seem to be the biggest issue with performance.  I would 
make sure you have stuff like blending off to make the quad go as fast 
as it can.



On 9/15/2010 4:30 AM, Samsyn wrote:

Well, I ran the experiement...

1.) it does work, though apparently the FBO texture ends up upside
down with relation to all my other textures, so I had to do a little
correction for that
2.) it does increase the frame rate, but not substantially
3.) it does look worse (a 256x256 FBO is not too awful.  128x128 is
horrid)
4.) it consumes extra memory (for the FBO buffer(s))

on a Moto Droid I, my reference scene

Without FBOs, rendering to full screen: about 20 fps
With FBOs, rendering to 128x128: about 28.5fps
With FBOs, rendering to 256x256: about 26.2fps
With FBOs, rendering to 32x32: about about 30 fps  (clearly unusuable,
of course, unless you wanted a illusion of out of focus)

512x512 is not on the table as you get an out of memory condition with
high regularity

I still have to try it on the Eris (my problem phone), but overall, I
don't think the result really justifies the feature.

I'm pretty sure the fill rate I save with the smaller render target is
lost with the render of the background quad with that texture on it.
Perhaps if I had a clever way to jam the texture (and stretch it
nicely) into the colorBuffer directly...

On Sep 12, 1:12 pm, Samsyn  wrote:

My apologies if this is a stupid question...

Might I get a net frame rate improvement if I did something like this:

* create an FBO of resolution less than the full phone screen
dimensions (user-selected quality vs speed option)
* do most of my scene rendering into that FBO
* then the 'real' (full screen) render would either use the FBO as the
starting background color buffer contents, or render it (probably
orthographically) as a single quad.
* then probably add UI/Text decoration on top of that, where the
resolutions really benefits.

And, is there some egl glue (I am a glSurfaceView kinda dood) that
would automagically do something like this in the first place?

Or am I being naive to think the GPU could do its work faster if it
was rendering to a lower resolution target?

And would the phone with the worst fill rate also be the phone that
doesn't support FBOs in the first place?

After reading the OpenVR info (thanks again, Lance) I think I might
get some improvement by breaking some huge triangles into smaller
ones. I have some (water layer, in particular) that are so large they
probably get processed by every tile of the screen.

Thanks for any insights,

- Dan


--
Leigh McRae
www.lonedwarfgames.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] specify audio out

2010-09-15 Thread Benjamin
Any thoughts on what it would take to specify which audio output to
use when a user is playing an mp3? HDMI or speaker?

Thanks in advance,

Ben

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

2010-09-15 Thread savanevery
I have had great success with the Java port of FFTPACK: 
http://www.netlib.org/fftpack/

-shawn

Shawn Van Every
Author: Pro Android Media (Coming Late 2010)
http://apress.com/book/view/9781430232674

On Sep 15, 7:03 am, Indicator Veritatis  wrote:
> Well, it depends on how many different frequency bins he wants and how
> complicated a windowing function. If he wants lots of bins and a fancy
> window, he will wish he had direct access to the DSP on the phone as
> well as raw audio.
>
> Otherwise, he can get a lot of mileage out of an FFT algorithm even in
> plain Java. Processors are so much faster these days, even on a phone.
>
> On Sep 14, 3:30 am, Tez  wrote:> AudioRecord API.
> > Using this you can get raw bytes from the microphone stream.
> > Since you are analyzing audio, this is a heavy operation. You may want
> > to consider the NDK.
> > However, you cannot access the audio APIs from the NDK. You may have
> > to write a JNI wrapper to transfer byte streams.
>
> > Cheers,
> > Earlence
>
> > On Sep 14, 12:19 pm, Muhammad Ali  wrote:
>
> > > Hi All,
>
> > >     I am new for multimedia in java and I am going to develop an
> > > application which can analyze the sound spectrum. I don't know how to
> > > get a real time sound from the mic of the android and analyze it. If
> > > someone know about any API and method that how to get real time sound
> > > and get the values of its spectrum please help me, I am very thankful
> > > you for your precious time.
>
> > > Yours,
> > > Ali

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


[android-developers] Re: Any way to animate a 2D Game Smooth without OpenGL ?

2010-09-15 Thread Andreas
Hey Jason,

thank you "so much" for the Feedback. I would love to  see your game
skeleton, to see how you solve some common problems. Or how you store
and iterate your gameObjects.

In My case every GameObject, like a Missle or Enemy has update(long
difftime) and draw(Canvas c) method implemented. In the game thread
the thread iterates over all objects and updates them (via update) and
after that the Thread iterates over all Gameobjects an calls the draw
method.

Basically i don't see the big advantage to separate those to Methods
in 2 Threads- because at the end draw() is called after update() -
(while true)-  if you have 2 threads you kind of loop over 2 threads.
because 1 is started, finished, stops, starts thread 2, finishes,
starts thread 1

I you can spare some time i would be "very" thankful to maybe have a
Skype or TeamSpeak Chat  with you =)

On 15 Sep., 15:34, Jason  wrote:
> Hi Andreas,
>
> Sorry to jump in late, but I thought I'd share my experiences with non-
> opengl on Android.
>
> I have a game "engine" which uses both open gl and the canvas system
> depending on the device capabilities (some devices, like HTC Tattoo
> have software implementations of opengl which is actually slower than
> canvas).  I get reasonable performance from the canvas api, but the
> important thing is that the bottle-neck has always been draw speed and
> nothing else.
>
> I pretty much followed the replica island approach whereby I have two
> threads, one which just draws and the other where all the game calcs
> are done.  My game thread routinely outperforms my render thread, but
> I am drawing quite a lot so this may not be everyone's experience.
>
> I'd say you do have a slight architectural flaw in that (it appears)
> that your game logic is being computed in the same thread as the
> rendering.  This means that the render thread has to wait each frame
> for the game to update state.  It's much better to separate these
> two.  Have your game logic updated in a separate thread, then just
> notify the render thread when it's time to draw (you can do this by
> sending a message to your surface view using a Handler and then
> invalidating the canvas).
>
> Basically what I do is this:
>
> I have a separation of game objects, and "renderable" objects.  A game
> object is the real representation of the in-game element (eg the
> player).  The renderable object is simple a set of x,y coords, plus
> scale, rotation etc and a reference to the image that represents the
> sprite (I have some more logic to include sprite animations etc, but
> the basic concept is the same).  Hence my renderables are "dumb".
> They don't know what they are, they just know how to be drawn.  My
> game objects contain all the important logic information (eg player
> health etc).   This is how I cater for both Canvas and OpenGL.  I have
> CanvasRenderable objects and OpenGLRenderable objects which both
> extend a common base class (... you guessed it.. Renderable).  This
> base class pretty much has just one method... draw().  (actually it
> sends in a reference to the graphics context... so either Canvas or
> GL10, but you get the idea)
>
> When the render thread is drawing the renderables, the game thread is
> processing the next "step" in the game.  Once the game thread has
> completed its step, it waits for the render thread to complete (I
> implemented a simple mutex sort of like the java ReadWriteLock, but
> one that doesn't allocate a bunch of objects like the ReadWriteLock
> does!).  Once the render thread has completed, I send all the updated
> coordinates, rotations etc to the renderable objects from the game
> object counterparts.  While I am doing this, I prevent the render
> thread from rendering the next frame (using the same mutex) so it
> isn't rendering objects in a half-moved state.
>
> Then the game thread is ready to process its next step, and it uses
> the time taken to process the last step (including the time spent
> waiting for the render thread) as the input into the calculations.
>
> The end result is that the render thread is just doing one thing..
> rendering... as fast as it can.  All the actual logic is separated
> into the Game Thread.  The only delay in each frame is the time it
> takes to set all the coordinates etc on the renderables.. which is
> usually pretty fast.
>
> The third thread is just the Activity which handles the user input
> etc.  This will typically only affect objects in the Game Thread (eg
> increase speed of player etc)
>
> As far as GC calls go, I have not been able to eliminate them
> completely (there still seem to be allocations buried in the Android
> api which I can't seem to get rid of) but they are infrequent enough
> that it's not really an issue.  I just used the Allocation Tracking to
> locate any dodgy allocations and re-code them out.  I'm currently not
> rendering any Strings however (not during gameplay anyway), but you
> could also get around this by not writing text as such, 

Re: [android-developers] how to add library project to my project

2010-09-15 Thread Kostya Vasilyev
Your Android / Eclipse plugin might be out of date.

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

15.09.2010 22:41 пользователь "cindy"  написал:

When I right click the project in the eclipse, select "Properties". In
the property page, select Android.

According to the document, you can add the library project through
that page. But my problem is that, there is no library information on
the page. It only lists "project build target"

What might be wrong?

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

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

[android-developers] Re: Featured apps

2010-09-15 Thread mot12
I have seen ridiculous apps with a hundred or so downloads on this
list. That seems to exclude a rational process driven by popularity or
download numbers. Of course, I don't mind being alerted to a great app
that is just starting out but often one has to wonder what is going
here given the quality of some of the featured apps.

And a bit of transparency in this process would greatly increase my
trust in the market. At this point my trust is, well, cautious.

Martin
Gentle Alarm - a good alarm clock wakes you up without you knowing it
was your alarm clock...

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

2010-09-15 Thread Heiko
Mark, thanks a lot for the answer!

On Sep 15, 1:10 pm, Mark Murphy  wrote:
> On Wed, Sep 15, 2010 at 4:33 AM, Heiko  wrote:
> > Is this behaviour intended ("not a bug, a feature")?
>
> Based on a previous discussion of this topic in this group, I think
> the answer is "bug" or at least "implementation gap".
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

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


[android-developers] Re: Negative resource id value?

2010-09-15 Thread String
You're correct, use 0 if you need a "null" resource ID. From
http://developer.android.com/reference/android/content/res/Resources.html#getIdentifier(java.lang.String,+java.lang.String,+java.lang.String):

"0 is not a valid resource ID"

String

On Sep 15, 8:57 pm, DanH  wrote:
> The other thing you could do is define a resource symbol and reserve
> it for "null".
>
> But I'm almost positive that zero is "reserved" already and can serve
> as null, and I strongly doubt that a valid resource id would ever be
> negative.
>
> On Sep 15, 2:29 pm, Mark Carter  wrote:
>
>
>
> > Is it possible that a resource id (such as a generated id for a string
> > resource) can be a negative int?
>
> > Often, when defining a method that accepts a resource id, I want the
> > caller to be able to specify a "null" value. For primitives this is
> > not possible, but I'm wondering whether "any negative value" may be a
> > good approach?
>
> > Alternatively I suppose it would be OK to specify the argument as an
> > Integer and take advantage of auto-boxing.
>
> > Thoughts?

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


[android-developers] Re: Negative resource id value?

2010-09-15 Thread DanH
The other thing you could do is define a resource symbol and reserve
it for "null".

But I'm almost positive that zero is "reserved" already and can serve
as null, and I strongly doubt that a valid resource id would ever be
negative.

On Sep 15, 2:29 pm, Mark Carter  wrote:
> Is it possible that a resource id (such as a generated id for a string
> resource) can be a negative int?
>
> Often, when defining a method that accepts a resource id, I want the
> caller to be able to specify a "null" value. For primitives this is
> not possible, but I'm wondering whether "any negative value" may be a
> good approach?
>
> Alternatively I suppose it would be OK to specify the argument as an
> Integer and take advantage of auto-boxing.
>
> Thoughts?

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


[android-developers] Re: Changing Features of Buttons Dynamically

2010-09-15 Thread Kumar Bibek
What are you actually trying to achieve, and what errors you get?

-Kumar Bibek
http://techdroid.kbeanie.com

On Sep 14, 5:24 pm, TreKing  wrote:
> On Mon, Sep 13, 2010 at 10:13 AM, Heshan Perera <
>
> anthonyheshanper...@gmail.com> wrote:
> > Similarly, I tried changing the text property of Button objects and when
> > run on the emulator, it simply says that program has stopped working.
>
> Are you using the debugger to determine WHERE it stops working and what
> causes the problem?
>
> -
> 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: Installing new root CA certificate from application

2010-09-15 Thread Kumar Bibek
You cannot install the certificate on the device. However, you can get
hold of the certificates, create a keystore file inside your app, and
add the certificates there. The next time you initiate a request, use
this keystore to initialize the SSLContext, and that should work.

It's a bit tricky however, but you can definitely do this. Look for
some samples.

-Kumar Bibek
http://techdroid.kbeanie.com

On Sep 14, 6:30 pm, Omer Gilad  wrote:
> Hello,
> My application redirects its users to a known domain
> (secure.gate2shop.com) that its root certificate doesn't exist on
> Android devices.
> Normal PC browsers have no problem accessing the site, but Android
> browser displays to the user that the certificate is untrusted. I
> don't want that behavior, not even once, so I'm looking for a way to
> install this certificate on the device from my app.
>
> Does anyone know about a way to do that?
>
> 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] Negative resource id value?

2010-09-15 Thread Mark Carter
Is it possible that a resource id (such as a generated id for a string
resource) can be a negative int?

Often, when defining a method that accepts a resource id, I want the
caller to be able to specify a "null" value. For primitives this is
not possible, but I'm wondering whether "any negative value" may be a
good approach?

Alternatively I suppose it would be OK to specify the argument as an
Integer and take advantage of auto-boxing.

Thoughts?

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


[android-developers] TelephonyManager getLine1Number() returns 10 or 11 characters?

2010-09-15 Thread john brown
It seems this code:
//***
TelephonyManager mTelephonyMgr =
(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);

phoneID = mTelephonyMgr.getLine1Number();
//

returns different "phone number format" on different devices.
Specifically:
Motorlola droid from Verizon returns:   780563 (length 10)
AVD with HVGA skin returns:   1218135 (length 11)
Samsung Galaxy from AT&T returns: 17805639998 (length 11)

I can get rid of the leading "1" where it exists or I can add "1" to
make them all the same if this is all inclusive of what is returned.

What should I expect in variation from this routine?

Thanks, John Brown

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


[android-developers] Re: ADT master and aapt

2010-09-15 Thread snpe
It helps. Thank you.

On Sep 15, 8:42 pm, Raphael  wrote:
> Hi there,
>
> Yep, it's trivial as long as you have the right version of Cygwin.
>
> 1- Install cygwin. Not the latest one, you need the "legacy" one. Look
> at step 3-A in this doc:
>  http://android.git.kernel.org/?p=platform/sdk.git;a=blob;f=docs/howto...
>
> 2- You don't need to build a full SDK, you simply need to "make aapt"
> from the top of the tree.
>
> Let me know if that helps
> R/
>
> On Wed, Sep 15, 2010 at 1:38 AM, snpe  wrote:
> > Is it possible to build Windows version of aapt.exe ?
>
> > Thanks
>
> > On Sep 14, 7:26 pm, Xavier Ducrohet  wrote:
> >> Not yet. you'll have to build it yourself from master.
>
> >> On Tue, Sep 14, 2010 at 2:06 AM, snpe  wrote:
> >> > Hi,
>
> >> >  ADT master execute aapt with the --debug-mode option. aapt in
> >> > Android SDK 07 doesn't support this option. Is there Windows build of
> >> > SDK which support this ?
>
> >> > Thanks,
> >> > Peco
>
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups "Android Developers" group.
> >> > To post to this group, send email to android-developers@googlegroups.com
> >> > To unsubscribe from this group, send email to
> >> > android-developers+unsubscr...@googlegroups.com
> >> > For more options, visit this group at
> >> >http://groups.google.com/group/android-developers?hl=en
>
> >> --
> >> Xavier Ducrohet
> >> Android SDK Tech Lead
> >> Google Inc.
>
> >> Please do not send me questions directly. 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

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


[android-developers] Re: Loading raw resource text file hang...

2010-09-15 Thread Mystique
I'm not sure... I've been using this in my previous app.

I change to this code instead and it is working.

---code---
TextView helpTxt = (TextView)findViewById(R.id.helptext);
helpTxt.setText(readTxt());
}

private String readTxt() {
InputStream inputStream =
getResources().openRawResource(R.raw.help);
ByteArrayOutputStream byteArrayOutputStream = new
ByteArrayOutputStream();
int i;
try {
i = inputStream.read();
while (i != -1) {
byteArrayOutputStream.write(i);
i = inputStream.read();
}
inputStream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return byteArrayOutputStream.toString();
   }
}


On Sep 16, 3:12 am, TreKing  wrote:
> On Wed, Sep 15, 2010 at 1:53 PM, Mystique  wrote:
> > while ((strLine = dataIO.readLine()) != "") {
> >            sBuffer.append(strLine + "\n");
>
> This seems suspect. Shouldn't you be checking for null?
>
> --- 
> --
> 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


Re: [android-developers] Want to develop develop droid application

2010-09-15 Thread Frank Weiss
I don't think there's a "perfect" setting. Please look through the
documentation regarding this topic, follow the many thread on this very
topic, and post a most specific question.

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

[android-developers] Re: Loading raw resource text file hang...

2010-09-15 Thread DanH
And, of course, DataInputStream.readLine is deprecated.

On Sep 15, 1:53 pm, Mystique  wrote:
> Hi, I use this method couples of occasion to load text file to display
> as help file.
> But I don't know why the following code didn't work. It seems to hang
> and logcat says "OutOfMemoryError"?
>
> All I did was break this out as an separate activity...
> Can anyone help me to catch the problem?
>
> ---xml---
> 
> http://schemas.android.com/apk/res/android";
>         android:id="@+id/helptab"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent">
>          android:id="@+id/helptext"
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content" />
> 
>
> ---code---
> import java.io.DataInputStream;
> import java.io.IOException;
> import java.io.InputStream;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.widget.TextView;
>
> public class Help extends Activity {
>     /** Called when the activity is first created. */
>     @Override
>
>     protected void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.help);
>
>         InputStream iFile =
> getResources().openRawResource(R.raw.help);
>         try {
>             TextView helpText = (TextView)
> findViewById(R.id.helptext);
>             String strFile = inputStreamToString(iFile);
>             helpText.setText(strFile);
>         } catch (Exception e) {
>         }
>     }
>
>     public String inputStreamToString(InputStream is) throws
> IOException {
>         StringBuffer sBuffer = new StringBuffer();
>         DataInputStream dataIO = new DataInputStream(is);
>         String strLine = "";
>         while ((strLine = dataIO.readLine()) != "") {
>             sBuffer.append(strLine + "\n");
>         }
>         dataIO.close();
>         is.close();
>         return sBuffer.toString();
>     }
>
> }

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


[android-developers] Re: Loading raw resource text file hang...

2010-09-15 Thread DanH
What's the size of the file?

On Sep 15, 1:53 pm, Mystique  wrote:
> Hi, I use this method couples of occasion to load text file to display
> as help file.
> But I don't know why the following code didn't work. It seems to hang
> and logcat says "OutOfMemoryError"?
>
> All I did was break this out as an separate activity...
> Can anyone help me to catch the problem?
>
> ---xml---
> 
> http://schemas.android.com/apk/res/android";
>         android:id="@+id/helptab"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent">
>          android:id="@+id/helptext"
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content" />
> 
>
> ---code---
> import java.io.DataInputStream;
> import java.io.IOException;
> import java.io.InputStream;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.widget.TextView;
>
> public class Help extends Activity {
>     /** Called when the activity is first created. */
>     @Override
>
>     protected void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.help);
>
>         InputStream iFile =
> getResources().openRawResource(R.raw.help);
>         try {
>             TextView helpText = (TextView)
> findViewById(R.id.helptext);
>             String strFile = inputStreamToString(iFile);
>             helpText.setText(strFile);
>         } catch (Exception e) {
>         }
>     }
>
>     public String inputStreamToString(InputStream is) throws
> IOException {
>         StringBuffer sBuffer = new StringBuffer();
>         DataInputStream dataIO = new DataInputStream(is);
>         String strLine = "";
>         while ((strLine = dataIO.readLine()) != "") {
>             sBuffer.append(strLine + "\n");
>         }
>         dataIO.close();
>         is.close();
>         return sBuffer.toString();
>     }
>
> }

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

2010-09-15 Thread Frank Weiss
I see a couple of issues with your code.

1) The location variable set in the following line does not appear to be
used anywher:

Location location = locationManager.getLastKnownLocation(provider);

2) Are you trying to send an intent to the Maps or Browser app, of handle
the location display yourself? In one place the code has:

startActivity(new Intent(Intent.ACTION_VIEW, uri));

yet in another line, the code goes:

canvas.drawBitmap(bitmap, myScreenCoords.x, myScreenCoords.y, paint);

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

2010-09-15 Thread TreKing
On Wed, Sep 15, 2010 at 1:53 PM, Mystique  wrote:

> while ((strLine = dataIO.readLine()) != "") {
>sBuffer.append(strLine + "\n");
>

This seems suspect. Shouldn't you be checking for null?

-
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

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread TreKing
On Wed, Sep 15, 2010 at 12:59 PM, Dhrumil Shah wrote:

> I am new in Android so I dont know what is stack trace and log? How to
> check stack trace?


http://developer.android.com/guide/developing/debug-tasks.html

Start reading =)

-
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

Re: [android-developers] Re: trigonometry

2010-09-15 Thread Pedro Teixeira

I guess Math is not my area of expertise, sorry for that :)

On Sep 15, 2010, at 7:41 PM, DanH wrote:


Yeah atan2 is a really new concept -- invented maybe 1965 with
Fortran, if not before.  Pretty much a standard in all language math/
trig suites since then.

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

On Sep 15, 11:56 am, Pedro Teixeira  wrote:

Geez this is even better than I expected. I was worried with negative
values hence the Math.abs and I wasn't sure how to express in  
degrees.


Thank you very much for your answers guys, the atan2 is completely  
new

to me ;)

Thanks again

On Sep 15, 2010, at 5:50 PM, Kostya Vasilyev wrote:




Um, no.



Math.atan2 takes two values, not one.



Math.atan2(y2 - y1, x2 - x1)



This gives correct result even for x2 and x1 being very close to
each other. Depending on the sign of y2 - y1 that's either "up" or
"down".



-- Kostya



15.09.2010 20:45, Robert Green пишет:

Kostya hit it:



float angleDegrees = Math.toDegrees(Math.atan2((y1 - y2) / (x1 -
x2)));



On Sep 15, 11:32 am, Kostya Vasilyev  wrote:

  Pedro,



Java (and pretty much any language's) trig functions work with
angles
expressed in radians.



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



To convert to degrees, multiply by 180 / 3,1415926 (in Java,
that's
Math.PI). Or just call Math.toDegrees.



Better yet - use Math.atan2 ( difference along Y, different along
X).
This one correctly handles the case of value3-value4 being zero
(or very
close thereof).



-- Kostya



15.09.2010 20:22, Pedro Teixeira пишет:



Hi,
I'm having problems with JAva and trigonometry to calculate a
direction from a point to a certain point...
I want to translate this equation to Java-wise:
tg^-1 = |value1-value2| / |value3-value4|
And I'd like the result in degrees.. how can I do this? any  
ideia?

--
Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com



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


Pedro Teixeira

www.pedroteixeira.org


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


Pedro Teixeira

www.pedroteixeira.org

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


[android-developers] Loading raw resource text file hang...

2010-09-15 Thread Mystique
Hi, I use this method couples of occasion to load text file to display
as help file.
But I don't know why the following code didn't work. It seems to hang
and logcat says "OutOfMemoryError"?

All I did was break this out as an separate activity...
Can anyone help me to catch the problem?

---xml---

http://schemas.android.com/apk/res/android";
android:id="@+id/helptab"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">



---code---
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

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

public class Help extends Activity {
/** Called when the activity is first created. */
@Override

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.help);

InputStream iFile =
getResources().openRawResource(R.raw.help);
try {
TextView helpText = (TextView)
findViewById(R.id.helptext);
String strFile = inputStreamToString(iFile);
helpText.setText(strFile);
} catch (Exception e) {
}
}

public String inputStreamToString(InputStream is) throws
IOException {
StringBuffer sBuffer = new StringBuffer();
DataInputStream dataIO = new DataInputStream(is);
String strLine = "";
while ((strLine = dataIO.readLine()) != "") {
sBuffer.append(strLine + "\n");
}
dataIO.close();
is.close();
return sBuffer.toString();
}
}

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

2010-09-15 Thread Raphael
Hi there,

Yep, it's trivial as long as you have the right version of Cygwin.

1- Install cygwin. Not the latest one, you need the "legacy" one. Look
at step 3-A in this doc:
  
http://android.git.kernel.org/?p=platform/sdk.git;a=blob;f=docs/howto_build_SDK.txt;hb=HEAD

2- You don't need to build a full SDK, you simply need to "make aapt"
from the top of the tree.

Let me know if that helps
R/

On Wed, Sep 15, 2010 at 1:38 AM, snpe  wrote:
> Is it possible to build Windows version of aapt.exe ?
>
> Thanks
>
> On Sep 14, 7:26 pm, Xavier Ducrohet  wrote:
>> Not yet. you'll have to build it yourself from master.
>>
>>
>>
>> On Tue, Sep 14, 2010 at 2:06 AM, snpe  wrote:
>> > Hi,
>>
>> >  ADT master execute aapt with the --debug-mode option. aapt in
>> > Android SDK 07 doesn't support this option. Is there Windows build of
>> > SDK which support this ?
>>
>> > Thanks,
>> > Peco
>>
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Android Developers" group.
>> > To post to this group, send email to android-developers@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > android-developers+unsubscr...@googlegroups.com
>> > For more options, visit this group at
>> >http://groups.google.com/group/android-developers?hl=en
>>
>> --
>> Xavier Ducrohet
>> Android SDK Tech Lead
>> Google Inc.
>>
>> Please do not send me questions directly. 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
>

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


[android-developers] Re: trigonometry

2010-09-15 Thread DanH
Yeah atan2 is a really new concept -- invented maybe 1965 with
Fortran, if not before.  Pretty much a standard in all language math/
trig suites since then.

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

On Sep 15, 11:56 am, Pedro Teixeira  wrote:
> Geez this is even better than I expected. I was worried with negative  
> values hence the Math.abs and I wasn't sure how to express in degrees.
>
> Thank you very much for your answers guys, the atan2 is completely new  
> to me ;)
>
> Thanks again
>
> On Sep 15, 2010, at 5:50 PM, Kostya Vasilyev wrote:
>
>
>
> > Um, no.
>
> > Math.atan2 takes two values, not one.
>
> > Math.atan2(y2 - y1, x2 - x1)
>
> > This gives correct result even for x2 and x1 being very close to  
> > each other. Depending on the sign of y2 - y1 that's either "up" or  
> > "down".
>
> > -- Kostya
>
> > 15.09.2010 20:45, Robert Green пишет:
> >> Kostya hit it:
>
> >> float angleDegrees = Math.toDegrees(Math.atan2((y1 - y2) / (x1 -
> >> x2)));
>
> >> On Sep 15, 11:32 am, Kostya Vasilyev  wrote:
> >>>   Pedro,
>
> >>> Java (and pretty much any language's) trig functions work with  
> >>> angles
> >>> expressed in radians.
>
> >>>http://en.wikipedia.org/wiki/Radian
>
> >>> To convert to degrees, multiply by 180 / 3,1415926 (in Java,  
> >>> that's
> >>> Math.PI). Or just call Math.toDegrees.
>
> >>> Better yet - use Math.atan2 ( difference along Y, different along  
> >>> X).
> >>> This one correctly handles the case of value3-value4 being zero  
> >>> (or very
> >>> close thereof).
>
> >>> -- Kostya
>
> >>> 15.09.2010 20:22, Pedro Teixeira пишет:
>
>  Hi,
>  I'm having problems with JAva and trigonometry to calculate a
>  direction from a point to a certain point...
>  I want to translate this equation to Java-wise:
>  tg^-1 = |value1-value2| / |value3-value4|
>  And I'd like the result in degrees.. how can I do this? any ideia?
> >>> --
> >>> Kostya Vasilyev -- WiFi Manager + pretty widget 
> >>> --http://kmansoft.wordpress.com
>
> > --
> > 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
>
> Pedro Teixeira
>
> www.pedroteixeira.org

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


[android-developers] how to add library project to my project

2010-09-15 Thread cindy
When I right click the project in the eclipse, select “Properties”. In
the property page, select Android.

According to the document, you can add the library project through
that page. But my problem is that, there is no library information on
the page. It only lists "project build target"

What might be wrong?

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


[android-developers] Re: Another developer has published an app using the EXACT same name as mine

2010-09-15 Thread DanH
The distinction between what can be trademarked and what can't is a
fuzzy area.  Generally, the more specialized the market, the less
"original" the trademark needs to be.  "ICE: In Case of Emergency"
would, eg, almost certainly not be judged to be a trademark that would
allow the presumed holder for a phone app to claim infringement for,
say, a device that stores emergency info in the refrigerator.  But
when one narrows the field down to phone apps, and then further
narrows the field down to Android, and then further goes back in
history a year or two to when Android was new and the total number of
apps as small (such that this particular app would be relatively well
known in the Android community) then the strength of the trademark
increases.

On Sep 14, 9:07 pm, Chris Stratton  wrote:
> I suspect the pattern of
>
> ABBREVIATION: Same Spelled Out
>
> is too generic for an unoriginal abbreviation already in common use to
> be able to trademark it - just moving an existing idea to android
> shouldn't create new legal territory any more than moving one from
> bricks & mortar to the internet, but who knows... the legal system
> hasn't completely grasped that one yet either.
>
> JP wrote:
> > Consider a DMCA takedown notice. I am sure applicable forms and how-to
> > instructions are readily available in the Interwebs. Fill out, send to
> > the operator of Android Market, hope for the best. The operator of
> > YouTube is dealing with this on a daily basis.
>
> > On Sep 14, 12:02 pm, Flying Coder  wrote:
> > > Hi Dan,
> > >     Thanks for the feedback.  The app is "ICE: In Case of Emergency"
> > > and has been published on the Market since Feb 09 (at the time, it was
> > > the only ICE app for Android).  Its currently one of the top-rated
> > > paid apps in the Health category. Its such a common phrase, that I
> > > wasn't expecting to be able to Trademark it, but I did expect the
> > > Market to require competitors to use names that were at least a LITTLE
> > > different.
>
> > >     I discovered the copycat today when I got an email requesting
> > > technical support from someone who thought they had purchased my app,
> > > when in fact they had purchased the copycat's.
>
> > > Cheers,
> > > Steve
>
> > > On Sep 14, 1:58 pm, DanH  wrote:
>
> > > > Do you have the app name trademark protected?
>
> > > > If you have been using the app name for some time (how long "some" is
> > > > depends) then you could claim it as your trademark.  Simplest way to
> > > > do this is to simply place (tm) after the name.  It's not nearly as
> > > > good as a registered trademark, but it carries some weight.
>
> > > > However, once a copycat has jumped on the name, it's harder to claim
> > > > your trademark, especially if you haven't used it very long.
>
> > > > And in any event you have to hire your own lawyer to go after the
> > > > copycat, and if he's in another country things get dicey real
> > > > quickly.  (However, not vigorously defending your trademark against a
> > > > copycat causes you to lose any rights you do have very quickly.)
>
> > > > Do go to some effort (eg, preserve letters/invoices/etc) to establish
> > > > your "priority" on the name, so that a year from now the other guy
> > > > can't come along and sue YOU for trademark infringement.
>
> > > > (And it's probably worth the effort to send the other guy a cease-and-
> > > > desist letter.  Probably would do no good, but it's cheap.)
>
> > > > I suppose if someone duplicates a name in the Android store then you
> > > > may have some recourse with store management, but it would be purely
> > > > at their discretion, especially given how hard it is to find a unique
> > > > name anymore.
>
> > > > (I wonder how many here even know how to copyright their work?)
>
> > > > On Sep 14, 12:41 pm, Flying Coder  wrote:
>
> > > > > Surely, this can't be allowed, can it?  What recourse do I have?
>
> > > > > Thanks,
> > > > > Steve

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

2010-09-15 Thread Xavier Ducrohet
On Wed, Sep 15, 2010 at 3:43 AM, Indicator Veritatis  wrote:
> Do I really have to explain something so elementary? "8" is not the
> same as "8.0.0" is not the same as "8(.0.0)". So yes, you did make it
> more confusing instead of less.

You are seriously confused indeed.

Tools r8 will ship with ADT 8.0.0. The version that comes after will
be Tools r9 with ADT 9.0.0, and then r10 and ADT 10.0.0, etc...
Since both are meant to work together, it seems to me like it's a
pretty straight forward versioning scheme. When we release r8 we will
clearly explain this new scheme so that users know what to expect.

I fail to see how it's more confusing that previous releases of r7
with ADT 0.9.8, r6 with ADT 0.9.7, etc... where the ADT version was
completely unrelated to the SDK tools revision number.

> For that matter, are they sharing the same version number, or the same
> API level? The version number is 2.2, the API level 8. Based on what
> you have said so far, it sounds like you are using the API level as
> the version number for the tools, which is not the same as making "all
> tools and plug-ins share the same version number".

What are you talking about? Tools don't have an API level, so there's
certainly none to share between the SDK Tools and ADT, and, obviously,
the API level for the platform has *nothing* to do with revision
number for the tools!

Yes they both use numbers, but that's about it. I'm not sure how
anything I've said brought you to this conclusion.

As a reminder, we shipped Tools r6 coincidentally at the same time as
Froyo (2.2/API 8), and r7 alone just last week. Yes, the next version
will be r8 which happens to be the same number as the API level for
2.2 but I fail to see how that's related.

Talk about something elementary...

Xav
-- 
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.

Please do not send me questions directly. 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: trigonometry

2010-09-15 Thread Robert Green
Kostya - My mistake.  My example was for Math.atan.  atan2 just does
the divide for you.  Either will work.

On Sep 15, 11:50 am, Kostya Vasilyev  wrote:
>   Um, no.
>
> Math.atan2 takes two values, not one.
>
> Math.atan2(y2 - y1, x2 - x1)
>
> This gives correct result even for x2 and x1 being very close to each
> other. Depending on the sign of y2 - y1 that's either "up" or "down".
>
> -- Kostya
>
> 15.09.2010 20:45, Robert Green пишет:
>
>
>
>
>
> > Kostya hit it:
>
> > float angleDegrees = Math.toDegrees(Math.atan2((y1 - y2) / (x1 -
> > x2)));
>
> > On Sep 15, 11:32 am, Kostya Vasilyev  wrote:
> >>    Pedro,
>
> >> Java (and pretty much any language's) trig functions work with angles
> >> expressed in radians.
>
> >>http://en.wikipedia.org/wiki/Radian
>
> >> To convert to degrees, multiply by 180 / 3,1415926 (in Java, that's
> >> Math.PI). Or just call Math.toDegrees.
>
> >> Better yet - use Math.atan2 ( difference along Y, different along X).
> >> This one correctly handles the case of value3-value4 being zero (or very
> >> close thereof).
>
> >> -- Kostya
>
> >> 15.09.2010 20:22, Pedro Teixeira пишет:
>
> >>> Hi,
> >>> I'm having problems with JAva and trigonometry to calculate a
> >>> direction from a point to a certain point...
> >>> I want to translate this equation to Java-wise:
> >>> tg^-1 = |value1-value2| / |value3-value4|
> >>> And I'd like the result in degrees.. how can I do this? any ideia?
> >> --
> >> Kostya Vasilyev -- WiFi Manager + pretty widget 
> >> --http://kmansoft.wordpress.com
>
> --
> 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


Re: [android-developers] Sharing a stream object between activities of a tab view

2010-09-15 Thread Mark Murphy
Don't use activities as the contents of your tabs. Use views as the
contents of your tabs. Then, everything is in one activity, and
sharing your socket isn't an issue. This also takes up less RAM, less
stack space, and less CPU.

Or, consider having a Service manage your socket connection.

On Wed, Sep 15, 2010 at 2:07 PM, mastergap  wrote:
> Hi, i want to share streams of a socket connection between the
> activities of a tab view. In particular the tab activity creates the
> socket and gets the i/o streams,so i want that tabbed activities use
> these streams to retrieve informations without reconnect to the server
> each time i switch from a tab to another. I know i can use the
> application class to have a global state, but i don't know how. Can
> you give me sole tips about this, or post some code snippets, or
> suggest to me some other solutions? Thanks a lot.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



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

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Cant seem to get resources to select with layouts for different densities

2010-09-15 Thread Mark Murphy
On Wed, Sep 15, 2010 at 1:42 PM, niko20  wrote:
> It also would have been more useful if Android would have allowed
> percentage size entries like HTML does, so you could say "80%" width -

It does. Use LinearLayout with android:layout_weight="80". Just make sure that:

-- everything in that layout has their weights sum to 100
-- it works best if everything in that layout (horizontal or vertical)
has their dimension (width or height) set to 0px

> that way the layout would always come out correct on larger screen
> differences

Oh, I wouldn't say that. It may be mathematically correct, but UX
isn't all about math.

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

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


[android-developers] Sharing a stream object between activities of a tab view

2010-09-15 Thread mastergap
Hi, i want to share streams of a socket connection between the
activities of a tab view. In particular the tab activity creates the
socket and gets the i/o streams,so i want that tabbed activities use
these streams to retrieve informations without reconnect to the server
each time i switch from a tab to another. I know i can use the
application class to have a global state, but i don't know how. Can
you give me sole tips about this, or post some code snippets, or
suggest to me some other solutions? Thanks a lot.

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


[android-developers] Re: Track the moment when an activity is actually visible

2010-09-15 Thread avigadl
Apperently not enough :)

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


Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
Hey TreKing,

If you dont mind, just refer this code.
You exactly got what is going on here. I am new in Android so I dont know
what is stack trace and log? How to check stack trace?

So here is my code.

public class ShowLocation extends MapActivity {
private EditText lat;
private EditText lng;
 GeoPoint gp=null;
 MapController  mapcontroller;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Button btn = (Button)findViewById(R.id.btnShow);
lat = (EditText)findViewById(R.id.lat);
lng = (EditText)findViewById(R.id.lng);

MapView mapView = (MapView)findViewById(R.id.myGMap);

mapcontroller = mapView.getController();

//gp = new GeoPoint(lat.intValue(), lng.intValue());
mapView.setSatellite(true);
mapView.setTraffic(true);
mapView.setStreetView(true);
mapView.displayZoomControls(true);
mapView.setBuiltInZoomControls(true);

//mapcontroller.animateTo(gp);
mapcontroller.setZoom(2);
LocationManager locationManager;
String context = Context.LOCATION_SERVICE;
locationManager = (LocationManager)getSystemService(context);

Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setAltitudeRequired(true);
criteria.setBearingRequired(false);
criteria.setCostAllowed(true);
criteria.setPowerRequirement(Criteria.POWER_HIGH);
String provider = locationManager.getBestProvider(criteria, true);

 Location location = locationManager.getLastKnownLocation(provider);

btn.setOnClickListener(new View.OnClickListener() {
 @Override
public void onClick(View v) {
// TODO Auto-generated method stub
String _lat = lat.getText().toString();
String _lng = lng.getText().toString();
Uri uri = Uri.parse("geo:"+_lat+","+_lng);
 startActivity(new Intent(Intent.ACTION_VIEW, uri));
//mapcontroller.animateTo(gp);
mapcontroller.setZoom(2);
}
});
String _lat,_lng;
MapOverlay mylocationoverlay = new MapOverlay();
List list = mapView.getOverlays();
list.add(mylocationoverlay);
}
 protected class MapOverlay extends com.google.android.maps.Overlay{
 public boolean draw(Canvas canvas, MapView myGMap, boolean shadow, long
when){
Paint paint = new Paint();
//mapcontroller.animateTo(gp);
super.draw(canvas, myGMap, shadow);
 Point myScreenCoords = new Point();
//mapview.getProjection().toPixels(gp, myScreenCoords);
//paint.setARGB(255, 255, 255, 255);
Drawable marker = getResources().getDrawable(R.drawable.marker);
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.marker);
canvas.drawBitmap(bitmap, myScreenCoords.x, myScreenCoords.y, paint);
canvas.drawText("Location is at here..", myScreenCoords.x, myScreenCoords.y,
paint);
return true;
}
}
 @Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}

~Dhr


On Wed, Sep 15, 2010 at 11:17 PM, TreKing  wrote:

> On Wed, Sep 15, 2010 at 12:42 PM, Dhrumil Shah wrote:
>
>> You can change this at any time.
>> - Ya, i know that thing, but its not working in my this application.
>>
>
> "It's not working" is not useful information.
>
>
>> Or you can animate or snap to the exact location.
>> - I used this method but it generates and force close error on my
>> emulator.
>>
>
> Did you check the stack trace?
>
>
>> Why not?
>> -I dont know why not. I try to debug it but it gives me nothing.
>>
>
> Nothing? No logs, no stack trace?
>
>
> -
> 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
>

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

[android-developers] Re: Replica Island - code inspection

2010-09-15 Thread avigadl
Yep.

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

2010-09-15 Thread Frank Weiss
I suppose another solution would be to use separate ItemizedOverlays.

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

2010-09-15 Thread Kostya Vasilyev
 Looking at the description, CopyOnWriteArrayList does not provide 
predicate-based filtering.


I was thinking something like:

interface BooleanPredicate {
public boolean check(E o);
}

class CollectionOps {

List copyMatchingPredicate(List list, BooleanPredicate predicate) {
for all objects in the list
if (predicate.check(object)) {
copy object to resulting list
}
}

Then one could do this:

List sourceList = ;
List resultList = 
CollectionOps.copyMatchingPredicate(sourceList, new 
BooleanPredicate() {

@Override
public boolean check(Overlay overlay) {
return ! (overlay instanceof UserOverlay);
}
});

-- Kostya

15.09.2010 21:40, Kumar Bibek пишет:

There's a class that does this.
CopyOnWriteArrayList

-Kumar Bibek
http://techdroid.kbeanie.com

On Sep 15, 9:56 pm, Kostya Vasilyev  wrote:

> I'm actually surprised that Java Collections doesn't have a copy
>  methods that takes a predicate.
>
>  C++ STL has this: remove_copy_if
>
>  -- Kostya



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


Re: [android-developers] Find the location in Android Map

2010-09-15 Thread TreKing
On Wed, Sep 15, 2010 at 12:42 PM, Dhrumil Shah wrote:

> You can change this at any time.
> - Ya, i know that thing, but its not working in my this application.
>

"It's not working" is not useful information.


> Or you can animate or snap to the exact location.
> - I used this method but it generates and force close error on my emulator.
>

Did you check the stack trace?


> Why not?
> -I dont know why not. I try to debug it but it gives me nothing.
>

Nothing? No logs, no stack trace?

-
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: Another developer has published an app using the EXACT same name as mine

2010-09-15 Thread Flying Coder

@Dan:  thanks for the advice and link -- I will check it out.

@Martin: thanks for the feedback.  It is very frustrating the Market
allows this issue to crop up.  At one time at least, I believe it did
require apps to have unique names.  btw, I still owe you that write-up
-- sorry, I've side-tracked with other things lately.

@Metal Mikey:  Thanks for the support!

@JP: thanks, I will look into the DMCA takedown notice.

All the best,
Steve

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


[android-developers] Re: Cant seem to get resources to select with layouts for different densities

2010-09-15 Thread niko20
It also would have been more useful if Android would have allowed
percentage size entries like HTML does, so you could say "80%" width -
that way the layout would always come out correct on larger screen
differences

-niko

On Sep 15, 5:13 am, niko20  wrote:
> Ok - one more question
>
> In my project I set the layout UI designer to "Nexus One". This
> allowed me to create a layout based on a long screen such as a Nexus
> one.
>
> However, even with that, when I run it on a WVGA845 it still doesn't
> look right since the screen is still 85 pixels wider than a Nexus one!
>
> I guess I need to switch to all Relative Layouts or something - but I
> still dont see how you can ever get a layout that isn't going to look
> funky on different screen dimensions.
>
> -niko
>
> On Sep 15, 4:54 am, niko20  wrote:
>
>
>
> > I switched to using
>
> > layout-normal-long
>
> > and this works now.
>
> > However, the documentation indicates that the other should work too,
> > it's not clear - but your explanation does make sense to me I think.
> > Thanks for the help Dianne.
>
> > -niko
>
> > On Sep 15, 2:14 am, Dianne Hackborn  wrote:
>
> > > I don't know exactly what is going on here, but I would *strongly* suggest
> > > that if you are trying to do different layouts based on screen density 
> > > then
> > > you are doing things wrong.
>
> > > The only thing density impacts is UI scaling; that is taken care of in a
> > > layout with the "dp" units if you need to specify dimensions.  It 
> > > otherwise
> > > has no impact on layout, and should not cause your layout to change.
>
> > > Note as per the spec for resource resolution, density configurations are
> > > matched in a somewhat special way, since the platform assumes it can pick
> > > any density resource and scale it to match the real device density.
> > >  Obviously this doesn't make a lot of sense for layouts, so it is 
> > > something
> > > you should avoid.
>
> > > On Tue, Sep 14, 2010 at 8:36 PM, niko20  wrote:
> > > > I also tried to change my targetSdk value to "7" and it made no
> > > > difference, without a root "layout" default layout.xml file, the app
> > > > crashes - it doesn't load the layout-normal-hdpi layout.xml file for
> > > > some reason.
>
> > > > How frustrating this layout stuff is!
>
> > > > -niko
>
> > > > On Sep 14, 10:12 pm, niko20  wrote:
> > > > > Just wanted to give a bit more info
>
> > > > > I also have a layout.xml file in the default "layout" directory.
>
> > > > > In my code the main activity uses this line:
>
> > > > > setContentView(R.layout.main);
>
> > > > > If I delete the layout.xml from the default layout directory I get a
> > > > > force close on startup.
>
> > > > > So does this line of code interfere with android's layout loading or
> > > > > something , overriding it?
>
> > > > > -niko
>
> > > > > On Sep 14, 9:40 pm, niko20  wrote:
>
> > > > > > Hi,
>
> > > > > > I'm trying to understand the layout engine for different screen 
> > > > > > sizes
> > > > > > and densities, to look into adding support for tablets in my apps.
>
> > > > > > I was under the impression that you could also have different 
> > > > > > layouts
> > > > > > based on screen density as well in android, and it would select the
> > > > > > appropriate one.
>
> > > > > > I have the following:
>
> > > > > > a layout-normal-mdpi directory with a layout.xml file.
> > > > > > a layout-normal-hdpi directory with a layout xml file with a 
> > > > > > different
> > > > > > layout for high density screens.
>
> > > > > > In my application manifest I have min SDK as 3,  target SDK as 5. I
> > > > > > have a supports-screens element and declare the following:
>
> > > > > > android:largeScreens="true" android:anyDensity="true"
>
> > > > > > I'm compiling against Android 2.2 library.
>
> > > > > > However, when I run an AVD that is in WVGA854 mode with a 
> > > > > > lcd.density
> > > > > > of 240, android isn't using my hdpi layout, it still uses my mdpi
> > > > > > layout. I don't know why and need help!
>
> > > > > > Thanks!
>
> > > > > > -niko
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscr...@googlegroups.com > > >  cr...@googlegroups.com>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > hack...@android.com
>
> > > Note: please don't send private questions to me, as I don't have time to
> > > provide private support, and so won't reply to such e-mails.  All such
> > > questions should be posted on public forums, where I and others can see 
> > > and
> > > answer them.

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

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
You can change this at any time.
- Ya, i know that thing, but its not working in my this application.

Or you can animate or snap to the exact location.
- I used this method but it generates and force close error on my emulator.

Why not?
-I dont know why not. I try to debug it but it gives me nothing.

~Dhr

On Wed, Sep 15, 2010 at 10:46 PM, TreKing  wrote:

> On Wed, Sep 15, 2010 at 12:14 PM, Dhrumil Shah wrote:
>
>> The problem is that zoom of the map is maximum
>
>
> You can change this at any time.
>
>
>> every time I have to zoom out the map to show the exact location.
>
>
> Or you can animate or snap to the exact location.
>
>
>> And I am not able to put marker on that location.
>
>
> Why not?
>
>
>
> -
> 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
>

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

[android-developers] Re: Playing with List

2010-09-15 Thread Kumar Bibek
There's a class that does this.
CopyOnWriteArrayList

-Kumar Bibek
http://techdroid.kbeanie.com

On Sep 15, 9:56 pm, Kostya Vasilyev  wrote:
>   I'm actually surprised that Java Collections doesn't have a copy
> methods that takes a predicate.
>
> C++ STL has this: remove_copy_if
>
> -- Kostya
>
> 15.09.2010 20:34, Pedro Teixeira пишет:
>
>
>
> > Worked like a charm Kostya :
>
> > Thank you !!! I've used the iterator but didn't thought about
> > ''instanceof'', it was erasing everything. Now it's perfect.
>
> > Thank you very much :D
>
> > Pedro
>
> > On Sep 15, 2010, at 5:24 PM, Kostya Vasilyev wrote:
>
> >> Pedro,
>
> >> I believe list.remove(object item) removes the first element has is
> >> equal() to the one passed in.
>
> >> To remove items by some other criteria (such as actual class), you've
> >> got to iterate the list.
>
> >> Note that removing elements while iterating has to be done by calling
> >> remove() on the iterator. Calling remove() on the collection itself
> >> while iterating is not supported, and throws an exception that says
> >> as much.
>
> >> List list = mapView.getOverlays();
>
> >> for (Iterator ite = list.iterator(); ite.hasNext(); )
> >> {
> >> Overlay ov = ite.next();
> >> if (ov instanceof UserOverlay) {
> >> ite.remove();
> >> }
> >> }
>
> >> Hope this helps.
>
> >> -- Kostya
>
> >> 15.09.2010 20:06, Pedro Teixeira пишет:
> >>> Hi,
>
> >>> I have an overlay list which I retrieve it like this:
>
> >>> List  overlays = mapView.getOverlays();
>
> >>> So in this list I have elements of the type userOverlay and
> >>> picOverlay..
> >>> How can I do to erase ALL occurences of userOverlay but leave all the
> >>> others?
> >>> I've been playing around with the List methods but I can't make it
> >>> work, I've tried:
>
> >>>           while(overlays.contains(userOverlay)==true){
> >>>                   overlays.remove(userOverlay);
> >>>           }
>
> >>> Which made sense to me.. but it doesn't work..
> >>> any suggestions?
>
> >> --
> >> 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
>
> > Pedro Teixeira
>
> >www.pedroteixeira.org
>
> --
> 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: Upgrade non-market app with a new market version.

2010-09-15 Thread psyke
Hello,

Unless market or non-market apps are installed by diferent ways, i
think that is possible to update the non-market app using new market
version .
The question of pirated software is not valid because if you have non
market app "pirated" to upgrade you should publish you app on Market.
Two things can happen you probably will be catched :) or you will
publish a clean app to be possible to update.

Thank you for your feedback.

BR


Thanks for information i am also check in other (non ofitial fonts)
and the feedback is yes

On 15 Set, 18:03, TreKing  wrote:
> On Wed, Sep 15, 2010 at 11:59 AM, Zsolt Vasvari  wrote:
> > If that's not the case, that means that whoever pirates an app can get
> > updates to that app on the Market?
>
> Oh, no, not for paid apps. That still has to go through payment verification
> which should fail if the app was not paid for by the user. A free app should
> work fine though.
>
> DISCLAIMER - This is based on some observations, discussions on these
> groups, and some assumptions. So yeah.
>
> -
> 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: Login with database..!

2010-09-15 Thread DanH
What TreKing is so elegantly stating is that you haven't explained
your problem very well.

Checking a "login credential" with a database is presumably a matter
of referencing the database to extract the stored password and
comparing that to the one just entered by the user.  Nothing super-
duper complex or special about it (though this technique is not
especially secure).  If this is what you don't know how to do then you
need to do some basic self-education on database, etc.

If you have something else in mind you need to explain yourself
better.

On Sep 15, 12:20 am, Gold  wrote:
> Hi. All,
>
>                I need to check to user login credential with database
> login credential.. how i will achieve this. Eagerly waiting for the
> reply..!
>
> Thanks in advance,
> Gold

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


[android-developers] Re: Loading XML data to array “gives up” if XML is too big

2010-09-15 Thread DanH
Unfortunately the Java file I/O stuff is pretty obscure, but what you
need to do is pretty simple:  Open the raw file (openRawResource) and
then read lines from the resulting InputStream.  Of course, reading
lines from an input stream has been made stupidly complex by the Java
JDK designers, so you have to use something like this:

  BufferedReader reader = new BufferedReader(new
InputStreamReader(inputStream, "UTF-8"));
  int i = 0;
  while ((line = reader.readLine()) != null) {
 TEAM_SCORES[i++] = line;
   }

This of course is ignoring exception stuff, and assumes you know the
array size in advance.  If you don't know the array size you'd use an
ArrayList or some such and convert to an array after all is read.

(Obviously, with this scheme the file is just a list of your data
records, one per carriage-return-terminated line, with no XML markup
and no quotes.)

On Sep 15, 9:11 am, nextgen  wrote:
> Correct, I'm using Resources.getStringArray (shown above).
>
> Also, I've not yet learned how to do data any other way than XML
> bundled in the app -- it is on my list to learn not only straight text
> files, as you suggest, but also using a database, or especially
> putting this out on the internet somewhere and not bundling with the
> app, as Frank suggests.
>
> So I have a workaround for now, but I will pursue these more-permanent
> solutions next.  It's not easy learning Android and Java from scratch
> while trying to produce apps under a time constraint, but I'm trying
> my best.  I very much appreciate you taking the time to reply.
>
> On Sep 14, 10:44 pm, DanH  wrote:
>
> > I'm assuming you use Resources.getStringArray to read the array?

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

2010-09-15 Thread TreKing
On Wed, Sep 15, 2010 at 12:14 PM, Dhrumil Shah wrote:

> The problem is that zoom of the map is maximum


You can change this at any time.


> every time I have to zoom out the map to show the exact location.


Or you can animate or snap to the exact location.


> And I am not able to put marker on that location.


Why not?

-
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

  1   2   3   >