[android-developers] Android Picasa Image Uploader

2012-05-21 Thread Lex Luthor
Hi, I am looking samples to upload a selected picture from my device
to Picasa Album. Is there any way?
I tried this snippet:
   Intent temp = new Intent(Intent.ACTION_SEND);
   temp.setType(image/png);
   temp.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
   temp.putExtra(Intent.EXTRA_STREAM, fileUri);
   temp.setComponent(new ComponentName(
   com.google.android.apps.uploader,
 
com.google.android.apps.uploader.clients.picasa.PicasaSettingsActivity));
   try {
   startActivity(temp);
   } catch (android.content.ActivityNotFoundException ex)
{
   Log.d(TAG, Errore upload Picasa);
   }
which works, but in this way I can't insert a comment (only a legendy
that will be displayed above the pic), while to insert a comment I
have to do it manually from browser (after upload).
I'd like to know if there's a way to get the image URL after uploading
it.

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


[android-developers] Re: Proguard problem after 2.3 update

2011-02-08 Thread LeX
Hi Roshan,

I use linux, and the adding to tools/lib did not help :(
maybe the add-proguard-release.xml should be updated in some way (due
to interface change?!?) ?


On 8 Feb., 07:44, roshan vidapanakal roshanrani2...@gmail.com wrote:
 Add this file in the android-sdk-windows\tools\lib  path. It will be solved
 i too had the same prob before i solved it by adding



 On Tue, Feb 8, 2011 at 12:00 PM, LeX fink.ale...@googlemail.com wrote:
  Hi folks,

  same problem here after update:

   add-proguard-release.xml:35: Expecting class path separator ':'
  before '{' in argument number 1

  android-tools r9, target: android-8

  Does anyone have a solution?!?

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

 --
 Regards,
 Roshan

  proguard.cfg
 1KAnzeigenHerunterladen

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


[android-developers] Re: Proguard problem after 2.3 update

2011-02-08 Thread LeX
Fount the solution, that worked for me:

adding
  external.libs.dir=libs
to
  default.properties

finally...
found at 
http://stackoverflow.com/questions/4356979/proguard-error-expecting-class-path-seperator-not-sure-where-i-need-to-put-a-p


On 8 Feb., 07:30, LeX fink.ale...@googlemail.com wrote:
 Hi folks,

 same problem here after update:

   add-proguard-release.xml:35: Expecting class path separator ':'
 before '{' in argument number 1

 android-tools r9, target: android-8

 Does anyone have a solution?!?

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


[android-developers] Re: Proguard problem after 2.3 update

2011-02-07 Thread LeX
Hi folks,

same problem here after update:

  add-proguard-release.xml:35: Expecting class path separator ':'
before '{' in argument number 1

android-tools r9, target: android-8

Does anyone have a solution?!?

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


[android-developers] Re: Proguard problem after 2.3 update

2011-02-07 Thread LeX
Hi folks,

same problem here after update:

  add-proguard-release.xml:35: Expecting class path separator ':'
before '{' in argument number 1

android-tools r9, target: android-8

Does anyone have a solution?!?

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


[android-developers] NFC : detect TAG once inside the application

2011-01-18 Thread Lex
OK here is my problem.

I created an application where I need to detect TAGs. So I created an
activity and I registered an intent receiver to it :

activity android:name=LoadTagActivity android:theme=@android:style/
Theme.Dialog 
intent-filter
action
android:name=android.nfc.action.TAG_DISCOVERED/
category
android:name=android.intent.category.DEFAULT/
/intent-filter
/activity


It works perfectly.

Now the thing is. Once I detect the tag it goes in my application. But
once I'm in the application I can't detect tags anymore. The intent
TAG_DISCOVERED seems to be correctly broadcasted but my activity
doesnt seem to pick it up. ( And yes the Activity has previously been
destroyed correctly ).

Anyone can help me ? or is just normal behaviour ?

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


[android-developers] Re: Market not updating?

2010-12-10 Thread LeX
 But hey as Google always says, it's free, so be happy you can at least
 post your apps :D

That is not true. It is not free: it costs 30% from your application
sellings...

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


[android-developers] where comes --custom-target while building market_licensing

2010-10-14 Thread LeX
Hello,

I would like to add the option --custom-package for the generate
resources step of my application as it happens while the
market_licensing library is build:

 [null] ...
 [null] Executing '/usr/local/android-sdk-linux/platforms/
android-8/tools/aapt' with arguments:
 [null] 'package'
 [null] '-f'
 [null] '-m'
 [null] '--custom-package'
 [null] 'com.android.vending.licensing'
 [null] ...

how can it be done with less pain?
(like adding custom.package=my.pkg.name in build.properties)


And btw. is there a human friendly alternative to Ant / xml-hell,
which can be used together with android?

regards,
Alexej

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


[android-developers] setting mapView to R.id.mapview throws ClassCastException

2009-09-22 Thread Lex

...I really don't understand how something this simple (and I have
done it before) doesn't work. I'm pretty sure it will turn out that I
am missing something obvious.

I just created a MapView, all it does is show the map and when I
allocate mapView to it's layout, there's a ClassCastException:

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

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



public class PPMMap extends MapActivity {

public MapView mapView;

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

mapView =  (MapView) findViewById(R.id.mapview); // THROWS
CLASSCASTEXCEPTION
mapView.setBuiltInZoomControls(true);


}

@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}

}

?xml version=1.0 encoding=utf-8?

RelativeLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:id=@+id/mapview
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent 

 com.google.android.maps.MapView
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:apiKey=
 /

/RelativeLayout

09-22 17:16:03.676: ERROR/AndroidRuntime(730):
java.lang.RuntimeException: Unable to start activity ComponentInfo
{patyo.PPMMap}: java.lang.ClassCastException:
android.widget.RelativeLayout
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2268)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2284)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
android.os.Looper.loop(Looper.java:123)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
android.app.ActivityThread.main(ActivityThread.java:3948)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
java.lang.reflect.Method.invokeNative(Native Method)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
java.lang.reflect.Method.invoke(Method.java:521)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:782)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
dalvik.system.NativeStart.main(Native Method)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): Caused by:
java.lang.ClassCastException: android.widget.RelativeLayout
09-22 17:16:03.676: ERROR/AndroidRuntime(730):
at PPMMap.onCreate(PPMMap.java:21)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1123)
09-22 17:16:03.676: ERROR/AndroidRuntime(730): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2231)

Call me an idiot, but I just don't get it.


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



