[android-developers] How to receive events on MapView using Overlay

2009-07-03 Thread mak


Overlay Code:

 public class MyLocationOverlay extends
com.google.android.maps.Overlay {
 @Override
public boolean onKeyDown(int keyCode,KeyEvent event, MapView view){
System.out.println(==INSIDE onKeyDown
==);
 if(keyCode == KeyEvent.KEYCODE_BACK) {
System.out.println(HMM... Calling Your Key Event 
\n);
return true;
}
return false;
}

Do I need to call this method explicitly from MapView Acitivity or as
any keydown this will get called ?

Appreciate your input on it.

Regards,
_-_Mayank Rana_-_


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 docs on HTC Magic (poss all gphones)

2009-07-03 Thread chris.compo

Hi All

I am using a Htc Magic, I can access my docs ok but when I tried to
edit a shared spreadsheet from the phone I could not do it, it viewed
perfectly.


Is it possible to edit from phone? should it be ? could it be as would
really help me loads...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] java.lang.ClassCastException when casting from ParcelableArray

2009-07-03 Thread ade

Hello Android Developers,

Why do I  get java.lang.ClassCastException when I tried to cast back
an array of custom object that implements Parcelable?

Here is the custom class:

public class Placemark implements Parcelable {
public Double latitude;
public Double longitude;
public Double distanceFromUser;
public int accuracy;
public String address;
private static final int earthRadius = 6371;

public static final Parcelable.CreatorPlacemark CREATOR = new
Parcelable.CreatorPlacemark() {
public Placemark createFromParcel(Parcel in) {
return new Placemark(in);
}

public Placemark[] newArray(int size) {
return new Placemark[size];
}
};

public Placemark(JSONObject jo) throws JSONException {
this.address = jo.getString(address);
JSONArray array = jo.getJSONObject(Point).getJSONArray(
coordinates);
this.latitude = array.getDouble(1);
this.longitude = array.getDouble(0);
this.accuracy = array.getInt(2);
}

public Placemark(JSONObject jo, Location userLocation)
throws JSONException {
this.address = jo.getString(address);
JSONArray array = jo.getJSONObject(Point).getJSONArray(
coordinates);
this.latitude = array.getDouble(1);
this.longitude = array.getDouble(0);
this.accuracy = array.getInt(2);

// based on Haversine formula
// (http://www.movable-type.co.uk/scripts/latlong.html)
Double dLat = Math.toRadians(userLocation.getLatitude()
- this.latitude);
Double dLon = Math.toRadians(userLocation.getLongitude()
- this.longitude);
Double a = Math.sin(dLat / 2) * Math.sin(dLat / 2)
+ Math.cos(Math.toRadians(this.latitude))
* 
Math.cos(Math.toRadians(userLocation.getLatitude()))
* Math.sin(dLon / 2) * Math.sin(dLon / 2);
Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
this.distanceFromUser = earthRadius * c;
}

public Placemark(Parcel in) {
readFromParcel(in);
}

@Override
public String toString() {
return this.address
+ (this.distanceFromUser != null ?  (
+ 
Math.rint(this.distanceFromUser) +  km) : );
}

public int describeContents() {
// TODO Auto-generated method stub
return 0;
}

public void writeToParcel(Parcel dest, int flags) {
dest.writeDouble(latitude);
dest.writeDouble(longitude);
dest.writeInt(accuracy);
dest.writeString(address);
}

public void readFromParcel(Parcel in) {
latitude = in.readDouble();
longitude = in.readDouble();
accuracy = in.readInt();
address = in.readString();
}
}

--
and here's the code that throws the error:

Bundle lastSearchBundle = extras.getBundle(lastSearch);
mSearchResult= (Placemark[]) lastSearchBundle.getParcelableArray
(searchResult); //--this is the line that throws the error

--
and here's the error detail:

E/AndroidRuntime( 9449): java.lang.RuntimeException: Unable to start
activity ComponentInfo{com.xxx/com.xxx.Search}:
java.lang.ClassCastException: [Landroid.os.Parcelable;
E/AndroidRuntime( 9449):at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2268)
E/AndroidRuntime( 9449):at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2284)
E/AndroidRuntime( 9449):at android.app.ActivityThread.access$1800
(ActivityThread.java:112)
E/AndroidRuntime( 9449):at android.app.ActivityThread$H.handleMessage
(ActivityThread.java:1692)
E/AndroidRuntime( 9449):at android.os.Handler.dispatchMessage
(Handler.java:99)
E/AndroidRuntime( 9449):at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 9449):at android.app.ActivityThread.main
(ActivityThread.java:3948)
E/AndroidRuntime( 9449):at java.lang.reflect.Method.invokeNative
(Native Method)
E/AndroidRuntime( 9449):at java.lang.reflect.Method.invoke
(Method.java:521)
E/AndroidRuntime( 9449):at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/AndroidRuntime( 

[android-developers] Re: java.lang.ClassCastException when casting from ParcelableArray

2009-07-03 Thread Romain Guy

It is illegal in Java to cast an array of a supertype into an array of
a subtype.

On Thu, Jul 2, 2009 at 11:42 PM, adea.wirayu...@gmail.com wrote:

 Hello Android Developers,

 Why do I  get java.lang.ClassCastException when I tried to cast back
 an array of custom object that implements Parcelable?

 Here is the custom class:

 public class Placemark implements Parcelable {
        public Double latitude;
        public Double longitude;
        public Double distanceFromUser;
        public int accuracy;
        public String address;
        private static final int earthRadius = 6371;

        public static final Parcelable.CreatorPlacemark CREATOR = new
 Parcelable.CreatorPlacemark() {
                public Placemark createFromParcel(Parcel in) {
                        return new Placemark(in);
                }

                public Placemark[] newArray(int size) {
                        return new Placemark[size];
                }
        };

        public Placemark(JSONObject jo) throws JSONException {
                this.address = jo.getString(address);
                JSONArray array = jo.getJSONObject(Point).getJSONArray(
                                coordinates);
                this.latitude = array.getDouble(1);
                this.longitude = array.getDouble(0);
                this.accuracy = array.getInt(2);
        }

        public Placemark(JSONObject jo, Location userLocation)
                        throws JSONException {
                this.address = jo.getString(address);
                JSONArray array = jo.getJSONObject(Point).getJSONArray(
                                coordinates);
                this.latitude = array.getDouble(1);
                this.longitude = array.getDouble(0);
                this.accuracy = array.getInt(2);

                // based on Haversine formula
                // (http://www.movable-type.co.uk/scripts/latlong.html)
                Double dLat = Math.toRadians(userLocation.getLatitude()
                                - this.latitude);
                Double dLon = Math.toRadians(userLocation.getLongitude()
                                - this.longitude);
                Double a = Math.sin(dLat / 2) * Math.sin(dLat / 2)
                                + Math.cos(Math.toRadians(this.latitude))
                                * 
 Math.cos(Math.toRadians(userLocation.getLatitude()))
                                * Math.sin(dLon / 2) * Math.sin(dLon / 2);
                Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
                this.distanceFromUser = earthRadius * c;
        }

        public Placemark(Parcel in) {
                readFromParcel(in);
        }

       �...@override
        public String toString() {
                return this.address
                                + (this.distanceFromUser != null ?  (
                                                + 
 Math.rint(this.distanceFromUser) +  km) : );
        }

        public int describeContents() {
                // TODO Auto-generated method stub
                return 0;
        }

        public void writeToParcel(Parcel dest, int flags) {
                dest.writeDouble(latitude);
                dest.writeDouble(longitude);
                dest.writeInt(accuracy);
                dest.writeString(address);
        }

        public void readFromParcel(Parcel in) {
                latitude = in.readDouble();
                longitude = in.readDouble();
                accuracy = in.readInt();
                address = in.readString();
        }
 }

 --
 and here's the code that throws the error:

 Bundle lastSearchBundle = extras.getBundle(lastSearch);
 mSearchResult= (Placemark[]) lastSearchBundle.getParcelableArray
 (searchResult); //--this is the line that throws the error

 --
 and here's the error detail:

 E/AndroidRuntime( 9449): java.lang.RuntimeException: Unable to start
 activity ComponentInfo{com.xxx/com.xxx.Search}:
 java.lang.ClassCastException: [Landroid.os.Parcelable;
 E/AndroidRuntime( 9449):        at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
 2268)
 E/AndroidRuntime( 9449):        at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
 2284)
 E/AndroidRuntime( 9449):        at android.app.ActivityThread.access$1800
 (ActivityThread.java:112)
 E/AndroidRuntime( 9449):        at android.app.ActivityThread$H.handleMessage
 (ActivityThread.java:1692)
 E/AndroidRuntime( 9449):        at android.os.Handler.dispatchMessage
 (Handler.java:99)
 E/AndroidRuntime( 9449):        at android.os.Looper.loop(Looper.java:123)
 E/AndroidRuntime( 9449):        at android.app.ActivityThread.main
 (ActivityThread.java:3948)
 E/AndroidRuntime( 9449):        at java.lang.reflect.Method.invokeNative
 (Native Method)
 E/AndroidRuntime( 9449):       

[android-developers] Unknown response Format coming from the server when i am using nusoap webservices

2009-07-03 Thread android.vinny

Hi

i am getting unknown format response form the server any help me what
type of response it is
how to parse that response

07-01 15:14:35.575: VERBOSE/Isizzle(879): getRatingResponse

