[android-developers] How to inflate a MapView inside a ViewFlipper??

2012-05-09 Thread pedro242
Hi,

I'm stuck in this issue for a while now..  went around forums, books 
(M.Murphy, R.Meier) and I did not find any real helpful threads..

My main activity is  a ListActivity, where the view(main.xml) contains a 
ListView 
and a ViewFlipper
just below. For each selected line in my ListView i want to update the 
content of the ViewFlipper.
Based on two buttons, my ViewFlipper would switch between the  MapView and 
a basic LinearLayout. As far
as i understand i should inflate my MapView but I did not find any 
informatio about how to do that.. 
Of course I'm aware that a MapActivity should appear somewhere..

If someone could provide me a link to a snippet code or answer me with a 
sample code it would be great!!
(the other option is to start a new activity based on a MapActivity where i 
would not need to inflate anthing, but it would not
be so nice)
Thanks,
Pedro

Here below my main.xml:

 ?xml version=1.0 encoding=utf-8?
 LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
 android:layout_width=match_parent
 android:layout_height=match_parent
 android:orientation=vertical 

 !-- android:background=#77ff --

 LinearLayout
 android:id=@+id/linearLayout1
 android:layout_width=fill_parent
 android:layout_height=0dp
 android:layout_weight=0.3 

 Button
 android:id=@+id/prevViewFlipperButt
 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:onClick=onPrevChangeViewFlipper
 android:text=PREV /

 Button
 android:id=@+id/nextViewFlipperButt
 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:onClick=onNextChangeViewFlipper
 android:text=NEXT /
 /LinearLayout

 ListView
 android:id=@android:id/list
 android:layout_width=fill_parent
 android:layout_height=0dp
 android:layout_weight=1
 android:cacheColorHint=# /

 ViewFlipper
 android:id=@+id/viewFlipperFromListView
 android:layout_width=fill_parent
 android:layout_height=0dp
 android:layout_weight=1 

 include
 android:id=@+id/flipper1
 layout=@layout/details_flipper_view /
   
 include
 android:id=@+id/flipper2
 layout=@layout/map_flipper_view /

 /ViewFlipper

 TextView
 android:id=@+id/selectionTxtView
 android:layout_width=fill_parent
 android:layout_height=0dp
 android:layout_weight=0.3
 android:textSize=44sp /

 /LinearLayout


details_flipper_view.xml:

 ?xml version=1.0 encoding=utf-8?
 LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
 android:id=@+id/PochtroDetailsFlipperLayout
 android:layout_width=match_parent
 android:layout_height=match_parent
 android:orientation=vertical 

 TextView
 android:id=@+id/textView1
 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:text=Large Text
 android:textAppearance=?android:attr/textAppearanceLarge /

 TextView
 android:id=@+id/textView4
 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:text=Small Text
 android:textAppearance=?android:attr/textAppearanceSmall /

 /LinearLayout


map_flipper_view.xml:

 ?xml version=1.0 encoding=utf-8?
 LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
   android:id=@+id/frame android:orientation=vertical
   android:layout_width=wrap_content android:layout_height=wrap_content
   
   com.google.android.maps.MapView
 android:id=@+id/map_view
 android:apiKey=XX
 android:enabled=true
 android:clickable=true
 android:layout_height=wrap_content
 android:layout_width=fill_parent /

 /LinearLayout




 



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

2012-05-09 Thread pedro242
Have you ever tried this? Not sure it works, since i will likely face 
another issue in
managing the ListView without the ListActivity...

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

2012-05-09 Thread pedro242

For the Geocoder, here's a bunch of code you can use..

LocationManager locMgr = 
 (LocationManager)getSystemService(Context.LOCATION_SERVICE); 

Location lastLoc = locMgr
 .getLastKnownLocation(LocationManager.GPS_PROVIDER);

 ListAddress addressList;
 Geocoder geo = new Geocoder(getApplicationContext(), Locale.getDefault());
  try {
  addressList= geo.getFromLocation(lastLoc.getLatitude(), 
 lastLoc.getLongitude(), 
 1/*only one answer*/);
  if (null!=addressList) {
Address MyAddress = addressList.get(0);
   // do something with MyAddress
  }
  } 

 catch (IOException e) {  

 }


 
 

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

2012-05-09 Thread pedro242

Thanks guys, just tried it out and it works...
But the inflating manner is still confused for me.

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

[android-developers] Re: how to place a button inside the map view

2012-05-04 Thread pedro242
Hi Siva,