[android-developers] Is it possible to add custom menu items in the native Contact list ?

2009-08-28 Thread Lex

Hi everyone,

Is it possible to add custom menu items in the native Contact list ?

I mean when the user selects a user from his contact list, is it
possible to add a custom action there ? ( for those who are familiar
with Blackberry development, something similar to the MenuItem class )

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



[android-developers] Re: Overlay ConcurrentModificationException (continued)

2009-08-28 Thread Lex

Zsolt,

the methods are defined as follows:

- receiveMessage() - Service Class
- showTrafficMessages() - Activity Class
- updateOverlay - ItemizedOverlay Class

The receiveMessage() method is called in the run method of the
receiving thread object. I see now that other methods are then
executed in the receiving thread (due to callback) as well.

I will check out the Handler and get back to you later. Thanks a lot
for your advice!

Lex



On Aug 27, 6:40 pm, Zod zsolt.ba...@gmail.com wrote:
 Hi!

 It's not clear where your code is located and called. If it's in the
 thread which receives the messages, than you're modifying UI elements
 from another thread which is really bad.

 If your code is in the activity object, and you call it directly from
 the network thread, than you also execute code in a thread which is
 not the UI thread (very bad again), and therefore if the Overlay is
 currently drawn and at that moment you receive a new message you will
 try to modify a List while it is accessed by another thread (the UI).

 There is already a facility in the android api which can help you put
 your data into the UI thread in a safe way.

 See:http://developer.android.com/reference/android/os/Handler.html

 Heres a simple example using Handler.post()

 In you activity where your UI components are. Create a Handler object,
 (eg: mHandler = new Handler())

 Pass this mHandler object to your network thread. When your network
 thread receives a message use this handler to send a Runnable object
 to be executed in the UI thread. Eg:

 receiveMessage(String msg) {
     // send a runnable to execution in the thread which created the
 handler
     mHandler.post(new Runnable() { // implement the Runnable interface
             public void run() {
                 activity.updateUI();  // - what to call in the
 handler thread.
             }
         });

 }

 If your thread is implemented as an inner class of your activity, you
 can call the necessary method directly in the Runnable.run method.

 I hope this helps.

    Zsolt.

 On Aug 27, 12:41 pm, Lex hakkinen1...@gmail.com wrote:

  This post is in addition 
  to:http://groups.google.com/group/android-developers/browse_thread/threa...

  I have exactly the same problem and Doug pinpointed what's probably
  the issue in my case exactly:

  So here's the deal: I have a Vector containing traffic messages
  (received from a server via UDP in an own thread). Each time a message
  is received, I create a new overlay object and populate it with the
  traffic messages:

  public void receiveMessage(BinaryMessage binaryMsg) {

                  
               TrafficMessage message = createMessage(binaryMsg);
               // adds message to vector
               addTrafficMessage(message,
  CoCarMapView.trafficMessages);
               CoCarMapView.showTrafficMessages();
                                  

  }

  public static void showTrafficMessages() {
                  ListOverlay overlays = mapView.getOverlays();
                  if (overlays.size()  1) {
                          overlays.remove(1);
                  }
                  Drawable warningIcon = context.getResources().getDrawable
  (R.drawable.sign_warning_small);
                  CoCarItemizedOverlay trafficEventsOverlay = new 
  CoCarItemizedOverlay
  (warningIcon);

                  // the overlay is populated here
                  trafficEventsOverlay.updateOverlay(trafficMessages);

                  mapView.getOverlays().add(trafficEventsOverlay);
                  mapView.postInvalidate();

  }

  public void updateOverlay(VectorTrafficMessage messages) {
                  for(int i=0; i  messages.size(); i++) {

                          TrafficMessage message = messages.elementAt(i);
                          Drawable messageIcon = getMessageIcon(message);
                          GeoPoint point = getGeoPoint(message);
                          OverlayItem messageItem = createItem(messageIcon, 
  point);
                          this.addItem(messageItem);

                  }

  }

  I don't understand yet exactly where the error is caused, that is
  where to start improving stuff...

  Thanks for your advice,

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



[android-developers] Re: Overlay ConcurrentModificationException (continued)

2009-08-28 Thread Lex

So, this is what I have now:

public void receiveMessage(BinaryMessage binaryMsg) {


...
if ( validateMessage(binaryMsg) ) {
final TrafficMessage message = 
createMessage(binaryMsg);

Log.i( CoCarMapView.TAG, traffic 
messages vector size:  + new
Integer(CoCarMapView.trafficMessages.size()).toString() );
// update the UI - show the messages
/* the traffic container and the UI 
update should be
 * executed from the UI and not from 
the receiving
 * thread, therefore a handler is used 
to return
 * these operations to the UI thread
 */
handler.post(new Runnable() {
public void run() {


addTrafficMessage(message, CoCarMapView.trafficMessages);

CoCarMapView.showTrafficMessages();
}
});


}

}

} // end of method

I assumed I had to put addTrafficMessage inside the handler thread, as
the collection is modified here. The exception is gone!

Thanks,

Lex