{
return=ContestInfo{item=anyType{name=Ankitha; totalimages=2;
rating=2.5; }; item=anyType{name=Anushka; totalimages=4;
rating=9.5; }; item=anyType{name=Apsara; totalimages=1; rating=0;
};

Data what i am getting is correct the format is which type i am not
getting


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



[android-developers] Re: Detecting when the file system runs out of space

2009-07-03 Thread gjs

Hi,

See android.os.StatFs

The camera source code has an example of use

http://android.git.kernel.org/?p=platform/packages/apps/Camera.git;a=blob;f=src/com/android/camera/MenuHelper.java;h=a88f020e4c1bacdac50c4aa58bcbb7c68875772f;hb=HEAD

eg:

public static int calculatePicturesRemaining() {
 733 try {
 734 if (!ImageManager.hasStorage()) {
 735 return NO_STORAGE_ERROR;
 736 } else {
 737 String storageDirectory =
Environment.getExternalStorageDirectory().toString();
 738 StatFs stat = new StatFs(storageDirectory);
 739 float remaining = ((float)stat.getAvailableBlocks
() * (float)stat.getBlockSize()) / 40F;
 740 return (int)remaining;
 741 }
 742 } catch (Exception ex) {
 743 // if we can't stat the filesystem then we don't know
how many
 744 // pictures are remaining.  it might be zero but just
leave it
 745 // blank since we really don't know.
 746 return CANNOT_STAT_ERROR;
 747 }
 748 }

Regards

On Jul 3, 7:22 am, Chris rucinski.ch...@gmail.com wrote:
 This is quite a simple question, but I haven't yet been able to find a
 solution. How would one determine the number of bytes that are not
 used on the file system (both the main and the SD card) within an
 application? I'm writing an application that downloads content from
 the internet, and I'd rather not fill up my users' phones without at
 least giving them fair warning when their file system is about to fill
 up. 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] **never ever** use Toasts with Activity context

2009-07-03 Thread skink

hi,

take NotifyWithText api demo as example.

add in the begging of onCreate System.gc() and some logs with
getInstanceCount() and try to show any Toast, then exit NotifyWithText
demo. run it again - you will see getInstanceCount() increases leaking
Activities. repeat running demo couple of times. counter still
increases.

now change context passed to Toast.makeText() by
adding .getApplicationContext() - now getInstanceCount() always shows
5.

so beware with Toasts - always use app ctx

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

2009-07-03 Thread mak

Team,

Below code is working as I need to select first View by pressing left
arrow key which maked MapView as Current view and then pressing back
button. It is getting called.

Thanks for your patience.

Regards,
_-_Mayank Rana_-_

On Jul 3, 11:04 am, mak mayank.rana...@gmail.com wrote:
 Overlay Code:

  public class MyLocationOverlay extends
 com.google.android.maps.Overlay {
 �...@override
 public boolean onKeyDown(int keyCode,KeyEvent event, MapView view){
         System.out.println(==INSIDE onKeyDown
 ==);
          if(keyCode == KeyEvent.KEYCODE_BACK) {
                         System.out.println(HMM... Calling Your Key Event 
 \n);
                         return true;
         }
         return false;

 }

 Do I need to call this method explicitly from MapView Acitivity or as
 any keydown this will get called ?

 Appreciate your input on it.

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



[android-developers] Rotating map view

2009-07-03 Thread Sujay Krishna Suresh
Hi all,
  i'm tryin to give a better experience to the user by rotating
the map, similar to maps shown by games.
the user always stays at the center of the screen n the road that he's
moving on is always perpendicular to the screen top.
i'm using
 canvas.save(matrixflag);
 canvas.rotate(degrees, centerx, centery);
 canvas.restore();
but i'm always getting a blank space at one of the corners... can anyone
help me solve this??

-- 
Regards,
Sujay
Rita Rudner http://www.brainyquote.com/quotes/authors/r/rita_rudner.html
- I was a vegetarian until I started leaning toward the sunlight.

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



[android-developers] Re: Where to put local file on the phone

2009-07-03 Thread qLabs

no because ive tons of images, and i need to build the path from
parsing a string and then get the right image.
With ressources im obliged to use a giant switch case and to precise
for each of the case.
Regards,


On Jul 2, 4:28 pm, Nightwolf mikh...@gmail.com wrote:
 If you only need to assign some background to you ImageView you should
 use resources 
 instead.http://developer.android.com/guide/topics/resources/resources-i18n.html

 On Jul 2, 1:02 pm, qLabs quentin.font...@gmail.com wrote:

  okey so i found a solution

  here is it

  is = SharedData.context.getAssets().open(myFile);
  Bitmap bitmap=BitmapFactory.decodeStream(is);

  and after that i set my ImaveView sith setImageBitmap(bitmap).

  thanks u alot nightwolf

  Cheers

  On Jul 2, 10:28 am, qLabs quentin.font...@gmail.com wrote:

   First, thanks for replying.

   So since my asset directory did'nt exist, i created it and i placed 4
   folders in it, each one containing files.
   My goal is to set up image (the contained files) on ImageView object
   from a xml parser.
   So with the InputStream i don't know how to use it, i mean the only
   methods ive got from an ImageView are setImageDrawable(from
   ressources) or setImagebitmap...
   I might be dump but i have no clue how to use this InputStream for
   setup image to my ImageViews.

   Cheers

   On Jul 2, 6:39 am, Nightwolf mikh...@gmail.com wrote:

It's possible to store files to assets directory of your Android
project and access them like this

final InputStream is = context.getAssets().open(myfile.txt);

Asset files like resource files are included into application package
and you only need to install apk as usual.
For other approaches please check MediaPlayerDemo from APIDemos.
Confusing moment (for me) is that path to sd card should be started
with /sdcard/ (sorry, don't remember which slash is correct).
And remember that file name is case sensitive.

On Jul 1, 4:43 pm, qLabs quentin.font...@gmail.com wrote:

 Hello,

 Im trying to read some local files, and ive been reading a lot of
 stuff about it, but i still don't know where to store the files on my
 phone and how to get the right path.
 Some say, it should be stored on /data/data/your.package.here/files
 but where is that, i mean i can get there when using the emulator but
 i have no clue how to put files in this on a real device.

 Cheers,

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



[android-developers] flash(flv) related API available?

2009-07-03 Thread tainy

recent news say that flash porting is finished for android and HTC
Hero has support for flash.
Can I use MediaPlayer API to play flv media file?
Is there such documents?
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] Activity Lifecycle

2009-07-03 Thread Daniel

Hi,

I did an activity that reads a lot of preferences stuff in its
onCreate and configures the app accordingly. Since there is also some
multithreading going on in this activity reconfigureing after some
preferences change during runtime would be a complicated and error
prone task. So I decided to simple launch a new instance of the
activity after preferences changed and forget about the old one. I did
this using:

finish();
startActivity(getIntent());

But now I don't understand the activity lifecycle anymore. The
onCreate, onStart and onResume callbacks of the new activity are now
called before the onStop and onDestroy callbacks of the old activity I
want to replace. Only onPause is called before the new activity
starts.

May this also happen when not exclicipely restarting the activity.
Maybe when changeing the device's orientation?

Or is the above finish, startActivity sequence simply not a good
idea ;-). Is there no other way how an activity can restart itself?

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



[android-developers] Re: Find all active alarms

2009-07-03 Thread Dianne Hackborn
adb shell dumpsys alarm will have some debug information.  This is only
for debugging, not for applications.

On Thu, Jul 2, 2009 at 10:16 PM, Veroland marius.ven...@gmail.com wrote:


 Hi

 Is there a way to find all the alarms which is currently active set to
 go off?

 Thanks
 



-- 
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: how to modify value in AttributeSet?

2009-07-03 Thread Dianne Hackborn
Correct, this is not designed to allow you to modify it.  There are a lot of
serious optimizations (including calls into native code) that preclude it.

On Thu, Jul 2, 2009 at 7:22 PM, Yuchih liuyuc...@gmail.com wrote:


 Hi Dianne. Thanks for your answer.
 I have traced some source codes. I think a new AttributeSet is needed.
 First, I have to produce a XML from original AttributeSet with my
 modification.
 Then put this XML to XmlPullParser, and get new AttributeSet using
 Xml.asAttributeSet(...).
 But I have to modify obtainStyledAttributes() function (maybe more) in
 Resources.Theme Class to deal with generic XML.

 It seems a big work..., am I right?

 Thanks,

 Yuchih


 On 7月3日, 上午7時04分, Dianne Hackborn hack...@android.com wrote:
  Sorry, this is pretty much read-only.
 
 
 
  On Wed, Jul 1, 2009 at 11:05 PM, Yuchih liuyuc...@gmail.com wrote:
 
   Is there a simple way to modify value in AttributeSet?
 
   all i want to do is something like this:
   in Button.java
 
 public Button(Context context, AttributeSet attrs, int defStyle) {
 
   /**
   In origional XML, I have android:textSize=20sp.
   Then do something to make textSize attr. value + 2sp.
   The effect of this will make all button textSize bigger than original
   setting.
   **/
  super(context, attrs, defStyle);
  }
 
   Any suggestion is appreciated!
   Thanks.
 
  --
  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.
 



-- 
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: JIS conversion is ignored!

2009-07-03 Thread Hiro

Hi, Dan-san

which will construct a string by interpreting the bytes in the default
encoding. The default encoding on Android is UTF-8, so this is
probably not what you want.

I do understand the reason that a part of the input string is
corrupsed.

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



[android-developers] Re: import org.apache.commons.httpclient.HttpClient library error

2009-07-03 Thread Markuz05

Nithu:
are you using sdk 1.5 or 1.1?

Android  Development:
you can use only libraries compatible with android sdk.
For performance reasons Dalvik VirtualMachine is not the standard Java
VirtualMachine
so Android uses its API that are little different from Java standard
API.
This means that you can use any wrapper if it uses only compatible
Android libraries





On 3 Lug, 07:46, Android Development indodr...@gmail.com wrote:
 Hello,
 I have a custom library that is built as a wrapper around the apache commons
 http client libraries. Is it possible for me to use this library on android
 ? Or am i only limited to use the http client libraries as part of android ?



 On Fri, Jul 3, 2009 at 10:43 AM, Nithu nithi...@gmail.com wrote:

  Thanks for the reply

  But these two libraries not found I just checked using editor...
  and also you give the reference
  blog is also not found these libraries

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



[android-developers] How to get a java object property from javascript on Android?

2009-07-03 Thread eartied1

Hello,
I have an object

public class SMSMessage  {

public String id;
public String body;
public Boolean store;
public int folder;
public Boolean read;
public String recipient;

//Methods

public String getProperty(String propertyName)
{}

}

when I call from java script (after to enable the new javascript
interface):

mysms.getProperty(body);

I get the body value however, when I call

var mybody=mysms.body;

I don't get any value. How can I implement this to get property values
using
[object].[property] way and not with [object].getProperty
([propertyName])?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: import org.apache.commons.httpclient.HttpClient library error

2009-07-03 Thread Nithu

I am using sdk 1.5

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



[android-developers] Help- Video Recording - Camcorder

2009-07-03 Thread loril...@gmail.com

Can anyone please let me know where can I get source code for
camcorder?

Also, it would be of much help to me if anyone could post a simple
example for video recording, please.

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



[android-developers] Rotating map view

2009-07-03 Thread Sujay Krishna Suresh
Hi all,
   i'm tryin to provide a better experience to the user by
rotating the map, as in some games.
i want the user to always be in the center of the screen  the road he's
travelling to be perpendicular to the screen top.
plz help with suggestions n sample codes. thanks in advance.

-- 
Regards,
Sujay
Adrienne 
Gusoffhttp://www.brainyquote.com/quotes/authors/a/adrienne_gusoff.html
- Opportunity knocked. My doorman threw him out.

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



[android-developers] How to release resources when application ends?

2009-07-03 Thread Niko Gamulin
Hi,

I created an application which is displaying camera preview. When the
application terminates I noticed that some processes are still running. Also
if I try to run the original camera application it displays an error
(obviously due to the active process which belongs to the custom
application).

Does anyone know how to release all resources when application ends?

Thanks!

Niko

-- 
http://mypetprojects.blogspot.com/

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



[android-developers] Re: ListView with different types of View's

2009-07-03 Thread Pratap

Hi

You can do the same by extending BaseAdapter and simply override the
methods like getCount, getItem , getView etc,,
The getView method gets called for each List item.You only need to
create and return the list item from here.
Hope this helps
Cheers

On Jul 2, 6:45 pm, ayanir ayanir...@gmail.com wrote:
 Hello for all the Android's out there,

 I'm trying to make a ListView when every item in that list can be a
 different type of View.
 for example the list could be:
 1. TextView
 2. ImageView
 3. MyCustomView

 I understands that in order to make a list I need to use an Adapter.
 the problem is that the Adapter uses a single layout for all of the
 list items, which will not support the different views.

 my goal is to make an abstract View list when I can dynamically add
 and removes items in that list (each item is a View or subclass of
 it).

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



[android-developers] Re: Activity Lifecycle

2009-07-03 Thread hmmm

What if you make your activity singleTop and then use onNewIntent() in the same 
activity such as 
onCreate { configure(); }
onNewIntent { configure() }


-Original Message-
From: Daniel daniel.himmel...@googlemail.com
To: Android Developers android-developers@googlegroups.com
Date: Fri, 3 Jul 2009 00:38:44 -0700 (PDT)
Subject: [android-developers] Activity Lifecycle

 
 Hi,
 
 I did an activity that reads a lot of preferences stuff in its
 onCreate and configures the app accordingly. Since there is also some
 multithreading going on in this activity reconfigureing after some
 preferences change during runtime would be a complicated and error
 prone task. So I decided to simple launch a new instance of the
 activity after preferences changed and forget about the old one. I did
 this using:
 
 finish();
 startActivity(getIntent());
 
 But now I don't understand the activity lifecycle anymore. The
 onCreate, onStart and onResume callbacks of the new activity are now
 called before the onStop and onDestroy callbacks of the old activity I
 want to replace. Only onPause is called before the new activity
 starts.
 
 May this also happen when not exclicipely restarting the activity.
 Maybe when changeing the device's orientation?
 
 Or is the above finish, startActivity sequence simply not a good
 idea ;-). Is there no other way how an activity can restart itself?
 
 Best regards,
 Daniel
  


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