I would like to know how you have managed your ViewFlipper from an Activity
point of view?? What is your main Activity type that performs your 
setContentView()? 

I would like to do the same thing, putting different Views (MapView, 
ListView,..) inside a ViewFlipper,
but i can not find the way.. Do you associate a MapActivity?

Thanks, Pedro

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

2011-03-05 Thread pedro242
Still no anwsers/comments..

Not any specialist of Android Services?...

On Mar 1, 8:06 pm, pedro242 pedro.contreir...@gmail.com wrote:
 Hi there,

 I would need your help to clarify what is the priority
 of a process hosting a Service when the service is
 either started (startService() ) or bound (bindService()):

 When the Service is started, the Android doc is quite clear saying:
 If the service has been started, then its hosting process is
 considered to be less important than any processes that are currently
 visible to the user on-screen, but more important than any process not
 visible.
 = it means that the process is ranked as Service process level (Cf.
 Processes and Threads android doc)
 As far as i understand, this priority level should warrant us the
 process will only be killed in a very
 constraining RAM configuration, and makes it suitable for long time
 running background thread..
 Is my understanding correct?

 My concern deals with the bound case..
 Android doc says:
 If there are clients bound to the service, then the service's hosting
 process is never less important than the most important client. That
 is, if one of its clients is visible to the user, then the service
 itself is considered to be visible. 
 So if my most important client gets stopped and goes in the background
 (or even worse, is destroyed), the Service process is then ranked in
 the same way?? It would then mean that it does
 not keep ranked as Service process level (started case) and will be
 about to be destroyed by
 the system at any time..
 So what the point of launching a background thread in a bound
 Service?? What's the difference between a simple thread launching from
 an Activity?

 Am i missing a point? Any comments?
 Thanks..

 Pedro

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

2011-03-05 Thread pedro242
(Great! An answer from the
prestigious M.Murphy!! Great books!!)

Thanks Mark for your answer..

But the Services in bound mode are still not clear for me..

Android Doc says:
If there are clients bound to the service, then the service's hosting
process is never less important than the most important client. That
is, if one of its clients is visible to the user, then the service
itself is considered to be visible. 

So if my most important client gets stopped and goes in the background
(or even worse, is destroyed), the Service process is then ranked in
the same way??  wich means most likely to be also destroyed..
That is my real concern..

Mark, do you confirm my understanding?


On Mar 5, 3:40 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Tue, Mar 1, 2011 at 2:06 PM, pedro242 pedro.contreir...@gmail.com wrote:
  When the Service is started, the Android doc is quite clear saying:
  If the service has been started, then its hosting process is
  considered to be less important than any processes that are currently
  visible to the user on-screen, but more important than any process not
  visible.
  = it means that the process is ranked as Service process level (Cf.
  Processes and Threads android doc)
  As far as i understand, this priority level should warrant us the
  process will only be killed in a very
  constraining RAM configuration, and makes it suitable for long time
  running background thread..
  Is my understanding correct?

 Please do not have a long time running background thread except in
 extreme situations (e.g., VOIP client), and even then you will need to
 use startForeground() to keep the service around.

 Pure background services (i.e., those without an accompanying activity
 in the foreground) are designed to run for seconds or minutes, not
 hours or days.

  So what the point of launching a background thread in a bound
  Service?? What's the difference between a simple thread launching from
  an Activity?

 Activities undergo configuration changes, where they get destroyed and
 recreated (e.g., screen rotation). Services do not. Dealing with
 either background threads or bound services is annoying to deal with
 in an Activity.

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

 Android App Developer Books:http://commonsware.com/books

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


[android-developers] Re: Long server process...solution

2011-03-05 Thread pedro242
 on the client side, is there a solution that'll keep a
 connection open and poll every few seconds to
 find out how far along the process is.
Since you perform an HTTP POST, your client just
waits for the server response, in meantime from your java code
point of view you can no do nothing (blocking function), it will
only wake up when the full bunch of data will be available from TCP
to your java applicative layer.. or if the TCP connection is reseted
from
one side of the connection or if it's time out'ed.
May be intermediate HTTP responses with a 100 (continue) status could
suit your issue, i'm thinking of that because your could had some
specific HTTP headers containing the information you want ..

Another solution would be to work at socket java level, if you want
a more accurate view on what's going on in your request, but i do not
even know if it could solve your issue..

Anyway, Polling a server to find out how much time a request would
take, seems
to me quite strange.. are you really sure you have the good approach?