On Aug 28, 10:12 am, Lex hakkinen1...@gmail.com wrote:
 Zsolt,

 the methods are defined as follows:

 - receiveMessage() - Service Class
 - showTrafficMessages() - Activity Class
 - updateOverlay - ItemizedOverlay Class

 The receiveMessage() method is called in the run method of the
 receiving thread object. I see now that other methods are then
 executed in the receiving thread (due to callback) as well.

 I will check out the Handler and get back to you later. Thanks a lot
 for your advice!

 Lex

 On Aug 27, 6:40 pm, Zod zsolt.ba...@gmail.com wrote:

  Hi!

  It's not clear where your code is located and called. If it's in the
  thread which receives the messages, than you're modifying UI elements
  from another thread which is really bad.

  If your code is in the activity object, and you call it directly from
  the network thread, than you also execute code in a thread which is
  not the UI thread (very bad again), and therefore if the Overlay is
  currently drawn and at that moment you receive a new message you will
  try to modify a List while it is accessed by another thread (the UI).

  There is already a facility in the android api which can help you put
  your data into the UI thread in a safe way.

  See:http://developer.android.com/reference/android/os/Handler.html

  Heres a simple example using Handler.post()

  In you activity where your UI components are. Create a Handler object,
  (eg: mHandler = new Handler())

  Pass this mHandler object to your network thread. When your network
  thread receives a message use this handler to send a Runnable object
  to be executed in the UI thread. Eg:

  receiveMessage(String msg) {
      // send a runnable to execution in the thread which created the
  handler
      mHandler.post(new Runnable() { // implement the Runnable interface
              public void run() {
                  activity.updateUI();  // - what to call in the
  handler thread.
              }
          });

  }

  If your thread is implemented as an inner class of your activity, you
  can call the necessary method directly in the Runnable.run method.

  I hope this helps.

     Zsolt.

  On Aug 27, 12:41 pm, Lex hakkinen1...@gmail.com wrote:

   This post is in addition 
   to:http://groups.google.com/group/android-developers/browse_thread/threa...

   I have exactly the same problem and Doug pinpointed what's probably
   the issue in my case exactly:

   So here's the deal: I have a Vector containing traffic messages
   (received from a server via UDP in an own thread). Each time a message
   is received, I create a new overlay object and populate it with the
   traffic messages:

   public void receiveMessage(BinaryMessage binaryMsg) {

                   
                TrafficMessage message = createMessage(binaryMsg);
                // adds message to vector
                addTrafficMessage(message,
   CoCarMapView.trafficMessages);
                CoCarMapView.showTrafficMessages();
                                   

   }

   public static void showTrafficMessages() {
                   ListOverlay overlays = mapView.getOverlays();
                   if (overlays.size()  1) {
                           overlays.remove(1);
                   }
                   Drawable warningIcon = context.getResources().getDrawable
   (R.drawable.sign_warning_small);
                   CoCarItemizedOverlay

[android-developers] Overlay ConcurrentModificationException (continued)

2009-08-27 Thread Lex

This post is in addition to:
http://groups.google.com/group/android-developers/browse_thread/thread/1459f065d3af1a5e

I have exactly the same problem and Doug pinpointed what's probably
the issue in my case exactly:

So here's the deal: I have a Vector containing traffic messages
(received from a server via UDP in an own thread). Each time a message
is received, I create a new overlay object and populate it with the
traffic messages:

public void receiveMessage(BinaryMessage binaryMsg) {


 TrafficMessage message = createMessage(binaryMsg);
 // adds message to vector
 addTrafficMessage(message,
CoCarMapView.trafficMessages);
 CoCarMapView.showTrafficMessages();

}

public static void showTrafficMessages() {
ListOverlay overlays = mapView.getOverlays();
if (overlays.size()  1) {
overlays.remove(1);
}
Drawable warningIcon = context.getResources().getDrawable
(R.drawable.sign_warning_small);
CoCarItemizedOverlay trafficEventsOverlay = new 
CoCarItemizedOverlay
(warningIcon);

// the overlay is populated here
trafficEventsOverlay.updateOverlay(trafficMessages);

mapView.getOverlays().add(trafficEventsOverlay);
mapView.postInvalidate();
}

public void updateOverlay(VectorTrafficMessage messages) {
for(int i=0; i  messages.size(); i++) {

TrafficMessage message = messages.elementAt(i);
Drawable messageIcon = getMessageIcon(message);
GeoPoint point = getGeoPoint(message);
OverlayItem messageItem = createItem(messageIcon, 
point);
this.addItem(messageItem);

}
}


I don't understand yet exactly where the error is caused, that is
where to start improving stuff...

Thanks for your advice,

Lex

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



[android-developers] MenuItem ID

2009-08-26 Thread Lex

Hi everyone,

I have a simple menu with 2 options:

menu xmlns:android=http://schemas.android.com/apk/res/android;
item android:id=@+id/congestion
  android:title=congestion event
  android:icon=@drawable/sign_congestion_small /


item android:id=@+id/warning
  android:title=warning event
  android:icon=@drawable/sign_warning_small /
/menu

In onOptionItemSelected(), what do I need to compare item.getItemId()
to to figure out which item was selected? I am using getTitle for
niow, but I would prefer to use an id.

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



[android-developers] Re: How to handle complex objects from webservice.

2009-07-30 Thread Lex

How exactly are you receiving the data from the webservice (HTTP POST
method, TCP connection, UDP connection..)? If you are receiving your
complex object in parts, write a method that will process the input
and put the parts together to recreate your object.

Lex

On Jul 30, 2:52 pm, Ram ramgopalgo...@gmail.com wrote:
 Hi All,

 can anybody tell me how to handle a complex type object from
 webservice. Presently I am able to handle simple String messages. But
 if I am extracting some array of objects or String, then how to handle
 this.

 Waiting for quick reply.

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



[android-developers] Re: Threads for networking and DatagramSocket

2009-07-30 Thread Lex

Thank You for your advice, Roman. There's a detailed post about my
issue on the Java Sun Forum:
http://forums.sun.com/thread.jspa?messageID=10779608#10779608

Lex

On Jul 29, 5:06 pm, Roman roman.baumgaert...@t-mobile.com wrote:
 I recommend to keep your data communication separate from the UI. The
 UI should be responsive as possible and you don't want to have any
 blocking on this level. In general data connectivity is not
 predictable and in worse case you are waiting for a response from the
 network and blocking your whole UI. For example how would you
 interrupt your data communication from UI perspective when you handle
 data communication within the UI and your UI is blocked?

 --
 Roman Baumgaertner
 Sr. SW Engineer-OSDC
 ·T· · ·Mobile· stick together
 The views, opinions and statements in this email are those of the
 author solely in their individual capacity, and do not necessarily
 represent those of T-Mobile USA, Inc.

 On Jul 29, 3:42 am,Lexhakkinen1...@gmail.com wrote:

  My Android app is exchanging traffic messages viaUDPwith a server -
  binary messages of up to 60 Bytes. The server I'm using (external,
  don't have access to code nor can I convince the developer to change
  stuff :( ) is identifying the clients solely through sockets (no other
  type of client ID whatsoever), so I need to use the same socket for
  receiving and sending. My initial plan was to use separate Threads for
  receiving and sending data. The network load depends on the traffic
  situation - sometimes there might be a lot of messages coming in,
  sometimes only a few. The client also needs to send periodic keep-
  alive messages, which are simple, 10 character strings. Now the
  problem is that Java's DatagramSocket.receive method() is synchronized
  and also blocking as long as there is data to receive, so my sending
  thread cannot use the socket for sending anything, which results in
  the server kicking off the client because there's no response coming.

  My question is, how bad (or not bad) do you think will rejecting the
  threads and doing all the networking as described above in the UI
  thread be? Of course, if you also have suggestions on how to overcome
  the issue, it will be greatly appreciated!

  Cordialement

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



[android-developers] Threads for networking and DatagramSocket

2009-07-29 Thread Lex

My Android app is exchanging traffic messages via UDP with a server -
binary messages of up to 60 Bytes. The server I'm using (external,
don't have access to code nor can I convince the developer to change
stuff :( ) is identifying the clients solely through sockets (no other
type of client ID whatsoever), so I need to use the same socket for
receiving and sending. My initial plan was to use separate Threads for
receiving and sending data. The network load depends on the traffic
situation - sometimes there might be a lot of messages coming in,
sometimes only a few. The client also needs to send periodic keep-
alive messages, which are simple, 10 character strings. Now the
problem is that Java's DatagramSocket.receive method() is synchronized
and also blocking as long as there is data to receive, so my sending
thread cannot use the socket for sending anything, which results in
the server kicking off the client because there's no response coming.

My question is, how bad (or not bad) do you think will rejecting the
threads and doing all the networking as described above in the UI
thread be? Of course, if you also have suggestions on how to overcome
the issue, it will be greatly appreciated!

Cordialement

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



[android-developers] Re: keeping screen on while activity active

2009-07-15 Thread Lex

OK now I'm only turning the flag on in the onCreate() and onResume()
methods. It works fine on the HTC Magic phone, but in the emulator,
after it starts and I don't do anything on the home screen it doesn't
go off at all. When I start my app it doesn't go off like required,
but when I return back to the home screen it doesn't go off neither.

I don't know if this issue is severe enough to be considered an
emulator bug?

Lex

On Jul 14, 9:28 pm, Dianne Hackborn hack...@android.com wrote:
 You don't even need to clear it.  This flag is associated with the window,
 and it will only keep the screen on while your window is displayed.  I
 really can't explain the behavior you say you are seeing, if your window is
 not displayed this flag simply will not keep the screen on.



 On Tue, Jul 14, 2009 at 12:21 PM, Lex hakkinen1...@gmail.com wrote:

  Hi,

  I have a map activity for which I would like to have the screen turned
  on as long it's active (the app consists of one activity only). When
  the activity is paused or stopped I want to return to normal on/off
  mode. Keeping the screen on works fine while the app is running but
  when I exit the app the screen stays on as well. What am I missing?

  public void onCreate(...) {

   getWindow().addFlags
  (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
   setContentView
  }

  public void onPause(...) {

   getWindow().cleaFlags
  (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }

  public void onResume(...) {

   getWindow().addFlags
  (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

  }

  public void onStop(...) {

   getWindow().cleaFlags
  (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }

 --
 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: Google route directions no turn by turn Legal License

2009-07-14 Thread Lex

I am only familiar with the general Maps/Earth API Terms of Use, which
can be found here:

http://code.google.com/apis/maps/terms.html

See if you can find anything there about your issue.

On Jul 13, 2:40 pm, -lm - kimb...@gmail.com wrote:
 Dear Android community,
 i've a license/legal question regarding asking Google directions to be
 drawn directly into the MapView.
 Some of you know that asking googlehttp://maps.google.com/maps/nav
 will give directions in Json + a Polyline encoded form.

 What i would like to know is, where is the Terms of Service regarding
 this functionality? It is for Google internal use or not?
 There's also the KML which gives similar informations.
 Please note that it is NOT for real time driving directions but a path
 to be drawn from a point to another and your position NOT refreshed in
 real time and of course it is for an app downloadable free of charge.

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



[android-developers] Re: Connect android emulator to internet

2009-07-14 Thread Lex

See Number 3:

http://developer.android.com/guide/tutorials/views/hello-mapview.html

On Jul 13, 1:28 pm, renjith mp renjith...@gmail.com wrote:
 Hi All,

 Please let me know how to connect to internet from android emulator.
 Here  the details of my development environment

 Eclipse:eclipse-SDK-3.4.2-win32
 Android:android-sdk-windows-1.1_r1
 Platform :Window vista.32 bit OS
 Internet:Broadband internet connection from some ISP.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Service won't stop when exiting application

2009-07-14 Thread Lex

Ooops that was a typo when I posted the message. ccClient and
cocarClient are supposed to be the same object. But I was indeed
passing something else.

In

public void onStop() {
super.onStop();
stopService(new Intent(this, cocarClient.getClass()));
}

cocarClient.getClass returnes ComponentName I think. I changed this
to


public void onStop() {
super.onStop();
stopService(new Intent(this, ClientService.getClass
()));
}

and it works fine! Thanks for the hint, Dianne!

On Jul 13, 6:15 pm, Dianne Hackborn hack...@android.com wrote:
 Are you sure you are stopping the same service?  You are passing something
 different in for the Intent component.  I would suggest defining one static
 Intent for the service, that is use for both start and stop.



 On Mon, Jul 13, 2009 at 3:07 AM, Lex hakkinen1...@gmail.com wrote:

  Hi everyone,

  this message is in addition to the posts at

 http://groups.google.com/group/android-developers/browse_thread/threa...

  I have a service receiving and sending data to a server in separate
  threads each. The service lifecycle methods look like this:

 @Override
 public void onCreate() {
 super.onCreate();
 receiver = new ReceiveThread(this);
 myMapView.trafficMessages = new VectorTrafficMessage();

 }

 @Override
 public void onStart(Intent intent, int startId) {
 super.onStart(intent, startId);
 receiver.start();
 }

 @Override
 public void onDestroy() {
 super.onDestroy();
 receiver.kill(); // sets a boolean in the while loop to
  false so
  that run() finishes
 heartbeat.kill(); // thread sending periodic messages to the
  server
  to keep the connection alive
 stopSelf();

  The activity lifecycle methods look like this:

  @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 TAG = getString(R.string.application_name);
 setContentView(R.layout.main);
 context = getApplicationContext();

 initMap();
 initLocationManager();
 ccClient = startService(new Intent(this,
  ClientService.class));
 }

 @Override
 public void onPause() {
 super.onPause();
 locManager.removeUpdates(locListener);
 }

 @Override
 public void onResume() {
 super.onResume();

   locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
  0, locListener);
 }

 @Override
 public void onStop() {
 super.onStop();
 stopService(new Intent(this, cocarClient.getClass()));
 }

  When I press the home button, the activity onStop() method is called
  but stopService() does not call the service onDestroy() method so the
  threads keep running in the background.
  Why doesn't the service shut down? What is the difference between the
  home and back button, what is activity-service lifecycle method call
  stack in these cases?

 --
 Dianne Hackborn
 AnOodroid 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] keeping screen on while activity active

2009-07-14 Thread Lex

Hi,

I have a map activity for which I would like to have the screen turned
on as long it's active (the app consists of one activity only). When
the activity is paused or stopped I want to return to normal on/off
mode. Keeping the screen on works fine while the app is running but
when I exit the app the screen stays on as well. What am I missing?

public void onCreate(...) {

  getWindow().addFlags
(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  setContentView
}


public void onPause(...) {

  getWindow().cleaFlags
(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}

public void onResume(...) {

  getWindow().addFlags
(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

}

public void onStop(...) {

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



[android-developers] Service won't stop when exiting application

2009-07-13 Thread Lex

Hi everyone,

this message is in addition to the posts at
http://groups.google.com/group/android-developers/browse_thread/thread/3f01a8576ebb0d7c/1a065e23513c1523

I have a service receiving and sending data to a server in separate
threads each. The service lifecycle methods look like this:

@Override
public void onCreate() {
super.onCreate();
receiver = new ReceiveThread(this);
myMapView.trafficMessages = new VectorTrafficMessage();

}

@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
receiver.start();
}

@Override
public void onDestroy() {
super.onDestroy();
receiver.kill(); // sets a boolean in the while loop to false so
that run() finishes
heartbeat.kill(); // thread sending periodic messages to the 
server
to keep the connection alive
stopSelf();

The activity lifecycle methods look like this:

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TAG = getString(R.string.application_name);
setContentView(R.layout.main);
context = getApplicationContext();

initMap();
initLocationManager();
ccClient = startService(new Intent(this, ClientService.class));
}

@Override
public void onPause() {
super.onPause();
locManager.removeUpdates(locListener);
}

@Override
public void onResume() {
super.onResume();
locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 
0,
0, locListener);
}

@Override
public void onStop() {
super.onStop();
stopService(new Intent(this, cocarClient.getClass()));
}

When I press the home button, the activity onStop() method is called
but stopService() does not call the service onDestroy() method so the
threads keep running in the background.
Why doesn't the service shut down? What is the difference between the
home and back button, what is activity-service lifecycle method call
stack in these cases?

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



[android-developers] Access drawable resources from ItemizedOverlay

2009-07-03 Thread Lex

Hi,

I have a method in my ItemizedOverlay class which takes an object as a
parameter and depending on it's certain values returns an appropriate
icon. What's the best way to access the drawable resource from within
ItemizedOverlay as you can't access it directly like in an activity?
The only idea I have for now is to pass the resources as a second
argument...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Access drawable resources from ItemizedOverlay

2009-07-03 Thread Lex

Thanks Sujay, that worked fine!

On Jul 3, 11:34 am, Sujay Krishna Suresh sujay.coold...@gmail.com
wrote:
 if u jus need resources, have a static Context instance in ur launcher
 activity to which u assign the getApplicationContext() in the onCreate
 method. Now u hv access to ur app Context from any where in ur application.
 m not sure if this is the best method.
 But this is wat i could think of..

 On Fri, Jul 3, 2009 at 2:59 PM, Lex hakkinen1...@gmail.com wrote:

  Hi,

  I have a method in my ItemizedOverlay class which takes an object as a
  parameter and depending on it's certain values returns an appropriate
  icon. What's the best way to access the drawable resource from within
  ItemizedOverlay as you can't access it directly like in an activity?
  The only idea I have for now is to pass the resources as a second
  argument...

 --
 Regards,
 Sujay
 Fred Allen http://www.brainyquote.com/quotes/authors/f/fred_allen.html  -
 California is a fine place to live - if you happen to be an orange.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: When does my thread die (continued discussion)

2009-07-02 Thread Lex

OK, I'm stopping the service in the activity's onStop() method:

@Override
public void onStop() {
super.onStop();
stopService(new Intent(this, cocarClient.getClass()));
Log.i(TAG, stopped service!);

}

Now when I press the back or home buttons, the Log displays the
stopped service message but the service stopped, not receiving
events message from service onDestroy() isn't.

I think we need to clarify what's going on when the user presses the
respective buttons. What's the difference between the back and home
buttons anyways, which lifecycle methods of the activity and of the
connected service are called when they are pressed? How does the user
exit an application/activity (when she does not intend to return to
the service)?

As for the service itself, I would rather stick to it as new activites
might be added later on - and this way I get to learn about more than
one Android component.

Thanks, Lex



On Jul 1, 6:33 pm, Dianne Hackborn hack...@android.com wrote:
 You should probably stop the service in onStop().  When you press home, the
 activity will be stopped but not destroyed because the user didn't close it.

 Also, if you really just want to do work while this particular activity is
 in the foreground, there is no need to use a service.  The only reason to
 use a service is to keep your process running while none of its activities
 are in the foreground.



 On Wed, Jul 1, 2009 at 7:02 AM, Lex hakkinen1...@gmail.com wrote:

  In addition to the posts at

 http://groups.google.com/group/android-developers/browse_thread/threa...
  I'm posting a new topic as the other one seems to be closed for
  further discussion.

  OK so I'm receiving traffic messages via UDP and processing them in a
  new thread that is started in a service. I want to stop the thread
  when the home or back buttons are pressed as I assume that the user is
  then definitely closing the application (there is only one Activity).
  With the current code the thread just doesn't stop - it looks to me as
  if the service's onDestory() method is never called:

  ** ReceiveThread (irrelevant code is omitted in
  each class)

  public class ReceiveThread extends Thread {

         private volatile boolean isAlive;

         private ClientService clientService;

         public ReceiveThread(ClientService service) {
                 clientService = service;
                 isAlive = true;
         }

         public void run() {

                 InetAddress RTIserver;
                 try {
                         RTIserver = InetAddress.getByName(host);

                         DatagramSocket socket = new DatagramSocket();

                         byte[] buf = new byte[256];
                         DatagramPacket packet = new DatagramPacket(buf,
  buf.length,
  RTIserver, port);
                         BinaryMessage binaryMsg = null;

                         // say hello to RTI server
                         ByteString hello = new ByteString(COCAR_HELLO);
                         packet.setData( hello.getBytes());
                         socket.send(packet);

                         // receive traffic data while this thread is alive
                         while(isAlive) {

                                 packet = new DatagramPacket(new byte[256],
  256);
                                 socket.receive(packet);
                                 System.err.println(received packet!);
                                 byte[] bytes = packet.getData();
                                 binaryMsg =
  BinaryMessage.parseRequest(bytes);
                                 clientService.receiveMessage(binaryMsg);

                         }
                         System.err.println(while loop stopped);
                         socket.close();

                 } catch ...
                 }

         }

         public void kill() {
                 isAlive = false;
         }

  }

  ** ClientService

  public class ClientService extends Service {

         private final String COCAR_POST = COCAR POST;

         private ReceiveThread receiveThread;

        �...@override
         public IBinder onBind(Intent arg0) {
                 // TODO Auto-generated method stub
                 return null;
         }

        �...@override
         public void onCreate() {
                 super.onCreate();
                 receiveThread = new ReceiveThread(this);
                 // debug
                 Toast.makeText(this, CoCar Client service created,
  Toast.LENGTH_LONG).show();
         }

        �...@override
         public void onStart(Intent intent, int startId) {
                 super.onStart(intent, startId);
                 receiveThread.start();
                 Toast.makeText(this, CoCar Client service started,
  receiving
  traffic events, Toast.LENGTH_LONG).show();
         }

        �...@override
         public void

[android-developers] Re: Live traffic events as icons on a map

2009-07-02 Thread Lex

Hello again,

I can receive and decode traffic messages now. I'm doing this in a
service and the next step is to update the ItemizedOverlay object in
the map activity as messages are coming. I figured out that a service
cannot directly access it's overlying activity. What is a good
practice to bring the messages created in the service to the activity?

Lex

On Jun 22, 4:10 pm, Lex hakkinen1...@gmail.com wrote:
 I am sure about updating the map in real time - how the users are
 going to use the application isn't the concern at the moment. I just
 got thetrafficmessage specs, so I'll do that and see how far I get
 with updating the events on the map.

 Thanks Al!

 On Jun 22, 1:37 pm, Alistair. alistair.rutherf...@googlemail.com
 wrote:

  Are you sure you want to update the map in real time? In terms of a
  mobile application users are not going to have the application  open
  to the map view constantly they will open the app and observe the
  current state of the road location they are interested in.

  All you really need to do is fetch the latest data when the view is
  opened and update the current event list.

  Al.

  On Jun 21, 12:19 pm,Lexhakkinen1...@gmail.com wrote:

   Hi everyone,

   I am developing a prototype application which features basic
   navigation (updating of own location on the map) and displays live
  trafficevents astrafficsign icons on the map. Thetrafficevents
   will be fetched from a server over a UDP connection. (I haven't
   implemented this as I don't have thetrafficmessage specs yet).

   The idea is to displaytrafficevents in real-time and also delete
   them when they have expired. I figured out that what I need for this
   is one or more ItemizedOverlays with dynamic items. I found this post,

  http://groups.google.com/group/android-developers/browse_thread/threa...

   which seems to be similar to my application. So the circular process
   is:
   1. fetchtrafficdata from server
   2. populate an ItemizedOverlay object containingtrafficevents
   3. update the map accordingy when the items in the overlay have
   changed

   Apparently in the MapView (or Map Activity?) I need some sort of a
   listener for changes in the ItemizedOverlay object. What is the best
   practice for doing this?

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



[android-developers] Re: can't use mouse click for ZoomControl

2009-07-02 Thread Lex

Did I get it right, you have the phone connected to your computer, the
application running on the phone, and you are trying to zoom with the
mouse? As a phone doesn't use a mouse, you probably don't need bother
with that.

Lex


On Jul 2, 10:46 am, tstanly tsai.sta...@gmail.com wrote:
 hi all,

 i use the setBuiltInZoomControls to setup Zoom in my app,
 in the emulator,
 i can use mouse to click the zoom in/out,

 but when the app install in my machine,
 i can't use mouse to click,
 but still work by touch!

 did somebody know how to solve 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] When does my thread die (continued discussion)

2009-07-01 Thread Lex

In addition to the posts at
http://groups.google.com/group/android-developers/browse_thread/thread/47a310494882eb5a/622000c1d630690f
I'm posting a new topic as the other one seems to be closed for
further discussion.

OK so I'm receiving traffic messages via UDP and processing them in a
new thread that is started in a service. I want to stop the thread
when the home or back buttons are pressed as I assume that the user is
then definitely closing the application (there is only one Activity).
With the current code the thread just doesn't stop - it looks to me as
if the service's onDestory() method is never called:

** ReceiveThread (irrelevant code is omitted in
each class)

public class ReceiveThread extends Thread {

private volatile boolean isAlive;

private ClientService clientService;

public ReceiveThread(ClientService service) {
clientService = service;
isAlive = true;
}

public void run() {

InetAddress RTIserver;
try {
RTIserver = InetAddress.getByName(host);

DatagramSocket socket = new DatagramSocket();

byte[] buf = new byte[256];
DatagramPacket packet = new DatagramPacket(buf, 
buf.length,
RTIserver, port);
BinaryMessage binaryMsg = null;

// say hello to RTI server
ByteString hello = new ByteString(COCAR_HELLO);
packet.setData( hello.getBytes());
socket.send(packet);

// receive traffic data while this thread is alive
while(isAlive) {


packet = new DatagramPacket(new byte[256], 256);
socket.receive(packet);
System.err.println(received packet!);
byte[] bytes = packet.getData();
binaryMsg = BinaryMessage.parseRequest(bytes);
clientService.receiveMessage(binaryMsg);

}
System.err.println(while loop stopped);
socket.close();

} catch ...
}

}

public void kill() {
isAlive = false;
}

}

** ClientService

public class ClientService extends Service {

private final String COCAR_POST = COCAR POST;

private ReceiveThread receiveThread;

@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}

@Override
public void onCreate() {
super.onCreate();
receiveThread = new ReceiveThread(this);
// debug
Toast.makeText(this, CoCar Client service created,
Toast.LENGTH_LONG).show();
}

@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
receiveThread.start();
Toast.makeText(this, CoCar Client service started, receiving
traffic events, Toast.LENGTH_LONG).show();
}

@Override
public void onDestroy() {
super.onDestroy();
receiveThread.kill();
System.err.println(sent kill to receive thread);
Toast.makeText(this, CoCar Client service stopped, not 
receiving
traffic events, Toast.LENGTH_LONG).show();
}

// receives a binary message from the receive thread and acts
accordingly
public void receiveMessage(BinaryMessage binaryMsg) {

if( 
(binaryMsg.getCocarDirective().getText().toUpperCase().equals
(COCAR_POST))
 ||
 
binaryMsg.getCocarDirective().substring(0,10).getText().toUpperCase
().equals(COCAR_POST)) {
createTrafficMessage(binaryMsg);
// TODO: add new message to overlay, update map 
etc
}

}

// creates a traffic message from a binary one
private TrafficMessage createTrafficMessage(BinaryMessage binaryMsg)
{
TrafficMessage trafficMsg =  new TrafficMessage(binaryMsg);
// debug
trafficMsg.printToLog();
return trafficMsg;
}


}

*** Activity

public class HelloMapView extends MapActivity implements
OnClickListener {


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

initMap();
initLocationManager();

[android-developers] Re: Live traffic events as icons on a map

2009-06-22 Thread Lex

I am sure about updating the map in real time - how the users are
going to use the application isn't the concern at the moment. I just
got the traffic message specs, so I'll do that and see how far I get
with updating the events on the map.

Thanks Al!

On Jun 22, 1:37 pm, Alistair. alistair.rutherf...@googlemail.com
wrote:
 Are you sure you want to update the map in real time? In terms of a
 mobile application users are not going to have the application  open
 to the map view constantly they will open the app and observe the
 current state of the road location they are interested in.

 All you really need to do is fetch the latest data when the view is
 opened and update the current event list.

 Al.

 On Jun 21, 12:19 pm, Lex hakkinen1...@gmail.com wrote:

  Hi everyone,

  I am developing a prototype application which features basic
  navigation (updating of own location on the map) and displays live
  traffic events as traffic sign icons on the map. The traffic events
  will be fetched from a server over a UDP connection. (I haven't
  implemented this as I don't have the traffic message specs yet).

  The idea is to display traffic events in real-time and also delete
  them when they have expired. I figured out that what I need for this
  is one or more ItemizedOverlays with dynamic items. I found this post,

 http://groups.google.com/group/android-developers/browse_thread/threa...

  which seems to be similar to my application. So the circular process
  is:
  1. fetch traffic data from server
  2. populate an ItemizedOverlay object containing traffic events
  3. update the map accordingy when the items in the overlay have
  changed

  Apparently in the MapView (or Map Activity?) I need some sort of a
  listener for changes in the ItemizedOverlay object. What is the best
  practice for doing this?

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



[android-developers] Live traffic events as icons on a map

2009-06-21 Thread Lex

Hi everyone,

I am developing a prototype application which features basic
navigation (updating of own location on the map) and displays live
traffic events as traffic sign icons on the map. The traffic events
will be fetched from a server over a UDP connection. (I haven't
implemented this as I don't have the traffic message specs yet).

The idea is to display traffic events in real-time and also delete
them when they have expired. I figured out that what I need for this
is one or more ItemizedOverlays with dynamic items. I found this post,

http://groups.google.com/group/android-developers/browse_thread/thread/818ed0c29de35376/7f9dd604317958c4?lnk=gstq=updating+own+location+overlay#7f9dd604317958c4

which seems to be similar to my application. So the circular process
is:
1. fetch traffic data from server
2. populate an ItemizedOverlay object containing traffic events
3. update the map accordingy when the items in the overlay have
changed

Apparently in the MapView (or Map Activity?) I need some sort of a
listener for changes in the ItemizedOverlay object. What is the best
practice for doing this?

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



[android-developers] Re: Connect laptop built-in gps receiver to emulator

2009-06-05 Thread Lex

Made it work, thanks David.

On Vista, when you enable GPS reception in the Dell Control Point,
click on View network status details. It will show you the (serial)
port where the GPS data is flowing to. In a console, enter emulator -
avd avd_name -gps COMport_number. This will start the emulator and
when you start your location app, you should be receiving real GPS
data.

Lex

On 4 Jun., 02:11, David Turner di...@android.com wrote:
 emulator -help-gps ?

 On Wed, Jun 3, 2009 at 6:54 PM, Lex hakkinen1...@gmail.com wrote:

  Hello,

  my Dell Latitude E6400 has a built-in gps receiver. How can I hook it
  up with the emulator? I have enough problems spoofing gps data due to
  exisiting Android bugs, so I might as well use real ones?

  Thanks,

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



[android-developers] Re: Bug? Geo fix and sdk 1.5

2009-06-04 Thread Lex

I hooked up the emulator to the laptop's intergrated GPS receiver and
drove around the block to see if that will work. When I started the
application, my position was showed correctly. However, when I started
moving, it hasn't changed once. DDMS shows that onLocationChanged was
called only once. So apparently the emulator has a problem with real
GPS data as well. Am I right about this, that is is it true that the
problem is with GPS data in general and not only mock or only real
data?

Lex

On 4 Jun., 02:12, David Turner di...@android.com wrote:
 this is a known issue that will be fixed in the next 1.5 SDK release.Sorry
 about that.

 On Wed, Apr 29, 2009 at 1:10 AM, rob_b...@gmx.net rob_b...@gmx.net wrote:

  have the same problem! also tried with the r1 version of the new sdk
  1.5.
  worked on sdk 1.1.
  doesn't matter if I use ddms or telnet. still can just see one or at
  least 2 coordinates displayed in the application.
  need help! thx

  On 28 Apr., 15:51, Andreas Frey a-f...@gmx.de wrote:
   Hello,

   I have a really simple Android Application using a MyLocationOverlay
   and a LocationManager to determine and show the current position via a
   Toast.

   But the geo fix command i submit via telnet does only work the first
   time i submit it. ALl later tries to update the position do not work.

   Anybody knows this problem?
   Any solutiions

   This is the relevant source code:
   -
   ..
     private void initLocationManager() {
                   locManager = (LocationManager) getSystemService
   (Context.LOCATION_SERVICE);

                   locationListener = new LocationListener() {

                           public void onLocationChanged(Location location)
  {
                                   updatePosition(location);
                           }
                           public void onProviderDisabled(String arg0) {
                           }
                           public void onProviderEnabled(String arg0) {
                           }
                           public void onStatusChanged(String arg0, int
  arg1, Bundle arg2) {
                           }
                   };

  locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
   0,
                                   locationListener);
           }

           private void updatePosition(Location location) {
                   Toast t = Toast.makeText(
                           this,
                           getString(R.string.msgPosition,
  location.getLatitude(),
   location.getLongitude()),
                           Toast.LENGTH_SHORT);
                   t.show();

                   theMap.getController().animateTo(
                                   new GeoPoint(

  (int)(location.getLatitude()*1E6),

  (int)(location.getLongitude()*1E6)));
                   theMap.postInvalidate();

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



[android-developers] Re: Google Android Maps API

2009-05-28 Thread Lex

Finally! I must not have seen the woods for the trees. I guess I got
pretty confused about to what extent the Maps are a part of Android. I
assume we should treat it as an external add-on despite the fact it's
from the same company.

Thanks a lot, Mark!

On May 26, 1:54 am, Mark Murphy mmur...@commonsware.com wrote:
 Lex wrote:
  I am working on a map navigation application in 1.5. Due to it's
  recent release most tutorials I was using as a reference are out-of-
  date and cannot be run without refactoring.

 Really?

  The link for Google
  Android Maps API

 http://developer.android.com/reference/com/google/android/maps/packag...

  has been broken for a while now (and it's the first hit!). When can we
  expect the link to work?

 Never, most likely.

  Where else can we find the required API?

 The following link for Locations and Maps is in the sidebar of the Dev
 Guide

 http://developer.android.com/guide/topics/location/index.html#maps

 That will lead you to:

 http://code.google.com/android/add-ons/google-apis

 Which will eventually get you to the Google APIs Add-On API reference:

 http://code.google.com/android/add-ons/google-apis/reference/index.html

  It's
  really inconvient when I want to look up something while developing...

 You will need to get used to it. There may be many more commercial
 add-ons for Android in the coming years, and they may all be
 independently documented like this one is. The main API reference is
 probably being dedicated simply to the open source components.

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

 Android Development Wiki:http://wiki.andmob.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] Re: Map view not displaying tiles in 1.5 but it's fine in 1.1

2009-05-26 Thread Lex

The built-in map application (and browser) work fine, and as I said
before, firewall is fine - at least as much as I can see. I have
exactly the same code running on a different machine (Vista) and it
works just fine!

On May 26, 2:11 am, Mark Murphy mmur...@commonsware.com wrote:
 Lex wrote:
  I just went through the MapView Tutorial and I can't get themap
  displayed whatsoever. I had SDK1.5installed from the beginning.
  Internet permission isfine, Firewall isfine. I deleted the
  debug.keystore file on my (XP) machine, rebuilt the project under
  Google API/Target 3, generated a new key, but still nomap. I really
  feel like I have exhausted all known solutiouns I have found for this
  issue so far. Using Eclipse Ganymed and JDK 1.6.13

 Does the built-in Maps application work?

 Ifnot, the problem is with your firewall or something else tied to
 networking.

 If it does, then the problem is probably with your API key, or perhaps
 the INTERNET permission.

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

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



[android-developers] Re: Map view not displaying tiles in 1.5 but it's fine in 1.1

2009-05-25 Thread Lex

I just went through the MapView Tutorial and I can't get the map
displayed whatsoever. I had SDK 1.5 installed from the beginning.
Internet permission is fine, Firewall is fine. I deleted the
debug.keystore file on my (XP) machine, rebuilt the project under
Google API/Target 3, generated a new key, but still no map. I really
feel like I have exhausted all known solutiouns I have found for this
issue so far. Using Eclipse Ganymed and JDK 1.6.13

On Apr 21, 8:40 pm, Xavier Ducrohet x...@android.com wrote:
 Wayne,

 You could also have moved your old debug.keystore in the new location,
 instead of generating a newmapkey. But either way isfine.

  2. Regenerate the key:   I used the html file that comes with the1.5
  documentation rather than the going to the google website and using
  that one version. I don't know if it makes a difference ornot, but it
  generated a new key.

  file:///C:/android-sdk-windows-1.5_pre/docs/maps-api-signup.html

 This just calls back to the google server. The generation of themap
 key can only be done by our server.

 Glad to here it worked out.

 Xav

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



[android-developers] Google Android Maps API

2009-05-25 Thread Lex

Hi,

I am working on a map navigation application in 1.5. Due to it's
recent release most tutorials I was using as a reference are out-of-
date and cannot be run without refactoring. The link for Google
Android Maps API

http://developer.android.com/reference/com/google/android/maps/package-summary.html

has been broken for a while now (and it's the first hit!). When can we
expect the link to work? Where else can we find the required API? It's
really inconvient when I want to look up something while developing...

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



[android-developers] Re: Help on porting with ME4Android

2008-06-18 Thread Lex

Thanks Steve for the links.
How sure is the fact that InnaWorks is working on an Android porting ?

And what external libraries ? I mean could I still use them and thy'll
be ported on Android ?
Thanks

On Jun 17, 7:57 pm, Steve Oldmeadow [EMAIL PROTECTED] wrote:
 Not ME4Android but here is a solution, haven't tried it but it sounds
 interesting:

 http://www.netmite.com/android

 These guys are working on a ME - Android porting tool:

 http://www.mobile-distillery.com

 I've also heard rumours that these guys are working on a tool for
 Android:

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



[android-developers] Re: Help on porting with ME4Android

2008-06-17 Thread Lex

Anyone ?

On Jun 10, 1:48 am, Lex [EMAIL PROTECTED] wrote:
 Hi all,

 Can you explain a little bit more precisely how to port a JavaME
 program to Android, usingME4Android? What are the steps to folow ?
 Ive got a JavaME app ( do I need source code or binary code ? Ive got
 both ). Do I need to create a new Android project and add all the
 javaME code ?
 Some help would really be appreciated as I couldnt find any on the
 web.
 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
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How to modify the menu ?

2008-06-17 Thread Lex

Hi folks,

Id to know how one can modify the menu ( add/delete items ) after its
been created ? ( I mean during the Activity ). Is it even possible ?
Thank you.
Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Help on porting

2008-06-10 Thread Lex

I didnt get it. The author hasnt released his application yet right ?
Any guess when he will ?

On Jun 9, 11:55 pm, Steve Oldmeadow [EMAIL PROTECTED] wrote:
 Where did you get ME4Android from?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Help on porting with ME4Android

2008-06-10 Thread Lex

Hi all,

Can you explain a little bit more precisely how to port a JavaME
program to Android, using ME4Android ? What are the steps to folow ?
Ive got a JavaME app ( do I need source code or binary code ? Ive got
both ). Do I need to create a new Android project and add all the
javaME code ?
Some help would really be appreciated as I couldnt find any on the
web.
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
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Help on porting

2008-06-09 Thread Lex

Hi all,

Can you explain a little bit more precisely how to port a JavaME
program to Android, using ME4Android ? What are the steps to folow ?
Ive got a JavaME app ( do I need source code or binary code ? Ive got
both ). Do I need to create a new Android project and add all the
javaME code ?
Some help would really be appreciated as I couldnt find any on the
web.
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
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---