[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-03 Thread hmmm

Really? It will be interesting to hear Google engineers comment on this.

-Original Message-
From: skink psk...@gmail.com
To: Android Developers android-developers@googlegroups.com
Date: Thu, 2 Jul 2009 23:57:41 -0700 (PDT)
Subject: [android-developers] **never ever** use Toasts with Activity context

 
 hi,
 
 take NotifyWithText api demo as example.
 
 add in the begging of onCreate System.gc() and some logs with
 getInstanceCount() and try to show any Toast, then exit NotifyWithText
 demo. run it again - you will see getInstanceCount() increases leaking
 Activities. repeat running demo couple of times. counter still
 increases.
 
 now change context passed to Toast.makeText() by
 adding .getApplicationContext() - now getInstanceCount() always shows
 5.
 
 so beware with Toasts - always use app ctx
 
 thanks
 pskink
  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 Sujay Krishna Suresh
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: import org.apache.commons.httpclient.HttpClient library error

2009-07-03 Thread Android Development
Thanks for the reply Markuz05.
My API is a wrapper over the Apache HTTP Client API..which is a well tested
and proven API: http://hc.apache.org/httpclient-3.x/apidocs/

http://hc.apache.org/httpclient-3.x/apidocs/As you said, that the
libraries being used in an Android application need to be compatible with
the Android SDK, is there a wiki page in your knowledge that specifies the
non-compliant APIs for Android ?

What standard JAVA packages are supported and which ones are not ?

It will be very helpful, if i can get some info on this.


On Fri, Jul 3, 2009 at 1:46 PM, Nithu nithi...@gmail.com wrote:


 I am using sdk 1.5

 


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



[android-developers] Re: Gallery View using images from file (Dynamic vs. Static images)

2009-07-03 Thread And-Rider

may be this can help you out

http://learningandroid.org/tutorial/2009/02/gallery-tutorial-file-location

On Jul 2, 2:06 am, Logik yaros...@gmail.com wrote:
 The api demo for gallery uses resource id's to access the drawables in
 the gallery.

 I have tried multiple ways to use images from file. My steps...

 - 1. grab filepaths and save all files as a drawable array
 - 2. using the same logice in the api demo, I ste the background to
 the drawable
           instaed of the resid

 That's All I felt the need to replace from the api demo, which seems
 to fail miserably since the images do not appear in my test app.

  If you have any hints to help with this let me know,

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



[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-03 Thread skink



On Jul 3, 11:20 am, hmmm akul...@mail.ru wrote:
 Really? It will be interesting to hear Google engineers comment on this.

well, its nothing wrong with Toasts per se, they are working as api
docs describe, but when using wrong context they could give some
problems...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] any example of the video intent?

2009-07-03 Thread zeeshan

Hi Experts,

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



[android-developers] A question regarding Activities and Tasks.

2009-07-03 Thread Android Development
I had a question regarding this concept.
Suppose i have an application that defines a task. This task has some
activities that belong to another Android application. The Dev guide says,
that to maintain a uniform user experience, Android will maintain such
'distributed' activities as part of the same 'task' even if they belong to
different applications.

I refer to it from here:
http://developer.android.com/guide/topics/fundamentals.html

Some lines later, the Dev guide says and i quote:
*
*
***Suppose, for instance, that the current task has four activities in its
stack — three under the current activity. The user presses the HOME key,
goes to the application launcher, and selects a new application (actually, a
new task). The current task goes into the background and the root activity
for the new task is displayed. The current task goes into the background and
the root activity for the new task is displayed. Then, after a short period,
the user goes back to the home screen and again selects the previous
application (the previous task). That task, with all four activities in the
stack, comes forward. When the user presses the BACK key, the screen does
not display the activity the user just left (the root activity of the
previous task). Rather, the activity on the top of the stack is removed and
the previous activity in the same task is displayed.*

I think three under the current activity should be four under the same
task.

I think this paragraph i quote above has nothing to do with activities
distributed across applications..and belonging to the same task. This para
is maybe talking about two applications, that share a common application
launcher and each application has defined its own tasks (stack of
activities).

The user is simply toggling from one application to another, thus
demonstrating that all activities (of a task) move together. However,
the three
under the current activity phrase is confusing me.

Please correct me if I am wrong.

Thanks in advance..

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



[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-03 Thread hmmm

Is the following true: it is preferrable to always pass Applicatioon Context to 
any Toasts within the application?

-Original Message-
From: skink psk...@gmail.com
To: Android Developers android-developers@googlegroups.com
Date: Fri, 3 Jul 2009 03:06:36 -0700 (PDT)
Subject: [android-developers] Re: **never ever** use Toasts with Activity
context

 
 
 
 On Jul 3, 11:20 am, hmmm akul...@mail.ru wrote:
  Really? It will be interesting to hear Google engineers comment on this.
 
 well, its nothing wrong with Toasts per se, they are working as api
 docs describe, but when using wrong context they could give some
 problems...
  


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



[android-developers] Re: Memory leak in AudioTrack?

2009-07-03 Thread blindfold

Yes, I'm facing the exact same problem. It looks like a bug in
AudioTrack. For me the GREF count seems to increase by 2 for every
creation and use of AudioTrack, and it never goes down. I do not see
this problem when instead creating and using MediaPlayer (and writing
synthesized sound to flash memory), supporting the conclusion that the
problem lies with AudioTrack.

Thanks

On Jun 27, 5:59 pm, Morné Pistorius mpistor...@gmail.com wrote:
 Hi all,

 If I create and release multiple AudioTrack objects, theGREFcount
 continually increases which eventually causes an application crash.
 This small test code snipped illustrates the problem:

                 byte[] buffer = readAudioFile( audio.raw );
                 for ( int n = 0; n  10; ++n )
                 {
                         for ( int i = 0; i  100; ++i )
                         {
                                 Log.v(Info, Track  + n + , + i );
                                 AudioTrack newTrack = new AudioTrack
 ( AudioManager.STREAM_MUSIC, 16000,
                                                                               
               AudioFormat.CHANNEL_CONFIGURATION_MONO,

 AudioFormat.ENCODING_PCM_16BIT,

 buffer.length, AudioTrack.MODE_STATIC );

                                 newTrack.write( buffer, 0, buffer.length );
                                 newTrack.flush();
                                 newTrack.release();
                         }

                         Runtime.getRuntime().gc();
                 }

 Even with a forced garbage collection, I end up with the same highGREFcount 
 at the end of the loop.  In my application, I continuously
 create AudioTracks from variable lenght buffers.  I guess I can try
 and use a fixed size pool of AudioTracks each with a buffer large
 enough to fit my longest sound, and try and reuse them.  Is there a
 better/correct way to completely clear resources used by an
 AudioTrack?

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



[android-developers] Item click on LiveFolder

2009-07-03 Thread glory

Hi ,

How to open the Activity on click of the Item in the Live Folder
I am able open the browser Instance but not able to start the
Activity .

Is there any way I can handle the click event in the LiveFolder

Please Help me out

Thanks in advance
Regards
Glory
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
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: import org.apache.commons.httpclient.HttpClient library error

2009-07-03 Thread Markuz05

All libraries documented in the reference 
http://developer.android.com/reference/packages.html

For example if you want to use an HttpClient you have to check if an
Android implementation exists.
And, as you can see,  there is an implementation of the abstract class
HttpClient called DefaultHttpClient. This class is not the
org.apache.commons.httpclient.HttpClient but you can use it in your
Android enviroment.



On 3 Lug, 11:54, Android Development indodr...@gmail.com wrote:
 Thanks for the reply Markuz05.
 My API is a wrapper over the Apache HTTP Client API..which is a well tested
 and proven API:http://hc.apache.org/httpclient-3.x/apidocs/

 http://hc.apache.org/httpclient-3.x/apidocs/As you said, that the
 libraries being used in an Android application need to be compatible with
 the Android SDK, is there a wiki page in your knowledge that specifies the
 non-compliant APIs for Android ?

 What standard JAVA packages are supported and which ones are not ?

 It will be very helpful, if i can get some info on this.



 On Fri, Jul 3, 2009 at 1:46 PM, Nithu nithi...@gmail.com wrote:

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



[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-03 Thread skink



On Jul 3, 12:23 pm, hmmm akul...@mail.ru wrote:
 Is the following true: it is preferrable to always pass Applicatioon Context 
 to any Toasts within the application?


based on my latest test i made: yes, app context is only one so
android 'leaks' only Application, but in fact its not leak since
Application is also singleton and lives during the whole process
anyway.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: SlidingDrawer issue #1?

2009-07-03 Thread brian.schimmel

The same with me. Just filed a bug report at
http://code.google.com/p/android/issues/detail?id=3162
You can go there and star the issue to get notified on changes.

wbr,
Brian

On 19 Mai, 14:47, brindy bri...@brindy.org.uk wrote:
 Yep, exactly the same here. =)

 Cheers,
 Brindy

 On May 7, 11:27 am, cannehal tomasz.l...@gmail.com wrote:

  As I said before I have the same issue as Sheepz. It works fine in
  runtime, but in layout editor in eclipse there is Exception. For me it
  looks like a bug in plugin.
  And for forthcoming questions: I am using latest SDK (1.5) and proper
  eclipse plugin.

  On May 6, 1:34 am, Sheepz eladk...@gmail.com wrote:

   if you mean 1.5, yes i am, i have also updated the editors for eclipse
   as described in the upgrade sdk page.

   On May 5, 7:06 pm, dan raaka danra...@gmail.com wrote:

are you using the latest version of SDK ?

On Tue, May 5, 2009 at 4:04 PM, Sheepz eladk...@gmail.com wrote:

 I took a look at the api
http://developer.android.com/reference/android/widget/SlidingDrawer.html
 and copied their example to a clean sandbox project
 this is the code:
 [beginquote]

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

  SlidingDrawer
     android:id=@+id/drawer
     android:layout_width=fill_parent
     android:layout_height=fill_parent

     android:handle=@+id/handle
     android:content=@+id/content

     ImageView
         android:id=@id/handle
         android:layout_width=88dip
         android:layout_height=44dip
         android:src=@drawable/icon /

     GridView
         android:id=@id/content
         android:layout_width=fill_parent
         android:layout_height=fill_parent 
         /GridView

  /SlidingDrawer

 /LinearLayout

 [endquote]

 this gives out the exception in eclipse, but it does run well...
 does anybody know why this is happening? can anyone else confirm this
 is happening on their environment?
 Thanks,
 Sh

 On May 1, 11:29 pm, Sheepz eladk...@gmail.com wrote:
  anyone found a solution?

  On May 1, 10:03 am, cannehal tomasz.l...@gmail.com wrote:

   I tkink I have the same issue. For handle I have ImageView and for
   content I am using LinearLayout with some views inside of it.
   There is probably problem with eclipse plugin because in runtime 
   it
   works fine.

   On May 1, 7:01 am, Sheepz eladk...@gmail.com wrote:

anyone else found something here?

On Apr 30, 5:43 pm, Sheepz eladk...@gmail.com wrote:

 okay, that didnt work :(
 SlidingDrawerandroid:id=@+id/SlidingDrawer01
 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:handle=@+id/ImageView01
 android:content=@+id/ImageView02
 ImageView android:id=@id/ImageView01
 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:src=@drawable/back2/
 ImageView
 ImageView android:id=@id/ImageView02
 android:layout_width=wrap_content
 android:layout_height=wrap_content 
 android:src=@drawable/ahh/
 ImageView
 /SlidingDrawer

 still getting the same message in the ADT only now when 
 launching
 the
 app, it simply stalls half drawn instead of giving an error 
 message
 saying the application threw an exception...

 On Apr 30, 5:40 pm, Romain Guy romain...@google.com wrote:

  You must use different views, it doesn't make sense to have 
  the
 same
  view, it's going to confuseSlidingDrawer:)

  On Thu, Apr 30, 2009 at 2:38 PM, Sheepz eladk...@gmail.com
 wrote:

   yeah, i figured that might be it, but even after this fix:
   SlidingDrawerandroid:id=@+id/SlidingDrawer01
   android:layout_width=wrap_content
   android:layout_height=wrap_content
 android:handle=@+id/ImageView01
   android:content=@+id/ImageView01
   ImageView android:id=@id/ImageView01
   android:layout_width=wrap_content
   android:layout_height=wrap_content
 android:src=@drawable/ahh/
   ImageView
   /SlidingDrawer
   i still get the same error - i'm gonna try using diffrent 
   views
 for
   the content and the handle
   brb :)

   On Apr 30, 5:32 pm, Romain Guy romain...@google.com 
   wrote:
   There is a bug indeed, the exception message says the 
   handle
 is
   missing, but the content is missing. Check out the 
   javadoc.
 I'll fix
   the exception message.

   On Thu, Apr 30, 2009 at 2:26 

[android-developers] Re: Canvas.drawText failing to draw on a second call

2009-07-03 Thread MrChaz

you're calling canvas.restore() which clears out all changes since the
last call of canvas.save()
I'd try taking out that line.

On Jul 2, 8:57 pm, Casper vijay...@gmail.com wrote:
 public class TCheckBox extends CheckBox{
 public void onDraw(Canvas canvas){

                Paint tTextPaint = new Paint();
                 tTextPaint.setColor(Color.BLACK);

                 canvas.drawText(mtext1, getPaddingLeft(), getBottom(),
 tTextPaint);

                 int width = getWidth();

                 Paint tTextPaint2 = new Paint();
                 tTextPaint2.setColor(Color.BLACK);
                 int tSize = (int)tTextPaint2.measureText($.00);
                 canvas.drawText(mtext2, width - tSize, getBottom(), 
 tTextPaint2);
                 canvas.restore();
  }

 }

 public void renderCheckBox(){
  mTCheckBox[mCheckBoxCounter] = new TCheckBox(this);

                            if(mTCheckBox[mCheckBoxCounter] != null){

                                
 linearLayout.addView(mTCheckBox[mCheckBoxCounter]);
                                mCheckBoxCounter++;
                            }
                            sView.postInvalidate();
                    }
   }

 My first call to renderCheckBox could render the check box with text1,
 and text2. From second time onwards, my text is not being rendered but
 the checkBox is getting rendered. I am not knowing what might be the
 reason for the failure. Could some one help with this problem.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to release resources when application ends?

2009-07-03 Thread MrChaz

We can't really help without seeing the code in question really.
Don't forget that when you press home or whatever to move away from
your application it isn't necessarily closed so much as minimized.

On Jul 3, 10:13 am, Niko Gamulin niko.gamu...@gmail.com wrote:
 Hi,

 I created an application which is displaying camera preview. When the
 application terminates I noticed that some processes are still running. Also
 if I try to run the original camera application it displays an error
 (obviously due to the active process which belongs to the custom
 application).

 Does anyone know how to release all resources when application ends?

 Thanks!

 Niko

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



[android-developers] how to know if we have a 2G or 3G sim card

2009-07-03 Thread GAYET Thierry
Hi, i am looking for the information that can tell me if the sim/usim card 
inserted accept/support 2G and/or 3G ?

I need this information in order to adapt some call to the sim card. If the sim 
card support only 2G network, an APDU will be call, then if the usim card is 3G 
another APDU will be called instead.

 Regards


Thierry GAYET
NextInnovation.org
+33(0)663.849.589



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

2009-07-03 Thread som

As i was trying to get an idea of the SP and WP in android, i was
wondering where is the source code for these two classes. Can anybody
tell me where i can find out the implementation of WP and SP within
the android source code?

thanks in advance

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



[android-developers] Re: What is the best way to implement dynamic textures in OpenGL ES?

2009-07-03 Thread MrChaz

As I understand it
glBindTexture() sets the active texture by it's Id
and
glTexImage2D() fills whatever the active texture is with the contents
of the buffer

so recalling that ought to change the texture

On Jul 2, 6:52 am, Bruce Rees baree...@gmail.com wrote:
 Hi All,

 I have a texture-mapped cube based in part on the Kube API demo and
 the Textured Cube example from anddev.org,  It is working fine using
 bitmaps loaded from R.drawable.. what I need to do now is to make the
 texture for each face dynamic (using Bitmaps created in code).  I'm
 having trouble understanding how to change the textures on the fly and
 I'm hoping someone can point me in the right direction..

 This is the code that initially sets a texture:

                 gl.glBindTexture(GL10.GL_TEXTURE_2D, texBuf.get(num));
                 Bitmap bmp = 
 BitmapFactory.decodeResource(context.getResources(),
 id);
                 int pixels[] = new int[TEX_SIZE * TEX_SIZE];
                 bmp.getPixels(pixels, 0, TEX_SIZE, 0, 0, TEX_SIZE, TEX_SIZE);
                 int pix1[] = new int[TEX_SIZE * TEX_SIZE];
                 for (int i = 0; i  TEX_SIZE; i++)
                 {
                         for (int j = 0; j  TEX_SIZE; j++)
                         {
                                 //correction of R and B
                                 int pix = pixels[i * TEX_SIZE + j];
                                 int pb = (pix  16)  0xff;
                                 int pr = (pix  16)  0x00ff;
                                 int px1 = (pix  0xff00ff00) | pr | pb;
                                 //correction of rows
                                 pix1[(TEX_SIZE - i - 1) * TEX_SIZE + j] = px1;
                         }
                 }

                 IntBuffer tbuf = IntBuffer.wrap(pix1);
                 tbuf.position(0);
                 gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, TEX_SIZE,
 TEX_SIZE, 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, tbuf);
                 gl.glTexParameterx(GL10.GL_TEXTURE_2D, 
 GL10.GL_TEXTURE_MIN_FILTER,
 GL10.GL_LINEAR);
                 gl.glTexParameterx(GL10.GL_TEXTURE_2D, 
 GL10.GL_TEXTURE_MAG_FILTER,
 GL10.GL_LINEAR);

 What would I need to change in this code to allow an existing texture
 to be replaced (eg. a new Bitmap would be passed in instead of loading
 the resource, but when I try this the texture remains unchanged).

 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: A question regarding Activities and Tasks.

2009-07-03 Thread Peli

 I think three under the current activity should be four under the same
 task.

Both is correct: It is a semantic problem of the word under:
* four under the same task: There are four activities *within* this
task
* three under the current activity: There are three activities
*below* the current activity.

Ok? There are activities A, B, C, D on top of each other. D is the top
activity, and three activities (A, B, and C) are below, or under
activity D.

 I think this paragraph i quote above has nothing to do with activities
 distributed across applications..and belonging to the same task.

It can be, because activities A, B, C, and D don't have to be from the
same application.

A can be OI Notepad list of notes, B can be a OI Notepad note, C can
be OI Convert CSV, and D can be OI File manager (so there are
activities from 3 different applications). The user started with
notepad, wanted to export all notes, and now chooses a location for
saving the notes to be exported.

If the user goes back to home screen, and launches OI Notepad again,
(s)he is presented with OI File manager to select a file location
(because that is the activity on top of the OI Notepad stack).

Peli
www.openintents.org