On Mar 4, 10:57 pm, dashman erjdri...@gmail.com wrote:
 I'm doing a POST to a site to do some work...this process
 takes a long time (about 30-60 seconds).

 I plan change it so that i can do the work in a separate
 thread on the server.

 on the client side, is there a solution that'll keep a
 connection open and poll every few seconds to
 find out how far along the process is.

 on the UI front, is there a way to change the size of the
 indeterminate wait animation - something larger.

 any any pointers how this could be handled also
 appreciated.

 it's java on both the client and server.

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

2011-03-05 Thread pedro242
Everything is explained here: 
http://developer.android.com/guide/webapps/webview.html

On Mar 4, 9:58 am, Santhosh Kumar santhoshgu...@gmail.com wrote:
 thanks  regards,
 G.Santhosh Kumar
 +91 9966973790

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

2011-03-05 Thread pedro242
Thanks Dianne for your answer..

I just compared the basic thread and a thread launched in a service
process
upon an AIDL request in the sense that if the client actvity was
destroyed, then
in both cases, the basic long time running thread and the service
thread would
also be destroyed...

With your responses it's now more clear for me.. and by the way I
realized
it's make no sense in launching a thread upon an AIDL request from a
component and expecting this thread keeps on running, after the
component
be destroyed.

(Dianne, your Multitasking the Android Way paper is very very
helpfull, keep
on doing things in this way..)

On Mar 5, 7:04 pm, Dianne Hackborn hack...@android.com wrote:
 The  service will be at the level of the most important thing it is doing.
  If it has a service that is started, and an application that is in the
 foreground bound to it, then it will be in the foreground as long as any
 such bound application is foreground.  When the application goes to the
 background, it will be lowered to the service level (unless there is some
 other component or something else going on more important than the service).

 This is very different than just making a long running thread in the
 processes, which the system then doesn't know about and never prioritizes
 the process based on the thread being there.  (And anyway you can't bind to
 a thread from another processes, so functionally you just can't do the same
 things.)

 Also please realize that just having a service started doesn't mean your
 process won't get killed except under unusual situations.  In fact the
 current implementation ensures that, for a service that remains started a
 long time, its process will eventually get killed (and the service then
 restarted).

 On Sat, Mar 5, 2011 at 8:30 AM, pedro242 pedro.contreir...@gmail.comwrote:



  (Great! An answer from the
  prestigious M.Murphy!! Great books!!)

  Thanks Mark for your answer..

  But the Services in bound mode are still not clear for me..

  Android Doc says:
  If there are clients bound to the service, then the service's hosting
  process is never less important than the most important client. That
  is, if one of its clients is visible to the user, then the service
  itself is considered to be visible. 

  So if my most important client gets stopped and goes in the background
  (or even worse, is destroyed), the Service process is then ranked in
  the same way??  wich means most likely to be also destroyed..
  That is my real concern..

  Mark, do you confirm my understanding?

  On Mar 5, 3:40 pm, Mark Murphy mmur...@commonsware.com wrote:
   On Tue, Mar 1, 2011 at 2:06 PM, pedro242 pedro.contreir...@gmail.com
  wrote:
When the Service is started, the Android doc is quite clear saying:
If the service has been started, then its hosting process is
considered to be less important than any processes that are currently
visible to the user on-screen, but more important than any process not
visible.
= it means that the process is ranked as Service process level (Cf.
Processes and Threads android doc)
As far as i understand, this priority level should warrant us the
process will only be killed in a very
constraining RAM configuration, and makes it suitable for long time
running background thread..
Is my understanding correct?

   Please do not have a long time running background thread except in
   extreme situations (e.g., VOIP client), and even then you will need to
   use startForeground() to keep the service around.

   Pure background services (i.e., those without an accompanying activity
   in the foreground) are designed to run for seconds or minutes, not
   hours or days.

So what the point of launching a background thread in a bound
Service?? What's the difference between a simple thread launching from
an Activity?

   Activities undergo configuration changes, where they get destroyed and
   recreated (e.g., screen rotation). Services do not. Dealing with
   either background threads or bound services is annoying to deal with
   in an Activity.

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

   Android App Developer Books:http://commonsware.com/books

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

[android-developers] service process priority: startService() vs bindService()

2011-03-02 Thread pedro242
Hi there,

I would need your help to clarify what is the priority
of a process hosting a Service when the service is
either started (startService() ) or bound (bindService()):