On Jul 3, 12:06 pm, Android Development indodr...@gmail.com wrote:
 I had a question regarding this concept.
 Suppose i have an application that defines a task. This task has some
 activities that belong to another Android application. The Dev guide says,
 that to maintain a uniform user experience, Android will maintain such
 'distributed' activities as part of the same 'task' even if they belong to
 different applications.

 I refer to it from 
 here:http://developer.android.com/guide/topics/fundamentals.html

 Some lines later, the Dev guide says and i quote:
 *
 *
 ***Suppose, for instance, that the current task has four activities in its
 stack — three under the current activity. The user presses the HOME key,
 goes to the application launcher, and selects a new application (actually, a
 new task). The current task goes into the background and the root activity
 for the new task is displayed. The current task goes into the background and
 the root activity for the new task is displayed. Then, after a short period,
 the user goes back to the home screen and again selects the previous
 application (the previous task). That task, with all four activities in the
 stack, comes forward. When the user presses the BACK key, the screen does
 not display the activity the user just left (the root activity of the
 previous task). Rather, the activity on the top of the stack is removed and
 the previous activity in the same task is displayed.*

 I think three under the current activity should be four under the same
 task.

 I think this paragraph i quote above has nothing to do with activities
 distributed across applications..and belonging to the same task. This para
 is maybe talking about two applications, that share a common application
 launcher and each application has defined its own tasks (stack of
 activities).

 The user is simply toggling from one application to another, thus
 demonstrating that all activities (of a task) move together. However,
 the three
 under the current activity phrase is confusing me.

 Please correct me if I am wrong.

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



[android-developers] Re: How drawing cache in View works

2009-07-03 Thread ioRek

nothing but blank Bitmap, can't find why

On 4 mai, 23:22, Romain Guy romain...@google.com wrote:
 getDrawingCache() will call buildDrawingCache() if thedrawingcache
 is enabled. If you want to get the darwingcachewithout enabling it,
 just call buildDrawingCache() before calling getDrawingCahce() (and
 call destroyDrawingCache() when you're done.)





 On Mon, May 4, 2009 at 2:18 PM, Jeff Sharkey jshar...@android.com wrote:

  Call setDrawingCacheEnabled(), then buildDrawingCache() as needed.

  j

  On Mon, May 4, 2009 at 2:14 PM, Meryl Silverburgh
  silverburgh.me...@gmail.com wrote:

  Can you please tell me how does android determine when View should
  enable thedrawingcache?

  I try calling in my class (which inherits form LinearLayout)

  Bitmap drawingCache = getDrawingCache();

  I get a null in my drawingCache.

  Thank you.

  On Thu, Apr 30, 2009 at 3:48 PM, Romain Guy romain...@google.com wrote:

  You can also use the View'sdrawingcacheAPI.

  On Thu, Apr 30, 2009 at 3:38 PM, dan raaka danra...@gmail.com wrote:
  Bitmap b = Bitmap.create( );
  Canvas c = new Canvas(b);
  your_view.draw(c);
  use b to in setDrawable else where

  there are missing lines, but you should get the idea
  Dan

  On Thu, Apr 30, 2009 at 2:23 PM, Moto medicalsou...@gmail.com wrote:

  Hi,

  I need to somehow get a drawable of the contents of a Layout, once I
  get that drawable I want to set it as a background on an empty
  layout

  How can I go about doing this?

  Thanks!
  Moto!

  --
  Romain Guy
  Android framework engineer
  romain...@android.com

  Note: please don't send private questions to me, as I don't have time
  to provide private support.  All such questions should be posted on
  public forums, where I and others can see and answer them

  --
  Jeff Sharkey
  jshar...@google.com

 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] ScrollView changs the behavior of the layout even when it's not active.

2009-07-03 Thread 7Droid

Hi,

My problem is that I would like a button (e.g. Next) to be at the
bottom of the screen, unless the content is larger than the screen, in
which case it should be scrolled.

I can achieve having a layout at the bottom (either trough
RelativeView layout_alightToParentBottom=yes, LinearLayout with a
View with weight=1 and layout_height=0, or a TableLayout
expandRow). However, with each one, once it is wrapped with a
ScrollView, the button is brought up next to the previous component,
and cannot be glued to the bottom. The ScrollView is not active
(needed, components height less than the screen height), yet it
affects the components in it. Is that a bug? Is there a way arround
it?

Any help/suggestion would be much appreciated, as I resorted to having
alternative layouts for Landscape, 320x240 and code.

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



[android-developers] Camera preview and sensor orientation values

2009-07-03 Thread lufo

Hi all,

I'm trying to use Camera preview in combination with Orientation
sensor. I got a serious problem with the sensor when using the
preview: values returned by the sensor are as (1.6893509E-9, -4.0,
0.0) instead of being in degrees (especially the former).

I tested that not creating the preview in which will reside the camera
output (class Preview extends SurfaceView implements
SurfaceHolder.Callback) , the sensor results are in range 0:360,
prefectly.

Is it possible that opening the camera could  generate errors in
sensor calculations ?

Does anyone has an idea ?


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



[android-developers] Re: What is the best way to implement dynamic textures in OpenGL ES?

2009-07-03 Thread Tom Gibara
Also you can use glTexSubImage2D() if only a portion of your bitmap is
changing. For these sorts of operations android.opengl.GLUtils will be
*much* more efficient (and simpler) than your current approach of populating
a ByteBuffer since the native helper methods can access the Bitmap pixel
data directly.
Tom

2009/7/2 Bruce Rees baree...@gmail.com


 Hi All,

 I have a texture-mapped cube based in part on the Kube API demo and
 the Textured Cube example from anddev.org,  It is working fine using
 bitmaps loaded from R.drawable.. what I need to do now is to make the
 texture for each face dynamic (using Bitmaps created in code).  I'm
 having trouble understanding how to change the textures on the fly and
 I'm hoping someone can point me in the right direction..

 This is the code that initially sets a texture:

gl.glBindTexture(GL10.GL_TEXTURE_2D, texBuf.get(num));
Bitmap bmp =
 BitmapFactory.decodeResource(context.getResources(),
 id);
int pixels[] = new int[TEX_SIZE * TEX_SIZE];
bmp.getPixels(pixels, 0, TEX_SIZE, 0, 0, TEX_SIZE,
 TEX_SIZE);
int pix1[] = new int[TEX_SIZE * TEX_SIZE];
for (int i = 0; i  TEX_SIZE; i++)
{
for (int j = 0; j  TEX_SIZE; j++)
{
//correction of R and B
int pix = pixels[i * TEX_SIZE + j];
int pb = (pix  16)  0xff;
int pr = (pix  16)  0x00ff;
int px1 = (pix  0xff00ff00) | pr | pb;
//correction of rows
pix1[(TEX_SIZE - i - 1) * TEX_SIZE + j] =
 px1;
}
}

IntBuffer tbuf = IntBuffer.wrap(pix1);
tbuf.position(0);
gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA,
 TEX_SIZE,
 TEX_SIZE, 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, tbuf);
gl.glTexParameterx(GL10.GL_TEXTURE_2D,
 GL10.GL_TEXTURE_MIN_FILTER,
 GL10.GL_LINEAR);
gl.glTexParameterx(GL10.GL_TEXTURE_2D,
 GL10.GL_TEXTURE_MAG_FILTER,
 GL10.GL_LINEAR);

 What would I need to change in this code to allow an existing texture
 to be replaced (eg. a new Bitmap would be passed in instead of loading
 the resource, but when I try this the texture remains unchanged).

 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: onTouchListener problem: trying to move a view

2009-07-03 Thread ioRek

did you try to add setFocusable, setClickable etc ?

On 29 juin, 15:03, Carl carl...@gmail.com wrote:
 I'm trying to move two views (more later on) around the screen by
 touching and dragging them. Unfortunately only one of them moves when
 I touch the screen. Have any ideas?

 The Ball class is the class representing theViewI want to move.

 package test.com;

 import android.app.Activity;
 import android.graphics.Color;
 import android.os.Bundle;
 import android.widget.FrameLayout;

 public class test extends Activity {

         public int index = 0;

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

         FrameLayout main = (FrameLayout) findViewById(R.id.main_view);

         Ball ball1 = new Ball(this,50,50,25, 0x);
         ball1.setId(1);
         main.addView(ball1);

         Ball ball2 = new Ball(this,75,75,25, Color.BLUE);
         ball2.setId(2);
         main.addView(ball2);
     }

 }

 package test.com;

 import android.content.Context;
 import android.graphics.Canvas;
 import android.graphics.Paint;
 import android.view.MotionEvent;
 import android.view.View;
 import android.widget.FrameLayout;

 public class Ball extendsView{
     private float x;
     private float y;
     private int r;
     private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

     public Ball(Context context, float x, float y, int r, int color) {
         super(context);
         mPaint.setColor(color);
         this.x = x;
         this.y = y;
         this.r = r;

         this.setOnTouchListener(newView.OnTouchListener() {
                         @Override
                         public booleanonTouch(Viewv, MotionEvent e)
                         {
                                 float x = e.getX();
                                                         float y = e.getY();
                                                         int eventaction = 
 e.getAction
 ();

                                                         Ball aa = (Ball)v;

                                                         switch (eventaction)
                                                         {
                                                     case 
 MotionEvent.ACTION_MOVE:
                                                    aa.setLocation(x, y);
                                                       break;

                                                          }

                                 return true;
                         }
         });

     }

     @Override
     protected void onDraw(Canvas canvas) {
         super.onDraw(canvas);
         canvas.drawCircle(x, y, r, mPaint);
     }

     public void setLocation(float newX, float newY)
     {
         this.x = newX;
         this.y = newY;
         this.invalidate();
     }



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

2009-07-03 Thread Niko Gamulin
The code is quite complex. To simplify the question I would like to know if
there is any function that terminates all the processes which were running
inside the application.

If I make a method obButtonExit() and bind it to a custom button, which
existing methods should be called inside the onButtonExit() in order to
release all the resources used by the running activity and terminate all the
processes?

Regards,

Niko

On Fri, Jul 3, 2009 at 1:19 PM, MrChaz mrchazmob...@googlemail.com wrote:


 We can't really help without seeing the code in question really.
 Don't forget that when you press home or whatever to move away from
 your application it isn't necessarily closed so much as minimized.

 On Jul 3, 10:13 am, Niko Gamulin niko.gamu...@gmail.com wrote:
  Hi,
 
  I created an application which is displaying camera preview. When the
  application terminates I noticed that some processes are still running.
 Also
  if I try to run the original camera application it displays an error
  (obviously due to the active process which belongs to the custom
  application).
 
  Does anyone know how to release all resources when application ends?
 
  Thanks!
 
  Niko
 
  --http://mypetprojects.blogspot.com/
 



-- 
http://mypetprojects.blogspot.com/

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



[android-developers] How can we Print Soap Object response in web services

2009-07-03 Thread android.vinny

Hi

How can we print the SoapObject response without converting into
toString() format .

i need to print the soap envelope Object reposne directly in the XML
form How can i get it?

or that Soap Object should write in a File ?

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



[android-developers] How to let soft keyboard cover on the activity view without pan resize?

2009-07-03 Thread Oceanedge

Hi,

   I have an activity that shows an AlertDialog. The AlertDialog
contains a EditText. So when the soft keyboard is shown for the
EditText in the dialog. The background activity content view don't
have to be resized or paned.  I wonder how to implement this behavior?
Because I found, the first time the soft keyboard is shown for the
EditText in the dialog, the keyboard cover on the background activity
content without pan  resize it. But after I close the dialog  press
up  down D-pad key, then show the dialog again, tap on the EditText.
The soft keyboard will shown while pan the background activity content
view. I don't know how to solve this inconsistency. I've tried to add
android:windowSoftInputMode=adjustResize but it doesn't work.

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



[android-developers] Re: How can I stop the Location Manager service

2009-07-03 Thread JP


Well as long as you request the removal of listeners, you are fine.
Are you aware you need to do this yourself in onPause(), onStop() or
onDestroy()?


On Jul 2, 9:48 pm, tstanly tsai.sta...@gmail.com wrote:
 if really have close,it should be stop immediatly(status symbol is
 disappear)

 so how can i removed the listener correctly???

 On Jul 3, 11:37 am, JP joachim.pfeif...@gmail.com wrote:

  I found it sometimes takes a couple of seconds for GPS to stop (or
  rather: for the status symbol to disappear).
  Also - are you sure you haven't registered more listeners than you
  remove? Location providers stay on until the last listener is removed.

  On Jul 2, 8:22 pm,tstanlytsai.sta...@gmail.com wrote:

   hi all,

   i have a location manager:

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

   because i want to stop the gps service,
   but when i use

   mLocationManager01.removeUpdates(mLocationListener01);

   that's not working to stop gps.

   how can i stop it?

   thank you- Hide quoted text -

  - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
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 docs on HTC Magic (poss all gphones)

2009-07-03 Thread Cédric Berger

On Fri, Jul 3, 2009 at 08:38, chris.compochris.co...@googlemail.com wrote:

 Hi All

 I am using a Htc Magic, I can access my docs ok but when I tried to
 edit a shared spreadsheet from the phone I could not do it, it viewed
 perfectly.


 Is it possible to edit from phone? should it be ? could it be as would
 really help me loads...

I do not know what is supposed to be editable in Docs.
But I could edit spreadsheets. (I did not try with a lot of docs, but
it for example worked with a spreadsheet which had been created by the
MyTracks application)
In the spreadsheet, there is a + Add button on top to add a new row,
or when you touch a row it becomes editable (each column is an
editable field), with a Submit button to validate.

I could not edit text document though ! Only spreadsheets...

(I did this with a Magic too. No need for hard keyboard.)


Did you try with another doc ? Are you sure you had rights to edit
this shared spreadsheet ??

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



[android-developers] Multiple points on a map

2009-07-03 Thread alexdonnini

Hello,

I need advice/pointers on how to display on a map multiple points that
change somewhat infrequently based on the device's location.

Currently, my application already displays in real-time the device's
changing location on a map. I can also easily display the location of
one of the other points of interest.

However, I have not figured out a way to have both displayed on a map
at the same time.

Nay help, hint, pointer, advice, would be greatly appreciated.

Thanks.

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



[android-developers] Re: Home Screen Sample

2009-07-03 Thread Anthony Xu

I got the same issue, and found there is no file named favorites.xml
in /system/etc/
This sample is designed to add the favorite applications into a bar
bottom the screen, but I don't what are the favorite applications in
android, and don't know how to favorite the application any way.

Any body, any idea?


On Jul 2, 1:22 pm, bayeeblue bayeeb...@gmail.com wrote:
 Hi all,

 I am able to compile theHomeSamplein the 1.5 SDK, however, when
 tried to run in emulator or real device, it force close when I try to
 switch the thisHomeSample. I was told to move the if(mFavorites)
 block up in bindFavorites() function, but it still not working.

 Anyone know how to get it work ?

 Thanks.

 Best Wishes,
 Bayeeblue

 --
     private void bindFavorites(boolean isLaunching) {
         if (!isLaunching || mFavorites == null) {
             FileReader favReader;
             // Environment.getRootDirectory() is a fancy way of
 saying
 ANDROID_ROOT or /system.
             final File favFile = new File
 (Environment.getRootDirectory
 (), DEFAULT_FAVORITES_PATH);
             /* move this up before try catch */
             if (mFavorites == null) {
                 mFavorites = new LinkedListApplicationInfo();
             } else {
                 mFavorites.clear();
             }
             try {
                 favReader = new FileReader(favFile);
             } catch (FileNotFoundException e) {
                 Log.e(LOG_TAG, Couldn't find or open favorites file
 
 + favFile);
                 return;
             }
 --
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-03 Thread skink



On Jul 3, 12:43 pm, skink psk...@gmail.com wrote:
 On Jul 3, 12:23 pm, hmmm akul...@mail.ru wrote:

  Is the following true: it is preferrable to always pass Applicatioon 
  Context to any Toasts within the application?

 based on my latest test i made: yes, app context is only one so
 android 'leaks' only Application, but in fact its not leak since
 Application is also singleton and lives during the whole process
 anyway.

and since Toast internally uses notification service the same may
apply to Notifications but i didn't check it yet

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



[android-developers] Re: Multiple points on a map

2009-07-03 Thread MrChaz

You can have multiple overlays at the same time.
In my application I have one for traffic incidents and one for
roadworks.


On Jul 3, 3:08 pm, alexdonnini alexdonn...@ieee.org wrote:
 Hello,

 I need advice/pointers on how to display on a map multiple points that
 change somewhat infrequently based on the device's location.

 Currently, my application already displays in real-time the device's
 changing location on a map. I can also easily display the location of
 one of the other points of interest.

 However, I have not figured out a way to have both displayed on a map
 at the same time.

 Nay help, hint, pointer, advice, would be greatly appreciated.

 Thanks.

 Alex Donnini
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
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 docs on HTC Magic (poss all gphones)

2009-07-03 Thread Cédric Berger

2009/7/3 Cédric Berger cedric.berge...@gmail.com:

 I could not edit text document though ! Only spreadsheets...


Note thats was with language set as English-US, but to be sure I have
also just tested with French, and I could edit too.

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



[android-developers] Re: create new home screen

2009-07-03 Thread Anthony Xu

Hi Romain Guy,

There are some other threads about 'sampe home', i.e.
http://groups.google.com/group/android-developers/browse_thread/thread/d589e8e14179c0cd/f22d10100909060a?lnk=gstq=sample+home#f22d10100909060a
My new question is how to use widget in user home?
Could you give some idea?
Thanks.

Anthony Xu

On May 21, 2:47 am, Romain Guy romain...@google.com wrote:
 It's in the SDK :)

 On Tue, May 19, 2009 at 2:02 PM, androiddev123



 androiddev123ph...@googlemail.com wrote:

  Hi Mark,

  Can you provide myself with the entire directory source code for this
  app?

  Regards,

  On May 4, 7:05 pm, Mark Murphy mmur...@commonsware.com wrote:
  droiddroid wrote:
   How areaHomeand Sweeterhomehijacking thehomepage?  I have the
   SDK, but have no idea how to do it.

  The Android SDK comes with asamplehomescreen application.

  Most of the magic is in the AndroidManifest.xml file:

  activity android:name=Home
                  android:theme=@style/Theme
                  android:launchMode=singleInstance
                  android:stateNotNeeded=true
              intent-filter
                  action android:name=android.intent.action.MAIN /
                  category android:name=android.intent.category.HOME/
                  category android:name=android.intent.category.DEFAULT /
              /intent-filter
  /activity

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

  _The Busy Coder's Guide to Android Development_ Version 2.0 Available!

 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Google docs on HTC Magic (poss all gphones)

2009-07-03 Thread Cédric Berger

2009/7/3 Cédric Berger cedric.berge...@gmail.com:
 2009/7/3 Cédric Berger cedric.berge...@gmail.com:

 I could not edit text document though ! Only spreadsheets...


Is there any help documentation about these google docs features from
android browser ?



I can only edit values (text, numbers), not formulas. I can also
change the column on which to sort.

I could not add a column either (adding a row worked).


- Here is a little example I just created from my PC. I then edited
it from my phone, adding text in the second column, changing 1 number,
and creating a second row, with 1 text cell.

https://spreadsheets.google.com/ccc?key=0An31aqh2F15ycm9FZlpfZHl4U1p4d1Z2V0FCN3FLZmchl=en
(not shared with edit rights, so do not try to edit this one...)

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



[android-developers] adding support for new containers/protocols to mediaplayer ?

2009-07-03 Thread sbw.android

hi,
is it possible, using sdk or ndk, to add support for new multimedia
containers (avi, mpeg, ...) or for new transport protocols to the
mediaplayer?

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: adding support for new containers/protocols to mediaplayer ?

2009-07-03 Thread Marco Nelissen

On Fri, Jul 3, 2009 at 7:54 AM, sbw.androidsbw.andr...@gmail.com wrote:

 hi,
 is it possible, using sdk or ndk, to add support for new multimedia
 containers (avi, mpeg, ...) or for new transport protocols to the
 mediaplayer?

No.

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



[android-developers] Re: Custom ViewGroup with animated View inside

2009-07-03 Thread ioRek

interesting question :D

On 17 juin, 21:15, Deren adam.d0...@gmail.com wrote:
 I want to have a ViewGroup with anotherViewin it. The user should be
 able tomovethe otherViewaround the ViewGroup, and fling it away.
 However, the innerViewshouldnt onlymove, it should also scale and
 so on (so we dont restrain ourselves to just movements). I don't
 really know the best way to implement it.

 First I though about using a ViewGroup pretty much as it is (i.e. take
 advantage of the already-written methods). Then I could do the
 flinging with an Animation. However, when ImovetheViewaround with
 my finger, wouldnt I have to do a requestLayout, since theView
 changes size when Imoveit? Or could I just set a transform?

 The other alternative would be to override the draw-method and do most
 of the work myself. For instance, when the user moves his/her finger,
 I could get a cache of theViewand just paint it on the Canvas (with
 some transform). However, how would I do the flinging then, without an
 Animation? I could use a Scroller/VelocityTracker, but What would
 drive the repaints?

 Which is the best way to do this? Also, I won't have just oneView,
 but a couple of them, so I'd like the solution to be effective.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
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 do i compile platform/packages/apps applications ?

2009-07-03 Thread Erik Ellis

Yeah, iwe read all about it, and i do not intend on putting it up on
Market. But i would like to learn more about the internals of Android,
and I thought playing around with some of the built in apps would be a
good start.
IF i go about putting it on Market, I would make sure to port or
reimplement the missing classes with the SDK.

On Jul 2, 11:53 pm, Yusuf T. Mobile yusuf.s...@t-mobile.com wrote:
 You can't use an internal API when developing an app with the Android
 SDK.

 Google strongly discourages the use of internal APIs for several
 reasons, among them the likelihood that the APIs will change in the
 future, leaving your app out in the cold.

 Yusuf Saib
 Android
 ·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.

 P.S. Diane H. always beats me to answering the popular internal-API
 question, but not this time! Now all I have to do is tell someone
 this is not the right forum for your question and my day will be
 complete!

 On Jul 2, 1:08 am,ErikElliserik.el...@gmail.com wrote:

  Hello,
  I'm interested in extending some of the basic applications that comes
  with Android. In my case platform/packages/apps/music.git.

  I first tried doing it with just the SDK with no luck because there's
  some classes missing from the SDK, One of them being
  com.android.internal.database.ArrayListCursor (found in platform/
  frameworks/base.git).

  So basically, am i even supposed to be able to compile and extend the
  base applications ? Is it posible to repo sync platform/framework/
  base and compile the required com.android.internal.* classes ?

  I'we been googling like mad, and but no luck. I would prefere not to
  have to repo sync the entire codebase and compile that.

  So my question is; How do i extend and compile the platform/packages/
  apps/* applications?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: ScrollView changs the behavior of the layout even when it's not active.

2009-07-03 Thread jcpalmer

You might try setFillViewport(true), although I never got it to do
anything.

As an alternative, I would suggest always having the buttons at the
bottom, and only scrolling the rest of the view.  It is not exactly
what you want, but at least you only need one of them.  Something
like:

public class MyClass extends LinearLayout{

 private final ScrollView viewport;
 private final LinearLayout surface;
 private final LinearLayout buttonPnl;

 MyClass(Context context){
super(context);
setOrientation(LinearLayout.VERTICAL);

viewport = new ScrollView(context);
surface = new LinearLayout(context);
surface.setOrientation(LinearLayout.VERTICAL);
viewport.addView(surface);

addView(viewport, new LinearLayout.LayoutParams
(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1f));

buttonPnl = new LinearLayout(context);
buttonPnl.setOrientation(LinearLayout.HORIZONTAL);
addView(buttonPnl, new LinearLayout.LayoutParams
(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
 }
. . .
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
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 know if we have a 2G or 3G sim card

2009-07-03 Thread Disconnect

AFAIK its the same sim. (At least, I have a sim from before 3g was
even a pipe dream but it still works fine, even catching the 3g
testing they're doing in my area now :) ..)

There is an api method to detect what network you are on at the
moment, but I don't have that info off the top of my head.

On Fri, Jul 3, 2009 at 7:42 AM, GAYET Thierrythierry_ga...@yahoo.fr wrote:
 Hi, i am looking for the information that can tell me if the sim/usim card
 inserted accept/support 2G and/or 3G ?

 I need this information in order to adapt some call to the sim card. If the
 sim card support only 2G network, an APDU will be call, then if the usim
 card is 3G another APDU will be called instead.

 Regards

 Thierry GAYET
 NextInnovation.org
 +33(0)663.849.589


 


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



[android-developers] Re: adding support for new containers/protocols to mediaplayer ?

2009-07-03 Thread sbw.android

On 3 juil, 17:09, Marco Nelissen marc...@android.com wrote:
 On Fri, Jul 3, 2009 at 7:54 AM, sbw.androidsbw.andr...@gmail.com wrote:

  hi,
  is it possible, using sdk or ndk, to add support for new multimedia
  containers (avi, mpeg, ...) or for new transport protocols to the
  mediaplayer?

 No.

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: ScrollView changs the behavior of the layout even when it's not active.

2009-07-03 Thread 7Droid

Hi jcpalmer,

Thanks for the quick suggestion.

android:fillViewport=true (in XML, as you suggested in code) did the
trick. Thanks!

Nir.

On Jul 3, 6:38 pm, jcpalmer jcpal...@rochester.rr.com wrote:
 You might try setFillViewport(true), although I never got it to do
 anything.

 As an alternative, I would suggest always having the buttons at the
 bottom, and only scrolling the rest of the view.  It is not exactly
 what you want, but at least you only need one of them.  Something
 like:

 public class MyClass extends LinearLayout{

  private final ScrollView viewport;
  private final LinearLayout surface;
  private final LinearLayout buttonPnl;

  MyClass(Context context){
     super(context);
     setOrientation(LinearLayout.VERTICAL);

     viewport = new ScrollView(context);
     surface = new LinearLayout(context);
     surface.setOrientation(LinearLayout.VERTICAL);
     viewport.addView(surface);

     addView(viewport, new LinearLayout.LayoutParams
 (LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1f));

     buttonPnl = new LinearLayout(context);
     buttonPnl.setOrientation(LinearLayout.HORIZONTAL);
     addView(buttonPnl, new LinearLayout.LayoutParams
 (LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
  }
 . . .



 }- Hide quoted text -

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



[android-developers] Re: Memory leak in AudioTrack?

2009-07-03 Thread blindfold

I should add that I only see the GREF count increasing with the
emulator, not when I run my app on the ADP (connected via USB). On the
ADP I did even after over 300 AudioTrack creations not get the message
that GREF count went above 101 or whatever. I use SDK 1.5 r2 and my
ADP has Cupcake. Curiously, I also found that GREF grows fast when
using some native code from the NDK 1.5 r1 on the SDK 1.5 r2 emulator,
and not when running the same native code on the ADP. Is the emulator
memory management somehow different from Cupcake on ADP?

Regards

On Jul 3, 12:25 pm, blindfold seeingwithso...@gmail.com wrote:
 Yes, I'm facing the exact same problem. It looks like a bug in
 AudioTrack. For me the GREF count seems to increase by 2 for every
 creation and use of AudioTrack, and it never goes down. I do not see
 this problem when instead creating and using MediaPlayer (and writing
 synthesized sound to flash memory), supporting the conclusion that the
 problem lies with AudioTrack.

 Thanks

 On Jun 27, 5:59 pm, Morné Pistorius mpistor...@gmail.com wrote:

  Hi all,

  If I create and release multiple AudioTrack objects, theGREFcount
  continually increases which eventually causes an application crash.
  This small test code snipped illustrates the problem:

                  byte[] buffer = readAudioFile( audio.raw );
                  for ( int n = 0; n  10; ++n )
                  {
                          for ( int i = 0; i  100; ++i )
                          {
                                  Log.v(Info, Track  + n + , + i );
                                  AudioTrack newTrack = new AudioTrack
  ( AudioManager.STREAM_MUSIC, 16000,
                                                                              
                  AudioFormat.CHANNEL_CONFIGURATION_MONO,

  AudioFormat.ENCODING_PCM_16BIT,

  buffer.length, AudioTrack.MODE_STATIC );

                                  newTrack.write( buffer, 0, buffer.length );
                                  newTrack.flush();
                                  newTrack.release();
                          }

                          Runtime.getRuntime().gc();
                  }

  Even with a forced garbage collection, I end up with the same highGREFcount 
  at the end of the loop.  In my application, I continuously
  create AudioTracks from variable lenght buffers.  I guess I can try
  and use a fixed size pool of AudioTracks each with a buffer large
  enough to fit my longest sound, and try and reuse them.  Is there a
  better/correct way to completely clear resources used by an
  AudioTrack?

  Any help will be greatly appreciated,
  Thanks!
  Morne
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
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 release resources when application ends?

2009-07-03 Thread MrChaz

calling finish() will close down the activity, if I remember correctly
though if you've created your own Threads you'll have to stop them
manually.
You can do that in onStop() of course.

On Jul 3, 2:19 pm, Niko Gamulin niko.gamu...@gmail.com wrote:
 The code is quite complex. To simplify the question I would like to know if
 there is any function that terminates all the processes which were running
 inside the application.

 If I make a method obButtonExit() and bind it to a custom button, which
 existing methods should be called inside the onButtonExit() in order to
 release all the resources used by the running activity and terminate all the
 processes?

 Regards,

 Niko





 On Fri, Jul 3, 2009 at 1:19 PM, MrChaz mrchazmob...@googlemail.com wrote:

  We can't really help without seeing the code in question really.
  Don't forget that when you press home or whatever to move away from
  your application it isn't necessarily closed so much as minimized.

  On Jul 3, 10:13 am, Niko Gamulin niko.gamu...@gmail.com wrote:
   Hi,

   I created an application which is displaying camera preview. When the
   application terminates I noticed that some processes are still running.
  Also
   if I try to run the original camera application it displays an error
   (obviously due to the active process which belongs to the custom
   application).

   Does anyone know how to release all resources when application ends?

   Thanks!

   Niko

   --http://mypetprojects.blogspot.com/

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



[android-developers] Re: A question regarding Activities and Tasks.

2009-07-03 Thread Android Development
Ok ! I get it now. 'Under' in the context of the stack where they are
maintained. The example you present is perfect for the rest of my queries.
Thanks.

On Fri, Jul 3, 2009 at 6:08 PM, Peli peli0...@googlemail.com wrote:


  I think three under the current activity should be four under the same
  task.

 Both is correct: It is a semantic problem of the word under:
 * four under the same task: There are four activities *within* this
 task
 * three under the current activity: There are three activities
 *below* the current activity.

 Ok? There are activities A, B, C, D on top of each other. D is the top
 activity, and three activities (A, B, and C) are below, or under
 activity D.

  I think this paragraph i quote above has nothing to do with activities
  distributed across applications..and belonging to the same task.

 It can be, because activities A, B, C, and D don't have to be from the
 same application.

 A can be OI Notepad list of notes, B can be a OI Notepad note, C can
 be OI Convert CSV, and D can be OI File manager (so there are
 activities from 3 different applications). The user started with
 notepad, wanted to export all notes, and now chooses a location for
 saving the notes to be exported.

 If the user goes back to home screen, and launches OI Notepad again,
 (s)he is presented with OI File manager to select a file location
 (because that is the activity on top of the OI Notepad stack).

 Peli
 www.openintents.org

 On Jul 3, 12:06 pm, Android Development indodr...@gmail.com wrote:
  I had a question regarding this concept.
  Suppose i have an application that defines a task. This task has some
  activities that belong to another Android application. The Dev guide
 says,
  that to maintain a uniform user experience, Android will maintain such
  'distributed' activities as part of the same 'task' even if they belong
 to
  different applications.
 
  I refer to it from here:
 http://developer.android.com/guide/topics/fundamentals.html
 
  Some lines later, the Dev guide says and i quote:
  *
  *
  ***Suppose, for instance, that the current task has four activities in
 its
  stack — three under the current activity. The user presses the HOME key,
  goes to the application launcher, and selects a new application
 (actually, a
  new task). The current task goes into the background and the root
 activity
  for the new task is displayed. The current task goes into the background
 and
  the root activity for the new task is displayed. Then, after a short
 period,
  the user goes back to the home screen and again selects the previous
  application (the previous task). That task, with all four activities in
 the
  stack, comes forward. When the user presses the BACK key, the screen does
  not display the activity the user just left (the root activity of the
  previous task). Rather, the activity on the top of the stack is removed
 and
  the previous activity in the same task is displayed.*
 
  I think three under the current activity should be four under the same
  task.
 
  I think this paragraph i quote above has nothing to do with activities
  distributed across applications..and belonging to the same task. This
 para
  is maybe talking about two applications, that share a common application
  launcher and each application has defined its own tasks (stack of
  activities).
 
  The user is simply toggling from one application to another, thus
  demonstrating that all activities (of a task) move together. However,
  the three
  under the current activity phrase is confusing me.
 
  Please correct me if I am wrong.
 
  Thanks in advance..
 


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



[android-developers] Re: How do i compile platform/packages/apps applications ?

2009-07-03 Thread Marco Nelissen

You could copy ArrayListCursor in to the application.


On Thu, Jul 2, 2009 at 1:08 AM, Erik Elliserik.el...@gmail.com wrote:

 Hello,
 I'm interested in extending some of the basic applications that comes
 with Android. In my case platform/packages/apps/music.git.

 I first tried doing it with just the SDK with no luck because there's
 some classes missing from the SDK, One of them being
 com.android.internal.database.ArrayListCursor (found in platform/
 frameworks/base.git).

 So basically, am i even supposed to be able to compile and extend the
 base applications ? Is it posible to repo sync platform/framework/
 base and compile the required com.android.internal.* classes ?

 I'we been googling like mad, and but no luck. I would prefere not to
 have to repo sync the entire codebase and compile that.

 So my question is; How do i extend and compile the platform/packages/
 apps/* applications?

 


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



[android-developers] Re: Failing to send attachments via email

2009-07-03 Thread Don Oleary
Looking closer at the error messages, it looks like Android was failing
to get the correct Content Provider for opening a stream to http (maybe
there is none
available).

My work around was to download the image to the file system and load from
there.
Code below.


try{
java.net.URI uri = URI.create(
http://images.google.com/images/logo_sm.gif;);
InputStream iStream = uri.toURL().openStream();

File image = new
File(Environment.getExternalStorageDirectory().getAbsolutePath() + /
logo_sm.gif http://images.google.com/images/logo_sm.gif);
FileOutputStream oStream = new FileOutputStream(image);

int c;
while ((c = iStream.read()) != -1) {
   oStream.write(c);
}

iStream.close();
oStream.close();

   Intent email = new Intent(Intent.ACTION_SEND);
   email.putExtra(Intent.EXTRA_TEXT, Email Text);
 email.putExtra(Intent.EXTRA_SUBJECT, Email Subject);
 email.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(image));
 email.setType(image/gif);
 startActivity(email);

 }
catch (FileNotFoundException e) {
   Log.e(ClassName,e.getMessage());
}
catch (IOException e) {
Log.e(ClassName,e.getMessage());
}


On Fri, Jul 3, 2009 at 1:02 AM, Don Oleary donole...@gmail.com wrote:

 Hi guys

 Apologies if this question has been asked before. I have found numerous
 threads with the same
 question, but have never found a satisfactory answer.

 I am trying to send an attachment through email. When composing the email,
 everything looks great (attachment
 seems to be included and ready to send). However, the attachment does not
 get received on the other side.

 Below is my code example

 Intent email = new Intent(Intent.ACTION_SEND);
 email.putExtra(Intent.EXTRA_TEXT, Email Text);
 email.putExtra(Intent.EXTRA_SUBJECT, Email Subject);
 email.putExtra(Intent.EXTRA_STREAM, Uri.parse(
 http://images.google.com/images/logo_sm.gif;));
 email.setType(image/gif);
 startActivity(email);


 Regards
 Don



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



[android-developers] Re: import org.apache.commons.httpclient.HttpClient library error

2009-07-03 Thread Dagvadorj Galbadrakh

Android doesn't use HttpClient 3 actually. If you are using Eclipse
and actually initiated your project as Android application, you can
easily get corrected.

On Jul 3, 8:13 am, Nithu nithi...@gmail.com wrote:
 Thanks for the reply

 But these two libraries not found I just checked using editor...
 and also you give the reference
 blog is also not found these libraries

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



[android-developers] Getting a reference to the option menu.

2009-07-03 Thread Mathieu Plourde

Is there a way to get the reference to the option menu, from outside
of onCreateOptionsMenu?

I tried findViewById (for Menu and MenuItem), but it doesn't work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Getting a reference to the option menu.

2009-07-03 Thread Peli

In onPrepareOptionsMenu(), you can use menu.findItem(..).

Peli
www.openintents.org

On 3 Jul., 20:21, Mathieu Plourde mat.plou...@gmail.com wrote:
 Is there a way to get the reference to the option menu, from outside
 of onCreateOptionsMenu?

 I tried findViewById (for Menu and MenuItem), but it doesn't work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Surface to Native

2009-07-03 Thread scs sek
Hi,

I try to pass the surface which is created by Java Application to my native
lib.
While transferring at JNI layer

When i use the GetIntField fundtion to get the surface object (GetISurface)
function, the object passed by app is becoimg null.

Any suggestion is welcome.

Thanks  Regards
SCSSEK

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



[android-developers] Re: Getting a reference to the option menu.

2009-07-03 Thread Mathieu Plourde

Hm, I suppose I wasn't clear enough.

I meant withouth using those events methods (onCreateOptionsMenu,
onPrepareOptionsMenu, etc).

Is there a way to get an instance of the options menu from an activity
instance? Something like: activity.getOptionsMenu()

On Jul 3, 3:05 pm, Peli peli0...@googlemail.com wrote:
 In onPrepareOptionsMenu(), you can use menu.findItem(..).

 Peliwww.openintents.org

 On 3 Jul., 20:21, Mathieu Plourde mat.plou...@gmail.com wrote:

  Is there a way to get the reference to the option menu, from outside
  of onCreateOptionsMenu?

  I tried findViewById (for Menu and MenuItem), but it doesn't work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Parsing SOAP request

2009-07-03 Thread feda al-shahwan
How if I want to parse soap request for adding two integers. And the value
of the integers are provided by the client.

On Tue, Jun 23, 2009 at 7:25 AM, sagar.indianic sagar.india...@gmail.comwrote:


 You dont need to parse manually...
 First get the ksoap2-j2se-full-2.1.2.jar.. Search you will get it..

 then use the following code..

 private static String SOAP_ACTION = namespace/FunName;
private static String METHOD_NAME = method_name;
private static final String NAMESPACE = namespace;
private static final String URL = Url of web service;

 SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty(field of web service, variable);

SoapSerializationEnvelope envelope = new
 SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);  // same as
 envelope.bodyOut = request;

HttpTransportSE httpTransport = new HttpTransportSE(URL);
httpTransport.call(SOAP_ACTION, envelope); //This sends a soap
 request and response will be in envelope only.

 Now check for envelope.bodyIn will give you response from webservice.
 This will give you SoapObject. Retrieve response strings from the
 SoapObject method.


 On Jun 22, 10:17 am, Desu Vinod Kumar vinny.s...@gmail.com wrote:
  Hi  everyone
 
  i am looking for soap web services in android. my hand also will help to
 u
 
  actually i need to connect the PHP soap web services in android
 
  i need to get the response from the PHP server and should return it in
 xml
  format.
 
  can any body give me suggestions regarding this
 
  i have tried some small code but it is unexpectedly quiting
 
  if any android runtime errors in log cat is any problem
 
  how can i clear that android runtime errors in log cat what i am getting
 ...
 
  Here is my code
 
  protected void onCreate(Bundle icicle)
  {
 
  super.onCreate(icicle);
 
  // SOAP Request for the FindServiceSOAP.GetRatingInfo web service
  String soapRequestXML = ?xml version=\1.0\
 encoding=\utf-8\?\n +
  soap:Envelope xmlns:soap=\
 http://schemas.xmlsoap.org/soap/envelope/\;  +
 xmlns:xsi=\
 http://www.w3.org/2001/XMLSchema-instance\;  +
 xmlns:xsd=\
 http://www.w3.org/2001/XMLSchema\;\n +
  getRating xmlns=\http://tempuri.org
 \\n
  +
  /getRating\n +
/soap:Body\n +
  /soap:Envelope;
 
  String url = http://www.hasdhs.com/ask.php;;
  HttpClient client = new HttpClient();
 
  PostMethod postMethod = new PostMethod(url);
 
   // Construct a SOAP request by hand
  StringBuffer request = new StringBuffer();
  request.append(soapRequestXML);
 
  postMethod.setRequestBody(request.toString());
  postMethod.setRequestHeader(Content-Type,text/xml;
 charset=utf-8);
  postMethod.setRequestHeader(SOAPAction,
   \http://tempuri.org\;);
 
  int statusCode = 0;
  try {
  statusCode = client.executeMethod(postMethod);
  } catch (IOException e) {
  Log.d(ReverseGeoCoder, e.toString(), e);
  }
 
   // Parse the SOAP Response
  MyContentHandler myContentHandler = new MyContentHandler();
  try {
  SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
 
  } catch (Exception e) {
  Log.d(ISizzle, e.toString(), e);
  }
 
  // Display the response details.
  List list = myContentHandler.getRating();
  String[] items = new String[list.size()];
  for (int i = 0; i  list.size(); i++)
  {
  MyContentHandler.GetRating rating = (MyContentHandler.GetRating)
  list.get(i);
  }
   // Show the data in the list view
  ListView listView = (ListView) findViewById(R.id.data);
  listView.setAdapter(new ArrayAdapterString(this,
  android.R.layout.simple_list_item_1,
  items));
  postMethod.releaseConnection();
  }
 
  }
 
  thanks in advance
 
 
 
  On Sat, Jun 20, 2009 at 8:08 PM, fifi fa.alshah...@gmail.com wrote:
 
   I would like to parse a soap envelope using KSOAP2 how can  I start   I
   am new and I tried the following code but i couldnot. Also I would
   like to display the parsed elements on the screen?Thanks
 
   package parsingsteps;
 
   import java.io.*;
   import org.ksoap2.SoapEnvelope;
   import org.kxml2.io.KXmlParser;
   import org.xmlpull.v1.XmlPullParserException;
 
   /**
*
* @author fa00064
*/
   public class ParsingSteps {
 
  /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {
  try{
 // String msg=helloWorld!/hello;
  String msg = SOAP-ENV:Envelope  + xmlns:SOAP-ENV=\http://
  www.w3.org/2001/12/soap-envelope\  + xmlns:xsi=\http://www.w3.org/
   

[android-developers] Re: Question about GENERATING key strokes and DYNAMIC selection of list items.

2009-07-03 Thread Mathieu Plourde

For the listview part, I found it. I used performItemClick.

But for generating keystrokes, nothing seems to work. I tried using
onKeyDown and onKeyUp, but it just doesn't do anything (and I need to
generate the key strokes from the application).

The only thing that seemed to have a result is
activity.dispatchKeyEvent. But that seems to only work within the
focused view. Like if the view with the focus is a listview, it will
jump from listitem to listitem upon generating the Key UP and Key DOWN
events. However, if I want to jump from an edittext to another
edittext, it will do nothing. As if it stays within the focused
view...

Anyone knows the correct way to do this? Or a workaround?

Thanks.

(I'm making something for test automation purposes that is recording
and copying what a user is doing on the emulator. Like if a use
presses DOWN on his keyboard, the focus will jump from a widget to
another. Sadly, I can't find anything that does the same thing
programmatically.)


On Jul 2, 5:22 pm, Mark Murphy mmur...@commonsware.com wrote:
 Mathieu Plourde wrote:
  1. How do you programmatically generate key strokes? I found some
  tutorials where it says to use IWindowManager, but that doesn't exist
  anymore in 1.5. (And WindowManager doesn't provide any function to
  generate key strokes)

 For your own activity, you could try manually calling onKeyDown() and
 onKeyUp(), though I have not tried this.

 To try to control other applications, you cannot generate keystrokes,
 AFAIK, probably for security reasons.

  2. How do you programmatically select one item from a ListView? Is it
  possible to do it with the index of the list item (it's position in
  the list)

 If by select you mean have it appear with the orange selection
 highlight, call setSelection() on the ListView. However, this will only
 work if the activity is not in touch mode -- in touch mode, there is no
 orange selection highlight except briefly when list items are clicked.

 --
 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] How to build a particular project on the repo (patch the android os)

2009-07-03 Thread Mark Fayngersh
i did repo sync platform/packages/apps/Contacts.git and i received the
specific src files for that project
now that i modified what i wanted, i want to ubild my changes and patch them
to my current Android OS. I tried running make from working directory, but
there is no makefile. How would i go about doing so?

-- 
~phunny.pha...@gmail.com
~mar...@archlinux.us

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
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 build a particular project on the repo (patch the android os)

2009-07-03 Thread Mark Murphy

Mark Fayngersh wrote:
 i did repo sync platform/packages/apps/Contacts.git and i received the
 specific src files for that project
 now that i modified what i wanted, i want to ubild my changes and patch
 them to my current Android OS. I tried running make from working
 directory, but there is no makefile. How would i go about doing so?

That's not an SDK project -- you'll have an easier time getting answers
on a list that relates to the Android open source project:

http://source.android.com/discuss

-- 
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: IllegalStateException when calling Preference.setDependency()

2009-07-03 Thread ccdesignz

First of all, sorry for my bad english.

I found the answer in the android sdk source code, the problem is the
following:

When your CheckBoxPreference or an other Preference class call the
setDependency() method, this one will call the following method:
PreferenceManager.findPreference() in the background.
Exactly here is the problem, this works not untill you have called
this method setPreferenceScreen(preferenceScreen) in your
PreferenceActivity.

When you change the call order in your PreferenceActivity to the
following or an analog version, all works fine

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

private void initPreferenceScreen() {
PreferenceScreen preferenceScreen = getPreferenceManager
().createPreferenceScreen(this);
this.setPreferenceScreen(preferenceScreen);

CheckBoxPreference chbPref1 = new CheckBoxPreference(this);
chbPref1.setTitle(chbPref1);
chbPref1.setKey(preferenceKey1);
preferenceScreen.addPreference(chbPref1);

CheckBoxPreference chbPref2 = new CheckBoxPreference(this);
chbPref2.setTitle(chbPref2);
chbPref2.setKey(preferenceKey2);
preferenceScreen.addPreference(chbPref2);
chbPref2.setDependency(chbPref1.getKey());
   }

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



[android-developers] Re: Multiple points on a map

2009-07-03 Thread alexdonnini

Hello,

Thanks. It's as I hoped. Can you sketch for me the approach you used
to implement multiple overlays?

Alex Donnini

On Jul 3, 10:24 am, MrChaz mrchazmob...@googlemail.com wrote:
 You can have multiple overlays at the same time.
 In my application I have one for traffic incidents and one for
 roadworks.

 On Jul 3, 3:08 pm,alexdonninialexdonn...@ieee.org wrote:

  Hello,

  I need advice/pointers on how to display on a map multiple points that
  change somewhat infrequently based on the device's location.

  Currently, my application already displays in real-time the device's
  changing location on a map. I can also easily display the location of
  one of the other points of interest.

  However, I have not figured out a way to have both displayed on a map
  at the same time.

  Nay help, hint, pointer, advice, would be greatly appreciated.

  Thanks.

  Alex Donnini


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



[android-developers] Re: Camera in portrait mode

2009-07-03 Thread indra

Hi,

There is no way of getting the camera preview in portrait mode ( as
you probably already know) and its very ( very) slow to rotate the
preview image. The only option is to run the app in landscape mode and
rotate the view that you want to overlay onto the preview by 90
degrees. To do this override the onDraw() method of the parent view
(preferably a linearlayout) and rotate the canvas before calling
super.onDraw(). Its going to take a bit of hacking.. Good luck!

On Jul 2, 7:35 pm, lufo luca.bard...@gmail.com wrote:
 Hi guys, I'm facing the same problem like indra.

 I need to overlay some text on the camera and I tried to rotate the
 canvas on which the text is drawn but no result.

 Can someone (indra?) tell me how/what to rotate to bypass the 
 Cameraportraitbug ?

 Thanx a lot!

 On Jun 30, 7:22 pm, SebX sxercav...@gmail.com wrote:



  It works only if I put this:
      this.setRequestedOrientation
  (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  It's a compromise even if locking the view in landscape mode is not
  the first choice...

  On 29 juin, 01:34, SebX sxercav...@gmail.com wrote:

   Hi,

   First at all congratulation for Layar, it seems very impressive and I
   look forward to test the application (I did not see it on the
   appstore)

   I have the same problem with my application when I'm inportraitmode
   and that's very frustrating. I think we have to use the landscape mode
   only because even if the bug is fixed, there will always be a problem
   with the old SDK

   Could someone post here if he find the solution, please...

   Thanks

   On 28 juin, 00:02, indra b.indran...@gmail.com wrote:

Hi guys at android,

Can you plase 
fixhttp://code.google.com/p/android/issues/detail?id=1193
When do you expect it to get fixed? I am a developer working 
onhttp://layar.euandIhadto go through lot of trouble to get the app
working inportraitmode with camera preview, using a LOT of
rotations. I have managed to get everything rotated toportraitexcept
for the on screen inputmethod which still shows up in landscape. Do
you have any suggestions for rotating that?

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



[android-developers] nullPointerException in android.webkit.WebView.onTouchEvent

2009-07-03 Thread HeHe

I override dispatchTouchEvent() like this:

public boolean dispatchTouchEvent(MotionEvent ev)
{
WebView v=findViewById(R.id.detail);
return v.dispatchTouchEvent(ev);
}

I am getting intermittent NullPointerException like this:

07-03 18:03:54.530: ERROR/AndroidRuntime(1681):
java.lang.NullPointerException
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
android.webkit.WebView.onTouchEvent(WebView.java:3566)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
android.view.View.dispatchTouchEvent(View.java:3368)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:831)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
com.wth.xxxView.dispatchTouchEvent(xxxView.java:118)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchTouchEvent(PhoneWindow.java:1691)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1525)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
android.os.Handler.dispatchMessage(Handler.java:99)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
android.os.Looper.loop(Looper.java:123)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
android.app.ActivityThread.main(ActivityThread.java:3948)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
java.lang.reflect.Method.invokeNative(Native Method)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
java.lang.reflect.Method.invoke(Method.java:521)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:782)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
07-03 18:03:54.530: ERROR/AndroidRuntime(1681): at
dalvik.system.NativeStart.main(Native Method)

I verify that the variable v is never null. How come there can be
nullpointer exception happening in
android.webkit.WebView.onTouchEvent
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Multiple points on a map

2009-07-03 Thread alexdonnini

Hello,

I have another quick question. Does your application still work with
Android 1.5 (SDK and OS version)?

Thanks.

Alex Donnini

On Jul 3, 4:38 pm, alexdonnini alexdonn...@ieee.org wrote:
 Hello,

 Thanks. It's as I hoped. Can you sketch for me the approach you used
 to implement multiple overlays?

 Alex Donnini

 On Jul 3, 10:24 am, MrChaz mrchazmob...@googlemail.com wrote:

  You can have multiple overlays at the same time.
  In my application I have one for traffic incidents and one for
  roadworks.

  On Jul 3, 3:08 pm,alexdonninialexdonn...@ieee.org wrote:

   Hello,

   I need advice/pointers on how to display on a map multiple points that
   change somewhat infrequently based on the device's location.

   Currently, my application already displays in real-time the device's
   changing location on a map. I can also easily display the location of
   one of the other points of interest.

   However, I have not figured out a way to have both displayed on a map
   at the same time.

   Nay help, hint, pointer, advice, would be greatly appreciated.

   Thanks.

   Alex Donnini


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



[android-developers] Re: Register Receiver to Listen for Application Update

2009-07-03 Thread iPaul Pro

Is this even possible?

I have apps that deal with alarms and notifications, both of which are
canceled/removed when on updates the app. To combat this, I currently
have my reboot receiver firing at every main-activity onCreate().
Suffice to say, this is undesirable.

I'd like to implement a receiver that listens for an application
update.

Any suggestions on how to do this, or accomplish my goal otherwise?

Paul Burke
i...@ipaulpro.com
pub:iPaul Pro
-
Try CallBack and StatusNotes on the Android Market.

On Jul 1, 12:46 pm, iPaul Pro mr.paulbu...@gmail.com wrote:
 Hi,

 I'd like to add a Broadcast Action to my Intent Filter that listens
 for when my application is successfully updated (replaced).

 android.intent.action.PACKAGE_REPLACED is described as Broadcast
 Action: A new version of an application package has been installed,
 replacing an existing version that was previously installed. The data
 contains the name of the package. *

 A Google search for PACKAGE_REPLACED leads only to the reference
 page.

 Anyone know how would I go about this?

 receiver android:name=.UpdateReceiver
         intent-filter
                 action
 android:name=android.intent.action.PACKAGE_REPLACED /
                 data android:?=com.mypackage.name /
         /intent-filter
 /receiver

 I'm not sure what data specification or path I should be using, or if
 this is correct at all.

 Any help is greatly appreciated!

 * source 
 =http://developer.android.com/reference/android/content/Intent.html#AC...

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



[android-developers] AlarmManager nothing happening

2009-07-03 Thread dapaintballer331

I've been modifying things ALL DAY trying to get this to work, please
help.

I have a broadcast receiver that recieves a boot completed signal.
the onReceive method works!... well at least it sends output to the
log.

THE PROBLEM is that that method is responsible for creating a
AlarmService, to start call a different class every minute. That other
class never has it's onReceive method called...

AndroidManifest snippet:
receiver android:name=.FmiBootup !-THIS WORKS
FINE-
intent-filter
action 
android:name=android.intent.action.BOOT_COMPLETED /

/intent-filter
/receiver
receiver android:name=.FmiDaemon  android:process=:remote /
!THIS DOESN'T




//This is called when the phone boots
FmiBootup.class
public class FmiBootup extends BroadcastReceiver {

 @Override
 public void onReceive(Context context, Intent intent) {
 Log.e(fmi, fmi bootup);
 Intent newIntent = new Intent(context, FmiDaemon.class);
 PendingIntent pendingIntent = PendingIntent.getBroadcast
(context, 0, newIntent, 0);
 AlarmManager alarmManager = (AlarmManager)
context.getSystemService(Context.ALARM_SERVICE);
 alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
System.currentTimeMillis() + (15 * 1000), 60 * 1000, pendingIntent);
 }
}

*
//This should be called every minute, starting 15 seconds after the
above class spits into the log
FmiDaemon.class
public class FmiDaemon extends BroadcastReceiver
{

@Override
public void onReceive(Context context, Intent intent) {
Log.e(fmi,fmi daemon run called);

 //ton of irrelevant code. over 200
lines
}
}
**

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



[android-developers] Re: AlarmManager nothing happening

2009-07-03 Thread Mark Murphy

dapaintballer331 wrote:
 I've been modifying things ALL DAY trying to get this to work, please
 help.
 
 I have a broadcast receiver that recieves a boot completed signal.
 the onReceive method works!... well at least it sends output to the
 log.
 
 THE PROBLEM is that that method is responsible for creating a
 AlarmService, to start call a different class every minute. That other
 class never has it's onReceive method called...
 
 AndroidManifest snippet:
 receiver android:name=.FmiBootup !-THIS WORKS
 FINE-
   intent-filter
   action 
 android:name=android.intent.action.BOOT_COMPLETED /
   /intent-filter
   /receiver
 receiver android:name=.FmiDaemon  android:process=:remote /

Try getting rid of android:process=:remote.

-- 
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] Canvas Scaling issues