When the Service is started, the Android doc is quite clear saying:
If the service has been started, then its hosting process is
considered to be less important than any processes that are currently
visible to the user on-screen, but more important than any process not
visible.
= it means that the process is ranked as Service process level (Cf.
Processes and Threads android doc)
As far as i understand, this priority level should warrant us the
process will only be killed in a very
constraining RAM configuration, and makes it suitable for long time
running background thread..
Is my understanding correct?

My concern deals with the bound case..
Android doc says:
If there are clients bound to the service, then the service's hosting
process is never less important than the most important client. That
is, if one of its clients is visible to the user, then the service
itself is considered to be visible. 
So if my most important client gets stopped and goes in the background
(or even worse, is destroyed), the Service process is then ranked in
the same way?? It would then mean that it does
not keep ranked as Service process level (started case) and will be
about to be destroyed by
the system at any time..
So what the point of launching a background thread in a bound
Service?? What's the difference between a simple thread launching from
an Activity?

Am i missing a point? Any comments?
Thanks..

Pedro

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

2011-02-22 Thread pedro242
Basic remark..
Did you define your GoogleMapActivity in the manifest file?
(activity android:name=.YourClassPath.GoogleMapActivity/ )

On Feb 21, 9:31 am, Nesim TUNÇ nesimt...@gmail.com wrote:
 Hi Awesome Developers!

 I'm trying to use Google Map in my Android App. My SDK version is 2.1 update
 1 (Level 7), I added the Google Map Lib (maps.jar) - Level 7 but still
 getting this error .. Here is my codes:

 Manifest file:

  activity android:name=x.maps.GoogleMapActivity/
 uses-library android:name=com.google.android.maps
 android:required=true/   is child node of application tag
 and these permissons are requested:
 uses-permission
 android:name=android.permission.INTERNET/uses-permission
 uses-permission
 android:name=android.permission.ACCESS_FINE_LOCATION/uses-permission
 uses-permission android:name=android.permission.ACCESS_COARSE_LOCATION /
 uses-permission android:name=android.permission.CALL_PHONE/
 uses-permission android:name=android.permission.VIBRATE /
 uses-permission android:name=android.permission.READ_PHONE_STATE /

 layout/mapview.xml
  com.google.android.maps.MapView
         android:id=@+id/mapView
         android:layout_width=fill_parent
         android:layout_height=fill_parent
         android:enabled=true
         android:clickable=true
         android:apiKey=my key goes here
         /

 and this my activity class

 public class GoogleMapActivity extends MapActivity {

 @Override
  protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
  setContentView(R.layout.mapview);

 }

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

 }
 }

 and here is how I call it from a imagview click

 Intent mapIntent = new Intent(v.getContext(),
 x.maps.GoogleMapActivity.class);
 startActivity(mapIntent);

 And I get this error:

 02-21 10:30:04.645: ERROR/AndroidRuntime(6257): FATAL EXCEPTION: main
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):
 java.lang.IllegalStateException: Could not execute method of the activity
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 android.view.View$1.onClick(View.java:2082)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 android.view.View.performClick(View.java:2461)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 android.view.View$PerformClick.run(View.java:8890)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 android.os.Handler.handleCallback(Handler.java:587)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 android.os.Handler.dispatchMessage(Handler.java:92)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 android.os.Looper.loop(Looper.java:123)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 android.app.ActivityThread.main(ActivityThread.java:4627)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 java.lang.reflect.Method.invokeNative(Native Method)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 java.lang.reflect.Method.invoke(Method.java:521)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 dalvik.system.NativeStart.main(Native Method)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257): Caused by:
 java.lang.reflect.InvocationTargetException
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 mekanist.placedetail.PlaceDetailActivity.showMap(PlaceDetailActivity.java:296)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 java.lang.reflect.Method.invokeNative(Native Method)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 java.lang.reflect.Method.invoke(Method.java:521)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 android.view.View$1.onClick(View.java:2077)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     ... 11 more
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257): Caused by:
 java.lang.NoClassDefFoundError: x.maps.GoogleMapActivity
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     ... 15 more
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257): Caused by:
 java.lang.IllegalAccessError: Class ref in pre-verified class resolved to
 unexpected implementation
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 dalvik.system.DexFile.defineClass(Native Method)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 dalvik.system.DexFile.loadClassBinaryName(DexFile.java:209)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 dalvik.system.PathClassLoader.findClass(PathClassLoader.java:203)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 java.lang.ClassLoader.loadClass(ClassLoader.java:573)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     at
 java.lang.ClassLoader.loadClass(ClassLoader.java:532)
 02-21 10:30:04.645: ERROR/AndroidRuntime(6257):     ... 15 more

 What is the problem?