2009-07-03 Thread Tane Piper

Hey folks,

A few weeks ago I posted a view I was working on and in that time I
have improved the view a lot, but I've been asked to add a new
features of zooming into the image.

The view is a custom image viewer that allows large images (such as
640x1000) to be loaded, and the user to scroll around using either the
touchscreen or trackball on the device.  The code below is reasonably
succesful in that it works at the default scale level of 1.

But with addign zooming, instead of zooming into the 'centre' of the
location the user is looking at, and allowing the user to move around
the whole of the image at this level it instead zooms into the top and
left of the location, and in doing so it starts to cut off the bottom
and right of the image whole, so while zoomed in you cannot go any
ruther right or down in the image, but you can go to the top and left
easily enough.

The best example of what I am trying to achive is the Image viewer in
the camera application.

So my two questions are:

1) Can anyone suggest how I can fix this in the canvas or
2) Is there a better way to do this with an existing feature in the
framework?

I'm probably thinking it's something to do with the modifierValue when
scrolling around that I somehow need to increase this, but trying this
causes my activity to crash.

Code:

public class ZN5ScrollView extends View {

public ZN5ScrollView(Context context, AttributeSet attrs) {
super(context, attrs);

scrollX = 0;
scrollY = 0;
scale = 1.0f;
modifierValue = 50;

ViewPaint = new Paint();

TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.ZN5ScrollView);
LoadedBitmap = 
BitmapFactory.decodeResource(context.getResources(),
a.getResourceId(R.styleable.ZN5ScrollView_src, R.drawable.icon));

IMAGE_WIDTH = LoadedBitmap.getWidth();
IMAGE_HEIGHT = LoadedBitmap.getHeight();

ViewBitmap = Bitmap.createBitmap(LoadedBitmap);
}

protected void onSizeChanged  (int w, int h, int oldw, int oldh) {
SCREEN_WIDTH = w;
SCREEN_HEIGHT = h;

if (IMAGE_WIDTH  SCREEN_WIDTH) {
IMAGE_WIDTH = SCREEN_WIDTH - scrollX;
}
if (IMAGE_HEIGHT  SCREEN_HEIGHT) {
IMAGE_HEIGHT = SCREEN_HEIGHT - scrollY;
}

}

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.scale(scale, scale);
canvas.drawBitmap(ViewBitmap, 0f, 0f, ViewPaint);
}

public void handleView(int zoomType) {
switch (zoomType) {
case ZOOM_IN:
if (scale = 1.5f) {
scale = scale + 0.1f;
}
break;
case ZOOM_OUT:
if (scale  1.0f) {
scale = scale -0.1f;
}
break;
}
invalidate();
}


public void handleScroll(float distX, float distY) {
/* X-Axis */
if(distX  6.0) {
if(scrollX  IMAGE_WIDTH) {
scrollX = Math.min(IMAGE_WIDTH - SCREEN_WIDTH, scrollX +
modifierValue);
}
}
else if(distX  -6.0) {
if(scrollX = 50) {
scrollX = Math.min(IMAGE_WIDTH + SCREEN_WIDTH, scrollX -
modifierValue);
} else {
scrollX = 0;
}
}

/* Y-Axis*/
if(distY  6.0) {
if(scrollY  IMAGE_HEIGHT) {
scrollY = Math.min(IMAGE_HEIGHT - SCREEN_HEIGHT, 
scrollY +
modifierValue);
}
}
else if(distY  -6.0) {
if(scrollY = 50) {
scrollY = Math.min(IMAGE_HEIGHT + SCREEN_HEIGHT, 
scrollY -
modifierValue);
} else {
scrollY = 0;
}
}

if((scrollX = IMAGE_WIDTH)  (scrollY = IMAGE_HEIGHT)) {
ViewBitmap = Bitmap.createBitmap(LoadedBitmap, scrollX, scrollY,
SCREEN_WIDTH, SCREEN_HEIGHT);
invalidate();
}
}

private int modifierValue;

private float scale;
public final int ZOOM_IN = 1;
public final int ZOOM_OUT = 2;

private int SCREEN_WIDTH;
private int SCREEN_HEIGHT;

private int IMAGE_WIDTH;
private int IMAGE_HEIGHT;

private int scrollX;
private int scrollY;

private Bitmap LoadedBitmap;
private Bitmap ViewBitmap;
private Paint ViewPaint;
}


Regards,
Tane
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit 

[android-developers] Re: What is the best way to implement dynamic textures in OpenGL ES?

2009-07-03 Thread gjs

Hi Tom,

Thanks for the suggestion about GLUtils.

I went back  found that the TriangleRenderer.java example had been
updated some time ago to use this method which is as you say is *much*
more efficient (faster)  simpler than using a ByteBuffer and doing
the color conversions.

( It pays to revisit the examples with new sdk releases ! )

Regards Gary

On Jul 3, 11:04 pm, Tom Gibara m...@tomgibara.com wrote:
 Also you can use glTexSubImage2D() if only a portion of your bitmap is
 changing. For these sorts of operations android.opengl.GLUtils will be
 *much* more efficient (and simpler) than your current approach of populating
 a ByteBuffer since the native helper methods can access the Bitmap pixel
 data directly.
 Tom

 2009/7/2 Bruce Rees baree...@gmail.com



  Hi All,

  I have a texture-mapped cube based in part on the Kube API demo and
  the Textured Cube example from anddev.org,  It is working fine using
  bitmaps loaded from R.drawable.. what I need to do now is to make the
  texture for each face dynamic (using Bitmaps created in code).  I'm
  having trouble understanding how to change the textures on the fly and
  I'm hoping someone can point me in the right direction..

  This is the code that initially sets a texture:

                 gl.glBindTexture(GL10.GL_TEXTURE_2D, texBuf.get(num));
                 Bitmap bmp =
  BitmapFactory.decodeResource(context.getResources(),
  id);
                 int pixels[] = new int[TEX_SIZE * TEX_SIZE];
                 bmp.getPixels(pixels, 0, TEX_SIZE, 0, 0, TEX_SIZE,
  TEX_SIZE);
                 int pix1[] = new int[TEX_SIZE * TEX_SIZE];
                 for (int i = 0; i  TEX_SIZE; i++)
                 {
                         for (int j = 0; j  TEX_SIZE; j++)
                         {
                                 //correction of R and B
                                 int pix = pixels[i * TEX_SIZE + j];
                                 int pb = (pix  16)  0xff;
                                 int pr = (pix  16)  0x00ff;
                                 int px1 = (pix  0xff00ff00) | pr | pb;
                                 //correction of rows
                                 pix1[(TEX_SIZE - i - 1) * TEX_SIZE + j] =
  px1;
                         }
                 }

                 IntBuffer tbuf = IntBuffer.wrap(pix1);
                 tbuf.position(0);
                 gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA,
  TEX_SIZE,
  TEX_SIZE, 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, tbuf);
                 gl.glTexParameterx(GL10.GL_TEXTURE_2D,
  GL10.GL_TEXTURE_MIN_FILTER,
  GL10.GL_LINEAR);
                 gl.glTexParameterx(GL10.GL_TEXTURE_2D,
  GL10.GL_TEXTURE_MAG_FILTER,
  GL10.GL_LINEAR);

  What would I need to change in this code to allow an existing texture
  to be replaced (eg. a new Bitmap would be passed in instead of loading
  the resource, but when I try this the texture remains unchanged).

  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] targeting broadcasts issue

2009-07-03 Thread Seer

Guys,
I am trying to get the intent android.intent.action.BOOT_COMPLETED
sent only to the receiver
com.android.mms.transaction.MmsSystemEventReceiver as this triggers
the sms notification to be updated and removed if there is no longer
any unread sms's.  The issue i have is i need to make sure the
broadcast is only sent to the class above.  If it goes to other
receivers the phone could end up in an unknown state or something
strange.

The code below does not seem to work.

Intent intent = new Intent();
intent.setAction(android.intent.action.BOOT_COMPLETED);
intent.setClassName(com.android.mms,
.transaction.MmsSystemEventReceiver);
activity.sendBroadcast(intent);

This code does work but since it goes to all receivers i have noticed
some errors starting to show up in logs etc.
Intent intent = new Intent();
intent.setAction(android.intent.action.BOOT_COMPLETED);
activity.sendBroadcast(intent);

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

2009-07-03 Thread HeHe

anyone there

On Jul 2, 9:56 am, HeHe cnm...@gmail.com wrote:
 Hello folks,

 Could somebody teach me how to get current left x-position relative to
 a HorizontalScrollView view after a Flint event is processing by
 HorizontalScrollView's factory onFlint handler?

 There seems to me no such API in current SDK. Am I correct?

 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: targeting broadcasts issue

2009-07-03 Thread Dianne Hackborn
Um, don't do this.  Whatever you are doing this for, you can be sure it will
break in the future.

On Fri, Jul 3, 2009 at 8:55 PM, Seer gilligan.ch...@gmail.com wrote:


 Guys,
 I am trying to get the intent android.intent.action.BOOT_COMPLETED
 sent only to the receiver
 com.android.mms.transaction.MmsSystemEventReceiver as this triggers
 the sms notification to be updated and removed if there is no longer
 any unread sms's.  The issue i have is i need to make sure the
 broadcast is only sent to the class above.  If it goes to other
 receivers the phone could end up in an unknown state or something
 strange.

 The code below does not seem to work.

 Intent intent = new Intent();
 intent.setAction(android.intent.action.BOOT_COMPLETED);
 intent.setClassName(com.android.mms,
 .transaction.MmsSystemEventReceiver);
 activity.sendBroadcast(intent);

 This code does work but since it goes to all receivers i have noticed
 some errors starting to show up in logs etc.
 Intent intent = new Intent();
 intent.setAction(android.intent.action.BOOT_COMPLETED);
 activity.sendBroadcast(intent);

 Chris
 



-- 
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: Getting a reference to the option menu.

2009-07-03 Thread Dianne Hackborn
Sorry, no, the options menu is only created when needed.  Your
create/prepare callback can however stash away the menu interface it
receives for your code to use later.

On Fri, Jul 3, 2009 at 12:33 PM, Mathieu Plourde mat.plou...@gmail.comwrote:


 Hm, I suppose I wasn't clear enough.

 I meant withouth using those events methods (onCreateOptionsMenu,
 onPrepareOptionsMenu, etc).

 Is there a way to get an instance of the options menu from an activity
 instance? Something like: activity.getOptionsMenu()

 On Jul 3, 3:05 pm, Peli peli0...@googlemail.com wrote:
  In onPrepareOptionsMenu(), you can use menu.findItem(..).
 
  Peliwww.openintents.org
 
  On 3 Jul., 20:21, Mathieu Plourde mat.plou...@gmail.com wrote:
 
   Is there a way to get the reference to the option menu, from outside
   of onCreateOptionsMenu?
 
   I tried findViewById (for Menu and MenuItem), but it doesn't work.
 



-- 
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: Question about GENERATING key strokes and DYNAMIC selection of list items.

2009-07-03 Thread Dianne Hackborn
Test  code should use Instrumentation, which allows you to inject your code
into the application and control it through the methods there.

On Fri, Jul 3, 2009 at 12:59 PM, Mathieu Plourde mat.plou...@gmail.comwrote:


 For the listview part, I found it. I used performItemClick.

 But for generating keystrokes, nothing seems to work. I tried using
 onKeyDown and onKeyUp, but it just doesn't do anything (and I need to
 generate the key strokes from the application).

 The only thing that seemed to have a result is
 activity.dispatchKeyEvent. But that seems to only work within the
 focused view. Like if the view with the focus is a listview, it will
 jump from listitem to listitem upon generating the Key UP and Key DOWN
 events. However, if I want to jump from an edittext to another
 edittext, it will do nothing. As if it stays within the focused
 view...

 Anyone knows the correct way to do this? Or a workaround?

 Thanks.

 (I'm making something for test automation purposes that is recording
 and copying what a user is doing on the emulator. Like if a use
 presses DOWN on his keyboard, the focus will jump from a widget to
 another. Sadly, I can't find anything that does the same thing
 programmatically.)


 On Jul 2, 5:22 pm, Mark Murphy mmur...@commonsware.com wrote:
  Mathieu Plourde wrote:
   1. How do you programmatically generate key strokes? I found some
   tutorials where it says to use IWindowManager, but that doesn't exist
   anymore in 1.5. (And WindowManager doesn't provide any function to
   generate key strokes)
 
  For your own activity, you could try manually calling onKeyDown() and
  onKeyUp(), though I have not tried this.
 
  To try to control other applications, you cannot generate keystrokes,
  AFAIK, probably for security reasons.
 
   2. How do you programmatically select one item from a ListView? Is it
   possible to do it with the index of the list item (it's position in
   the list)
 
  If by select you mean have it appear with the orange selection
  highlight, call setSelection() on the ListView. However, this will only
  work if the activity is not in touch mode -- in touch mode, there is no
  orange selection highlight except briefly when list items are clicked.
 
  --
  Mark Murphy (a Commons Guy)http://commonsware.com|
 http://twitter.com/commonsguy
 
  Android Development Wiki:http://wiki.andmob.org
 



-- 
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: Surface to Native

2009-07-03 Thread Dianne Hackborn
Sorry, there is currently no API in the NDK for working with surfaces.

On Fri, Jul 3, 2009 at 12:08 PM, scs sek scs...@gmail.com wrote:

 Hi,

 I try to pass the surface which is created by Java Application to my native
 lib.
 While transferring at JNI layer

 When i use the GetIntField fundtion to get the surface object (GetISurface)
 function, the object passed by app is becoimg null.

 Any suggestion is welcome.

 Thanks  Regards
 SCSSEK


 



-- 
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: Register Receiver to Listen for Application Update

2009-07-03 Thread Dianne Hackborn
Use data android:scheme=package /

On Fri, Jul 3, 2009 at 3:19 PM, iPaul Pro mr.paulbu...@gmail.com wrote:


 Is this even possible?

 I have apps that deal with alarms and notifications, both of which are
 canceled/removed when on updates the app. To combat this, I currently
 have my reboot receiver firing at every main-activity onCreate().
 Suffice to say, this is undesirable.

 I'd like to implement a receiver that listens for an application
 update.

 Any suggestions on how to do this, or accomplish my goal otherwise?

 Paul Burke
 i...@ipaulpro.com
 pub:iPaul Pro
 -
 Try CallBack and StatusNotes on the Android Market.

 On Jul 1, 12:46 pm, iPaul Pro mr.paulbu...@gmail.com wrote:
  Hi,
 
  I'd like to add a Broadcast Action to my Intent Filter that listens
  for when my application is successfully updated (replaced).
 
  android.intent.action.PACKAGE_REPLACED is described as Broadcast
  Action: A new version of an application package has been installed,
  replacing an existing version that was previously installed. The data
  contains the name of the package. *
 
  A Google search for PACKAGE_REPLACED leads only to the reference
  page.
 
  Anyone know how would I go about this?
 
  receiver android:name=.UpdateReceiver
  intent-filter
  action
  android:name=android.intent.action.PACKAGE_REPLACED /
  data android:?=com.mypackage.name /
  /intent-filter
  /receiver
 
  I'm not sure what data specification or path I should be using, or if
  this is correct at all.
 
  Any help is greatly appreciated!
 
  * source =
 http://developer.android.com/reference/android/content/Intent.html#AC...
 
  Thanks in advance,
  Paul
 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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



  1   2   >