[android-developers] Re: Making the Java assert statement work

2010-06-16 Thread A Curious Developer
> "Controlling the Embedded VM":
>
>  http://android.git.kernel.org/?p=platform/dalvik.git;a=blob_plain;f=d...

Thanks, that was educational, although I couldn't figure out how to
turn it into a solution. ;) I found a few other times this question
has been raised, and it seems like it doesn't have an easy answer.

But ... I noticed that assert statements bloat the .apk, which seems
like a bad thing. So I am now using a pattern of checking a static
final constant: if(ASSERTS) { asserts( someCondition, "Some
explanation" ); }
Setting ASSERTS false strips the related code from the .apk. So far
this is working very well. (I use assertions a lot.)

I am curious: how are all you programmers handling assertions? Do you
use the assert statement, your own concoction, or something else? Are
assertions ill-favored in the Java world or, more specifically, the
phone application world?

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

2010-06-16 Thread NishantKumar
Hi,
I am creating an application that requires some values of username
during execution. Hence, I want to create an option for storing
information. I donot want to use the general java.io  classes for
storing information.

I want to create an option  "MyAppInfo" in the android setting menu .
When I click on this option, window showing the username should be
displayed.

How to create this type of application that stores information in
android
setting menu.  Is it possible??

If it is possible, then how can I read the information saved in the
Android setting menu in the MyAppInfo option ?


If the above mentioned is not possible then how can I use the java.io
classes to save the username, that can also be seen using the android
menu.
 I have used the java OutputStream to write username to a file,
but I cannot see where it is.

Thanks,
Nishant Kumar

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


[android-developers] guidance on cocos2d

2010-06-16 Thread kavitha b
Hi All,

where can i get help about using cocos-2d android.

I am completely new.So i need guidance on how to start.

Thanks
Kavitha

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

[android-developers] switching GPS on and off

2010-06-16 Thread kamiseq
I cant really find anything on how to start GPS device if it is
switched off and how to stop it if it is no longer needed.
can someone guide me ???

cheers

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


Re: [android-developers] How to store information in android setting menu

2010-06-16 Thread kavitha b
Hi Nishanth,,

you can store that file either in sdcard or context cache,,and retrieve it
whenever required back.

Thanks
Kavitha

On Wed, Jun 16, 2010 at 1:03 PM, NishantKumar wrote:

> Hi,
> I am creating an application that requires some values of username
> during execution. Hence, I want to create an option for storing
> information. I donot want to use the general java.io  classes for
> storing information.
>
> I want to create an option  "MyAppInfo" in the android setting menu .
> When I click on this option, window showing the username should be
> displayed.
>
> How to create this type of application that stores information in
> android
> setting menu.  Is it possible??
>
> If it is possible, then how can I read the information saved in the
> Android setting menu in the MyAppInfo option ?
>
>
> If the above mentioned is not possible then how can I use the java.io
> classes to save the username, that can also be seen using the android
> menu.
>  I have used the java OutputStream to write username to a file,
> but I cannot see where it is.
>
> Thanks,
> Nishant Kumar
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Re: [android-developers] How to store information in android setting menu

2010-06-16 Thread Nishant Kumar
Hi,
 I  want to see the information stored in the file by browsing my android
phone.

How can I do that?

Moreover, is it not possible to create my own setting menu inside android
setting menu ? This will store information about my application

Thanks,
Nishant

On Wed, Jun 16, 2010 at 10:03 AM, kavitha b  wrote:

> Hi Nishanth,,
>
> you can store that file either in sdcard or context cache,,and retrieve it
> whenever required back.
>
> Thanks
> Kavitha
>
> On Wed, Jun 16, 2010 at 1:03 PM, NishantKumar wrote:
>
>> Hi,
>> I am creating an application that requires some values of username
>> during execution. Hence, I want to create an option for storing
>> information. I donot want to use the general java.io  classes for
>> storing information.
>>
>> I want to create an option  "MyAppInfo" in the android setting menu .
>> When I click on this option, window showing the username should be
>> displayed.
>>
>> How to create this type of application that stores information in
>> android
>> setting menu.  Is it possible??
>>
>> If it is possible, then how can I read the information saved in the
>> Android setting menu in the MyAppInfo option ?
>>
>>
>> If the above mentioned is not possible then how can I use the java.io
>> classes to save the username, that can also be seen using the android
>> menu.
>>  I have used the java OutputStream to write username to a file,
>> but I cannot see where it is.
>>
>> Thanks,
>> Nishant Kumar
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

[android-developers] Embedding appwidget in activity

2010-06-16 Thread angushir...@googlemail.com
Hi all,
   I need to implement a reusable view for use in several Android
applications. Would it be possible to develop an appWidget that can be
embedded in an activity, or am I best off providing a customised
component?

Thanks in advance

Angus

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

2010-06-16 Thread a2ronus
1. Register a BroadcastReceiver that listens for a specific Intent.
2. When the user clicks on the Notification, the PendingIntent will be
launched. You can put extra's in this Intent. You can use the extra's
to determine which method will be launched in the Service.

Good luck, a2ronus

On Jun 16, 1:12 am, Gabriel Simões  wrote:
> any ideas on this one?
>
> tnx
>
> On 14 jun, 21:33, Gabriel Simões  wrote:
>
>
>
> > I need to send it to a service.
>
> > How can a notification message start an specific action (method) on a
> > service? is that possible (for example ... a service downloading a
> > file would stop the download as the user clicks on the
> > notification)?
>
> > tnx
>
> > On 14 jun, 00:21, Kumar Bibek  wrote:
>
> > > Broadcast will only work if your activity is in the foreground. If
> > > your activity is not yet started, you can however start it with
> > > specific data passed via bundle and in the onCreate() do specific
> > > task.
>
> > > If your activity is currently in the foreground, you need to listen to
> > > broadcasts.
>
> > > Thanks and Regards,
> > > Kumar Bibek
>
> > > On Jun 14, 6:17 am, Gabriel Simões  wrote:
>
> > > > Hello,
>
> > > > I´ve been searching a way to implement an intent so when a user clicks
> > > > on a notification, an specific method from an activity is executed (or
> > > > an specific behavior happens).
> > > > Right now I´m thinking about using broadcast but I don´t know if this
> > > > is the best way to implement this functionality.
> > > > How would you implement it?
>
> > > > Thanks,
> > > > Gabriel

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

2010-06-16 Thread MarcoAndroid
1) 3-4M for one image is a lot since you have total of 16M for the
whole app! Dunno the answer to your question
2) 25*256K in bitmaps is already over 6,4M. Added to 1) makes already
over 10M! AFAIK you should only use .recycle() if you really don't
need them anymore. Unclear to me what "really don't need" means.
3) 32x32 pixels is about 204800 bytes if you count 4 bytes per pixel
4) These icons are probably not big right?

The allocation tracker didn't give enough details for me, so am using
the Eclipse Memory Analyzer Tool. Here's a pretty handy tutorial on
how to use it & detect memory leaks, maybe useful:
http://ttlnews.blogspot.com/2010/01/attacking-memory-problems-on-android.html

On 16 jun, 01:24, Nathan  wrote:
> I'm running into OutOfMemoryErrors when allocating bitmaps. This is
> not something I can reproduce with emulators, and has been reported by
> a few beta testers with the HTC Incredible.
>
> I'm not sure I can solve this directly, and my best hope is to follow
> best practices for bitmaps and memory thereof. But looking for those
> best practices based on groups archives left me with more questions
> than answers. If anyone has a chapter about this in their book, I will
> buy the book.
>
> Here are the things I've mulled over so far:
>
> 1. I have a bitmap for a drawing buffer. It is about 3-4 megabytes on
> some devices. This is the biggest bitmap I have, and without it, I
> wouldn't be able to much of anything useful in my app.  I am assuming
> that it would not be useful to use inPurgeable if this is a bitmap
> that is drawn into. Is this true?
>
> 2. Next biggest in the hierarchy are some bitmaps that are about 22K
> bytes and 256K unpacked.  Since I believe about 25 of these might be
> used at one time, I have a cache with a size of 25.
> I am careful to use BitmapFactory.Options.InPurgeable, so I believe
> that could make them take only 22K each, but I don't see that as
> guaranteed. Maybe they are taking 256K each, which would put me in the
> danger zone.
> As they are cycled out of the cache, I call bitmap.recycle(). I think
> this a good practice. Is it?
>
> 3. Next are some resources with icon size 32x32 pixels.  There are
> about 50 that could be used or reused. If I use code like this:
>
>                                                 Drawable s =
> mCtx.getResources().getDrawable(R.drawable.symbol_icon);
> Where s is a local variable to rendering. Suppose I call this 37
> times.
> Am I to assume that Android will do something smart like create only
> one bitmap for this resource even if it is used 37 times?
> Or am I to assume that Android will do something stupid like create 37
> bitmaps and keep references in an obscure location that will prevent
> garbage collection?
> Do I need to get more access to these bitmaps and do something smart
> myself?
>
> 4. Finally are some other icons used for menus and ImageButtons. Most
> are declared in layout files - so I don't touch the bitmaps directly.
>
> Can someone better informed than me comment on these assumptions? I'd
> like to make my memory usage more efficient, but don't want to spend
> time on things that will amount to shuffling chairs on the Titanic.
>
> And how do I best measure this usage? Interestingly enough, I've tried
> using the Allocation Tracker and it says I haven't allocated a single
> bitmap. In light of the above, I don't think that's right.
>
> Thanks in advance.
>
> Nathan

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


Re: [android-developers] Re: Android finishActivity()

2010-06-16 Thread Sean Hodges
Hello Mike, I somehow missed your last email.

On Wed, Jun 16, 2010 at 5:16 AM, mike  wrote:
> Hi Sean,
>
> i hope you also has gone out of answers. any way kindly let me know
> this.
>
> A --> B --> C -->

C --> where? C to A? C to finished?  C to force close dialog?

What I'm looking for is a visual flow of the activities, what isn't
clear is what is supposed to happen once you start hitting the back
button.

>
> if i'm going to start Activity C from Activity B like this
>
> startActivity(Activity C);
>
> and when i press back button from activity C
>
>       �...@override
>        public boolean onKeyDown(int keyCode, KeyEvent event) {
>                // TODO Auto-generated method stub
>                if (keyCode == KeyEvent.KEYCODE_BACK) {
>                    finish();
>                        return true;
>                }
>                return false;
>        }
>
> since i have call finish() method application will redirect back to
> Activity B
>
> so once i'm redirected to Activity B is there a way to capture that
> i'v been back to Activity B
>

Yes, this is the purpose of startActivityForResult() and onActivityResult().

> because onCreate method will not fire up like that how can i capture
> it. then i'll be bale to finish() the activity

You are still trying to fudge your existing code to work. You need to
take this back to the design stage and work out exactly what it is you
want to do.

Saying things like:

> i want Activity C to run on top of Activity B.

Indicates that you require both activities to be open and
communicating with each other simultaneously, this is not a sensible
approach as Activity B could disappear at any time for a variety of
reasons.

Re-think your approach in terms of a website. You don't have
"index.html" and "basket.html" open at the same time, you communicate
between them using a combination of the HTTP request-response pattern
(in Android terms: startActivityforResult-onActivityResult), and
storage solutions such as databases and user sessions (in Android
terms: content providers and extending android.app.Application).

Decouple your dependencies between activities, and this will become a
lot easier.

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


[android-developers] Re: Android finishActivity()

2010-06-16 Thread mike

hi Sean,

finally finally i have sorted out. but not 100% but by 99% i have
achieved it.

give me your mail address so i'll mail you a sample code.

this is my Activity A

public class blur extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startActivity(new Intent(blur.this, Transparent.class));
//onPause();
}

@Override
protected void onResume() {
// TODO Auto-generated method stub
if (Constants.isViewedMSG) {
Log.d("RESUMEEE", "Resume activity");
finish();
}
super.onResume();
}
}

this is my Activity B


public class Transparent extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
setContentView(R.layout.trans);
}

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == KeyEvent.KEYCODE_BACK) {
// setResult(RESULT_CANCELED);

finish();
Constants.isViewedMSG = true;
return true;
}
return false;
}
}


this is my manifest.xml


http://schemas.android.com/apk/res/android";
  package="com.randika.blur"
  android:versionCode="1"
  android:versionName="1.0">













this is my theam.xml




true
#fff



this is my Constant class


public class Constants {
public static boolean isViewedMSG = false;
}


if you went through the source code you'l see the i have override
onResume method.
there i'm checking the Boolean value and according to boolean i'm
finishing the Activity A

regards,
MIke

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


[android-developers] Intercepting incoming call

2010-06-16 Thread Kartic
Hi,

I am making a Phone app and would like to intercept both incoming call
and outgoing call events.

My query is regarding ACTION_ANSWER.
earlier there was a problem in using this action (it has been
explained in the foloowing threads)

http://groups.google.com/group/android-developers/browse_thread/thread/f1d8099062581cbd/fe6d98c8efcd2c54?lnk=gst&q=ACTION_ANSWER#fe6d98c8efcd2c54

http://groups.google.com/group/android-developers/browse_thread/thread/f685d956286568c2/3ed85b2ab913295f?lnk=gst&q=ACTION_ANSWER#3ed85b2ab913295f

http://groups.google.com/group/android-developers/browse_thread/thread/b3913ba7a88dd1c8/be82bb942183d871?lnk=gst&q=ACTION_ANSWER#be82bb942183d871

Does this action work now? can anyone from google confirm this?

Thanks,
kartic

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

2010-06-16 Thread Yahel
Maybe you can tell us what the 4 mb pictures is used for.

Say if you are working on a game and it is your scrolling background,
maybe you could use tiles instead and only have smaller chunks.

I understand your question is about best practices, but maybe with a
use case scenario of these bitmap someone can come up with a better
strategy.

I take it you also set the BitmapFactory.Options.inInputShareable to
true so that BitmapFactory.Options.InPurgeable MIGHT not make a copy
of the data ?

Yahel

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


Re: [android-developers] Embedding appwidget in activity

2010-06-16 Thread Mark Murphy
On Wed, Jun 16, 2010 at 4:11 AM, angushir...@googlemail.com
 wrote:
>       I need to implement a reusable view for use in several Android
> applications. Would it be possible to develop an appWidget that can be
> embedded in an activity, or am I best off providing a customised
> component?

IMHO, you are best off creating a custom View. App widgets are
designed to go across process boundaries, and so they are more
restricted and less efficient for an activity than just an ordinary
View.

-- 
Mark Murphy
CommonsWare
mmur...@commonsware.com
http://commonsware.com

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


Re: [android-developers] How to store information in android setting menu

2010-06-16 Thread Mark Murphy
On Wed, Jun 16, 2010 at 4:06 AM, Nishant Kumar  wrote:
> Moreover, is it not possible to create my own setting menu inside android
> setting menu ? This will store information about my application

No, you cannot modify the Settings application, except by compiling
your own firmware. You can use the same UI structure as the Settings
application -- take a look at PreferenceActivity.

-- 
Mark Murphy
CommonsWare
mmur...@commonsware.com
http://commonsware.com

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


Re: [android-developers] switching GPS on and off

2010-06-16 Thread Mark Murphy
On Wed, Jun 16, 2010 at 3:52 AM, kamiseq  wrote:
> I cant really find anything on how to start GPS device if it is
> switched off and how to stop it if it is no longer needed.
> can someone guide me ???

When you request location updates (requestLocationUpdates()), GPS will
turn on automatically, if it is enabled and is not already on.

When you call removeUpdates(), GPS will turn off automatically, if
nothing else has requested GPS be on.

-- 
Mark Murphy
CommonsWare
mmur...@commonsware.com
http://commonsware.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] ListView - textrow not highlighted completely

2010-06-16 Thread AndyDev
Hi,
I have a ListView, with just text rows.

I had to click on the text only, to invoke the ClickListener.

If I click anywhere else on that text row, the row is not highlighted,
and the listener is not invoked.

Is there any property for ListView or TextView, to resolve this.

I want the whole textrow to be highlighted if its clicked anywhere
else on the row.

Thanks,
AndyDev

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


[android-developers] ListView - textrow color on click

2010-06-16 Thread AndyDev
Hi,
Is there a way that I can change the default color(yellow) to
something else, after the textrow in the ListView is clicked.

Thanks,
AndyDev

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


[android-developers] Problem in getting scroll position in web-view

2010-06-16 Thread brijesh masrani
Hello Everyone,

I have a web-view with Html content.I want to calculate height
of web-view when it is scrolled.

The method *getScrollY()* can return the Y scroll but the problem is that
when I scroll web-view 2-3 time continuously it takes some time in
scrolling.

I just want to know if there is a way to get event like *ScrollFinish()* so
that I can get actual size of web-view when scroll finish.

-- 
Regards,
Brijesh Masrani

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

[android-developers] Problem in getting scroll position in web-view

2010-06-16 Thread brijesh masrani
Hello Everyone,

I have a web-view with Html content.I want to calculate height
of web-view when it is scrolled.

The method *getScrollY()* can return the Y scroll but the problem is that
when I scroll web-view 2-3 time continuously it takes some time in
scrolling.

I just want to know if there is a way to get event like *ScrollFinish()* so
that I can get actual size of web-view when scroll finish.

-- 
Regards,
Brijesh Masrani

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

RE: [android-developers] Problem in getting scroll position in web-view

2010-06-16 Thread youken
What about   WebView.getContentHeight()?

 

  _  

From: android-developers@googlegroups.com 
[mailto:android-develop...@googlegroups.com] On Behalf Of brijesh masrani
Sent: Wednesday, June 16, 2010 8:18 PM
To: android-developers@googlegroups.com; android-beginn...@googlegroups.com
Subject: [android-developers] Problem in getting scroll position in web-view

 

Hello Everyone,

 

I have a web-view with Html content.I want to calculate height of web-view when 
it is scrolled. 

 

The method getScrollY() can return the Y scroll but the problem is that when I 
scroll web-view 2-3 time continuously it takes some time in scrolling.

 

I just want to know if there is a way to get event like ScrollFinish() so that 
I can get actual size of web-view when scroll finish.


-- 
Regards,
Brijesh Masrani

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

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

[android-developers] Re: switching GPS on and off

2010-06-16 Thread kamiseq
funny cos I ve always turned on GPS before using maps or other
application :-)

thanks

On 16 June, 12:46, Mark Murphy  wrote:
> On Wed, Jun 16, 2010 at 3:52 AM, kamiseq  wrote:
> > I cant really find anything on how to start GPS device if it is
> > switched off and how to stop it if it is no longer needed.
> > can someone guide me ???
>
> When you request location updates (requestLocationUpdates()), GPS will
> turn on automatically, if it is enabled and is not already on.
>
> When you call removeUpdates(), GPS will turn off automatically, if
> nothing else has requested GPS be on.
>
> --
> Mark Murphy
> CommonsWare
> mmur...@commonsware.comhttp://commonsware.com

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


[android-developers] Re: Problem in getting scroll position in web-view

2010-06-16 Thread brijesh
I know that but problem is not with method BUT problem is on Which
Event should i write IT..



On Jun 16, 4:40 pm, "youken"  wrote:
> What about   WebView.getContentHeight()?
>
>   _  
>
> From: android-developers@googlegroups.com 
> [mailto:android-develop...@googlegroups.com] On Behalf Of brijesh masrani
> Sent: Wednesday, June 16, 2010 8:18 PM
> To: android-developers@googlegroups.com; android-beginn...@googlegroups.com
> Subject: [android-developers] Problem in getting scroll position in web-view
>
> Hello Everyone,
>
> I have a web-view with Html content.I want to calculate height of web-view 
> when it is scrolled.
>
> The method getScrollY() can return the Y scroll but the problem is that when 
> I scroll web-view 2-3 time continuously it takes some time in scrolling.
>
> I just want to know if there is a way to get event like ScrollFinish() so 
> that I can get actual size of web-view when scroll finish.
>
> --
> Regards,
> Brijesh Masrani
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


RE: [android-developers] Re: Problem in getting scroll position in web-view

2010-06-16 Thread youken
WebViewClient.onPageFinished()

I think the height will not change when you scroll the webview. 
-Original Message-
From: android-developers@googlegroups.com 
[mailto:android-develop...@googlegroups.com] On Behalf Of brijesh
Sent: Wednesday, June 16, 2010 8:48 PM
To: Android Developers
Subject: [android-developers] Re: Problem in getting scroll position in web-view

I know that but problem is not with method BUT problem is on Which
Event should i write IT..



On Jun 16, 4:40 pm, "youken"  wrote:
> What about   WebView.getContentHeight()?
>
>   _  
>
> From: android-developers@googlegroups.com 
> [mailto:android-develop...@googlegroups.com] On Behalf Of brijesh masrani
> Sent: Wednesday, June 16, 2010 8:18 PM
> To: android-developers@googlegroups.com; android-beginn...@googlegroups.com
> Subject: [android-developers] Problem in getting scroll position in web-view
>
> Hello Everyone,
>
> I have a web-view with Html content.I want to calculate height of web-view 
> when it is scrolled.
>
> The method getScrollY() can return the Y scroll but the problem is that when 
> I scroll web-view 2-3 time continuously it takes some time in scrolling.
>
> I just want to know if there is a way to get event like ScrollFinish() so 
> that I can get actual size of web-view when scroll finish.
>
> --
> Regards,
> Brijesh Masrani
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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

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


[android-developers] Problem in getting result from filtered list

2010-06-16 Thread Addy
Hi.

In my application I used a custom list for displayed some country
name.

and for enable search from the list, Filter applied on the custom
list.

Filter works on a simply String ArrayList. And its work fine.

But My problem is When I searched for any country name the search
happend only on String's Starting letter not on the Any letter in the
string.

For example..
my country List is

List Country_List=new ArrayList();

Country_List.add("Australia");
Country_List.add("USA");
Country_List.add("England");
Country_List.add("China");

If my search text for country name is 'U'

then

It gives result  'USA' not ' Australia'.

But I want both reasult 'USA' and 'Australia' (Country name which
contains u letter in any position of its name)

Please Help me.

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


Re: [android-developers] Re: switching GPS on and off

2010-06-16 Thread Mark Murphy
On Wed, Jun 16, 2010 at 7:42 AM, kamiseq  wrote:
> funny cos I ve always turned on GPS before using maps or other
> application :-)

You may be confusing "enabled" and "on".

For example, HTC Sense phones have a home screen feature that looks
like an on/off switch for GPS. That, however, controls whether GPS is
enabled. GPS is only truly powered on if some application is looking
for location data. GPS receivers consume a fair bit of battery life,
so you do not want to keep them powered on all of the time.

-- 
Mark Murphy
CommonsWare
mmur...@commonsware.com
http://commonsware.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: Android finishActivity()

2010-06-16 Thread UD
Hi Mike,

I would suggest a better approach for this.


Firstly I will put your problem in my worlds what I understand:

You have 3 Activities ActivityA, ActivityB, ActivityC.
ActivityA is starting activity.

Activities launch sequence is:-

ActivityA -->(On some user action) --> ActivityB --> (After some time,
say 5seconds) --> ActivityC

And closing sequence:-

ActivityC -->(On Back button press) --> ActivityA.  (Skipping
ActivityB from stack) -->(Pressing back key from ActivityA will exit
the application)

--

Solution:-
-

Step1-  In ActivityA on some user action start ActivityB

  public void someUserAction() {
Intent intB = new Intent(ActivityA.this, ActivityB.class)
startActivity (intB);   // This will start ActivityB keeping
ActivityA below in the stack.
// Note: don't call finish() here, in this Activity.
  }



Step2-  In ActivityB, on some timer timeout, start ActivityC with
startActivityForResult

  public void onSomeTimerTimeout () {
Intent i = new Intent(ActivityB.this, ActivityC.class);
startActivityForResult(i, 1001);  // 1001 is just some request 
code.
You will need this in onActivityResult() (step4)
// This will start ActivityC keeping ActivityB in
stack below ActivityC for the background blur look-n- feel as you
need.
}

-

Step 3- In ActivityC handle back key press:

  @Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_BACK) {
 setResult(RESULT_CANCELED);
 // This will set the Result as RESULT_CANCELED and finish
this AvtivityC. Going back to ActivityB.
 finish();
 return true;
  }
  else {
  return false;
  }
}

--

Step4- Now back in ActivityB, override onActivityResult()

  protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
if (resultCode == RESULT_CANCELED) {
finish();
// This will check if the result is RESULT_CANCELED (set in
ActivityC), and finish this ActivityB without even showing up the
screen for ActivityB. So user will feel like going back to ActivityA
directly from ActivityC.
}

-

Step5- Note: Keep all window manager flags (Blur, transparent)
unchanged. As per your requirement.

--
Try this out, and revert back in case of any queries.

--
Regards,
Udayan Warnekar
Android Application Developer






On Jun 16, 3:02 pm, mike  wrote:
> hi Sean,
>
> finally finally i have sorted out. but not 100% but by 99% i have
> achieved it.
>
> give me your mail address so i'll mail you a sample code.
>
> this is my Activity A
>
> public class blur extends Activity {
>         /** Called when the activity is first created. */
>         @Override
>         public void onCreate(Bundle savedInstanceState) {
>                 super.onCreate(savedInstanceState);
>                 setContentView(R.layout.main);
>                 startActivity(new Intent(blur.this, Transparent.class));
>                 //onPause();
>         }
>
>         @Override
>         protected void onResume() {
>                 // TODO Auto-generated method stub
>                 if (Constants.isViewedMSG) {
>                         Log.d("RESUMEEE", "Resume activity");
>                         finish();
>                 }
>                 super.onResume();
>         }
>
> }
>
> this is my Activity B
>
> public class Transparent extends Activity {
>
>         @Override
>         protected void onCreate(Bundle savedInstanceState) {
>                 // TODO Auto-generated method stub
>                 super.onCreate(savedInstanceState);
>                 
> getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
>                                 WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
>                 setContentView(R.layout.trans);
>         }
>
>         @Override
>         public boolean onKeyDown(int keyCode, KeyEvent event) {
>                 // TODO Auto-generated method stub
>                 if (keyCode == KeyEvent.KEYCODE_BACK) {
>                         // setResult(RESULT_CANCELED);
>
>                         finish();
>                         Constants.isViewedMSG = true;
>                         return true;
>                 }
>                 return false;
>         }
>
> }
>
> this is my manifest.xml
>
> 
> http://schemas.android.com/apk/res/android";
>       package="com.randika.blur"
>       android:versionCode="1"
>       android:versionName="1.0">
>     
>                            android:label="@string/app_name">
>             
>                 
>                  android:name="android.intent.category.LAUNCHER" />
>             
>         
> 
>     
>     
>
> 
>
> this is my theam.xml
>
> 
> 
>              parent="android:style/

[android-developers] OnOrientationChanged leaks in ListView

2010-06-16 Thread Alok Kulkarni
Hi,
I am having a ListView with custom ArrayAdapter.For defining a list item i
have my own class ListItem which stores all info including list item images,
and other textual info in it.
I have handled orientation change in onRetainNonConfigurationInstance() in
which i save the array of ListItems in another object.. and when the
Activity is recreated i reassign the array of list items to those of the
activity. Then i create an ArrayAdapter accordingly .I use adb shell
procrank and find out that i am leaking memory everytime i change
orientation. I have debugged through and found out that the leak is in
arraylist of list items itself.What wrong am i doing here ?
Thanks ,
Alok.

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

[android-developers] Fix for OutofMemoryError: bitmap size exceeds VM budget

2010-06-16 Thread pawan nimje
Hi all,

in my application i have a functionality where a user can take photo and
poet it to a web server or select a photo from galerry and upload.

So initially i used to get below exception for the very* first time* i used
to select a photo:

Android: OutofMemoryError: bitmap size exceeds VM budget .

then i used:

*options.inSampleSize = 2;*

Now the problem is im still getting the same exception ... *the only
difference is im getting exception after 2-3 times.*

i.e im able to upload 2-3 (one by one) photos and then i get the exception

any suggestions ???

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

2010-06-16 Thread Neilz
Hi all.

When I update the textview within my scrollview, I want the scrollview
to automatically scroll down to the bottom, so that the latest text is
displayed.

I've tried this code:

scroll.fullScroll(ScrollView.FOCUS_DOWN);

...and it worked once or twice, intermittently, but generally has no
effect at all.

Anyone know a better way to achieve this?

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


[android-developers] bug with notifyDataSetChanged() in ArrayAdapter ?

2010-06-16 Thread Christophe
hello everyone,

I have a strange problem with one of my ListActivity. I have overrided
the default ArrayAdapter in order to customize my list. I have then
filled the adapter with an ArrayList.

If I insert an element on the list and then call
notifyDataSetChanged() on the adapter everything works fine.

But if I insert an element at the END of the list and then call
notifyDataSetChanged(), the new element doesn't  appear ...

And finally if I override getCount() on my adapter like this :

@Override
public int getCount() {
return myArrayList.size();
}

then everything works fine.
Is this a bug or am I doing something wrong ?

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


[android-developers] Re: Oracle Android App Store

2010-06-16 Thread gosh
>> When I look at BlackBerryAppWorld it lists over 200 countries which...
Not so.

They currently offer free apps to 56 countries and paid apps to 13
countries (a slightly different 13 than Android Market's 13 ... Not
Canada! - no, just kidding).
Its not that clear which countries Blackberry developers can sell
'from'?

See: 
http://www.blackberry.com/app_includes/devicesoftware/appworld/appworld_availability_en.html

Steve

On Jun 11, 2:46 am, Leigh McRae 
wrote:
> When I look at BlackBerryAppWorld it lists over 200 countries which
> seems high but I know they support almost everywhere by now so perhaps
> it's correct.  I find it crazy that Canada isn't supported considering
> NAFTA.
>
> I really don't think Google is all that interested in paid apps as they
> are in extending their ad network to handhelds.  You can't really blame
> them as it's their core business.
>
> Also I suspect that Apple wouldn't have passed MS in market cap if 
> theappstorehad the same return policy as the android market.
>
> Leigh
>
> On 6/10/2010 11:51 AM, gosh wrote:
>
>
>
>
>
> >OracleAndroidAppStore
>
> > Here's the countries that developers can currently sell from via
> > Android Market:
> >http://www.google.com/support/androidmarket/bin/answer.py?answer=150324
>
> > Here's the countries that Android Market offers free apps to:
> >http://www.google.com/support/androidmarket/bin/answer.py?hl=en&answe...
>
> > Here's the countries that Android Market sells to:
> >http://www.google.com/support/androidmarket/bin/answer.py?hl=en&answe...
> > (i.e. the 13 countries down the bottom of the same page)
>
> > These haven't changed much for a long time - e.g. 9 countries in that
> > first list haven't changed since September 2009.
> > (Googles Knows why its not the same 13 where users can buy from)
>
> > How does this compare with the other mobile OS vendors?
>
> > Apple'sAppStorecurrently works in 90 countries. In Feb'2010 they
> > added: Armenia, Botswana, Bulgaria, Jordan, Kenya, Macedonia,
> > Madagascar, Mali, Mauritius, Niger, Senegal, Tunisia, and Uganda  ...
> > i.e. they are going to run out of global map real soon now. Say what
> > you like about them, but they take paid apps seriously.
> > I.e. see:  
> > http://developer.apple.com/iphone/news/archives/2010/february/#newspr...
>
> > Here's the 29 countries that Microsoft's Windows Phone Marketplace
> > developers can sell to (and upload from):
>
> >http://developer.windowsphone.com/help.aspx?id=fd9b5508-6436-4503-917...
>
> > ...when the forthcoming Windows7 Phone hits the market later this
> > year.
>
> > What both Androidappdevelopers and global Android users need is
> > another substantialappstorerun by a globally recognised ICT entity
> > with a global presence (not carrierappstores such as Motorola's), an
> > International commitment, and that uses more conventional payment
> > methods (PayPal/ the standard Credit Cards). It will happen eventually
> > given the gapping great gap in the Android Market service roll-out all
> > this time. I'd lay odds onOraclesetting up an AndroidAppStorethat
> > uses PayPal, which seems an odd possibility at first, but then when
> > you think about it more seriously, it makes commercial sense from a
> > lot of different angles:
> > - Sun had a JavaStorethat used PayPal.
> > - They now control Java.
> > - They like making money from software.
> > - As Google moves to Web apps within the forthcoming WebStore,Oracle
> > could befriend Android developers (via global distribution) and
> > gradually try to move them towards JavaFX apps (whatever plans they
> > have for that).
> > - In building such anappstoreit could showcase their existing
> >OracleStoreproduct for building such things.
> > - They could entice Androidappdevelopers to develop 'services' for
> > their own apps on their own MySQL/OracleDBMS servers (supplied by
> >Oracle), or via anOraclecloud.
>
> > Any votes for anOracleAndroidAppStore?
> > Any votes for a Yahoo! AndroidAppStore?
> >   or
> > What other major ICT/media company could pull off such a marketing
> > coup?
>
> --
> Leigh McRaewww.lonedwarfgames.com

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


[android-developers] Setting Translucent Theme from Java

2010-06-16 Thread droidsan
Depending on an extra value of the Intent that starts my Activity the
Activity should show up with translucent or solid background.
Therefore, I use the following code in my Activity's onCreate method:

if (getIntent().getBooleanExtra("transparent", false)) {
setTheme(android.R.style.Theme_Translucent);
}
else {
setTheme(android.R.style.Theme_Black);
}

setContentView(R.layout.main);

However, with this code the background of my Activity never becomes
translucent, even if setTheme(android.R.style.Theme_Translucent) is
called. (The same code works well when using themes that only set font
sizes).

I assume that the background for my Activity is already set during
inflation of the Activity and that setContentView only puts my View
(i.e. R.layout.main) on top of this background.

Is there a way to change translucency of my Activity from Java code?

Thanks for your help.

Droidsan.

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

2010-06-16 Thread Moto
Hi,

I'm currently trying to debug an issue with my application and I
wanted to see if my internal proxy is sending the data in the proper
order.  Is there any way to essentially sniff my proxy pipe?

Thanks!
-Moto

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


Re: [android-developers] how to filter the objects (addresses) to display only the onscreen objects on map

2010-06-16 Thread Hasn AlTaiar
Hi Frank,

Thank you very very much for your kind reply,
I really do appreciate it.

I have looked at the methods of .getLatitudeSpan() and .getLongtudeSpan().
However, I could not understand the return type of both of them, in the API
it said, they would return (int), and it also said "in  decimal degrees"
which I do not understand indeed.

To filter the addresses (POI) before displaying them on the map, I need the
range of GeoLocations (lat, long) from a starting point on the map to the
end point, which would represent the edges of the visible part of the map on
screen. Then I 'll be able to use this range to check wether the addresses
(POI) will fall in this range or not.

Any help will be greatly appreciated.

Cheers
Hasn



On Wed, Jun 16, 2010 at 3:35 PM, Frank Weiss  wrote:

> If you use:
>
> com.google.android.maps.MapView.getCenter(),
> com.google.android.maps.MapView.getLatitudeSpan(),
> com.google.android.maps.MapView.getLongitudeSpan()
>
> you can compute a lat/long bounding rectangle to filter the items you
> add to the List, for the given map's state of zoom and
> pan.
>
> Please refer to the MapView reference page:
> http://code.google.com/android/add-ons/google-apis/reference
>
> The reason I recommend using lat/long instead of pixels is because the
> filtering at that level is closer to the model instead of the view,
> respecting the MVC architecture for UIs. In my applications, the raw
> items or points of interest (POI) are already geocoded. Actually in
> the Bank of America application, the lat/long bounds are sent as
> request parameters to the server, which does the filtering. Also, if
> your data were coming from a GeoRss feed, it's highly likely that the
> lat/long bounds would be provided in the request, not the pixel
> bounds.
>
> Another way of looking at it is if we assume the raw data is
> goeocoded, why bother mapping each of those lat/longs to pixels in
> order to filter 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
>



-- 

(Hasn) Hasnain AlTaiar
Web Developer
TayTech Smart Solutions
http://TayTechs.com
h...@taytechs.com
Mob.  +61 422 04 2629

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

[android-developers] ListView with sections from a SINGLE Cursor

2010-06-16 Thread sasq
I've been looking around a lot on how to separate a ListView into
sections with headers, and all solutions are based on using multiple
adapters.

I have only a single database query that is ordered by a specific
field. I want to present this information in a ListView, and insert
headings whenever the field changes.

For instance, you search a large amount of music files for "love" and
get a list like this:

== Alice Bung ==
Love boat
=== Beavers ===
Lots of Love
No Love
Zlovek Zlatan
=== Some other Group ==
Another song about love
Yet another song about love

Actually inserting the headers as a second viewtype requires you to
scan the whole result to get an accurate count.
The best I've come up with is returning the Header combined with the
first item as a single view so as to keep the count correct, but then
selection looks wrong.

Any tips?

-- Jonas


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


Re: [android-developers] ListView with sections from a SINGLE Cursor

2010-06-16 Thread Connick
I'm facing this exact challenge this morning! +1


On Wed, Jun 16, 2010 at 11:33 AM, sasq  wrote:

> I've been looking around a lot on how to separate a ListView into
> sections with headers, and all solutions are based on using multiple
> adapters.
>
> I have only a single database query that is ordered by a specific
> field. I want to present this information in a ListView, and insert
> headings whenever the field changes.
>
> For instance, you search a large amount of music files for "love" and
> get a list like this:
>
> == Alice Bung ==
> Love boat
> === Beavers ===
> Lots of Love
> No Love
> Zlovek Zlatan
> === Some other Group ==
> Another song about love
> Yet another song about love
>
> Actually inserting the headers as a second viewtype requires you to
> scan the whole result to get an accurate count.
> The best I've come up with is returning the Header combined with the
> first item as a single view so as to keep the count correct, but then
> selection looks wrong.
>
> Any tips?
>
> -- Jonas
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Re: [android-developers] How to trace localhost proxy connection?

2010-06-16 Thread David Turner
If you are using the emulator, try the -tcpdump  option, it will save
the emulated ethernet traffic into a file that you can open with WireShark.

On Wed, Jun 16, 2010 at 7:27 AM, Moto  wrote:

> Hi,
>
> I'm currently trying to debug an issue with my application and I
> wanted to see if my internal proxy is sending the data in the proper
> order.  Is there any way to essentially sniff my proxy pipe?
>
> Thanks!
> -Moto
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Re: [android-developers] ListView with sections from a SINGLE Cursor

2010-06-16 Thread Brad Gies

Hi,

Sorry, I don't have time to look up the links for you, but search this 
group for getItemViewType and getViewTypeCount. There was a thread in 
the last week that had a couple of very good links explaining exactly 
what you want to do. I'm pretty sure the message you want was from Mark 
Murphy.






On 16/06/2010 8:33 AM, sasq wrote:

I've been looking around a lot on how to separate a ListView into
sections with headers, and all solutions are based on using multiple
adapters.

I have only a single database query that is ordered by a specific
field. I want to present this information in a ListView, and insert
headings whenever the field changes.

For instance, you search a large amount of music files for "love" and
get a list like this:

== Alice Bung ==
Love boat
=== Beavers ===
Lots of Love
No Love
Zlovek Zlatan
=== Some other Group ==
Another song about love
Yet another song about love

Actually inserting the headers as a second viewtype requires you to
scan the whole result to get an accurate count.
The best I've come up with is returning the Header combined with the
first item as a single view so as to keep the count correct, but then
selection looks wrong.

Any tips?

-- Jonas


   


--
Sincerely,

Brad Gies
---
Bistro Bot - Bistro Blurb
http://www.bgies.com
http://www.bistroblurb.com
http://www.bistrobot.com
---

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

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


Re: [android-developers] how to filter the objects (addresses) to display only the onscreen objects on map

2010-06-16 Thread Frank Weiss
The return type of the *Span() methods is int as follows:

Latitude: 47° 30' 21", in decimal degrees 47.505833, times one million
47505833.
This allows for using integers instead of floats for storing and
comparing lat/longs.

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


Re: [android-developers] ListView with sections from a SINGLE Cursor

2010-06-16 Thread Mark Murphy
>> Actually inserting the headers as a second viewtype requires you to
>> scan the whole result to get an accurate count.
>>
>> The best I've come up with is returning the Header combined with the
>> first item as a single view so as to keep the count correct, but then
>> selection looks wrong.
>>
>> Any tips?

Step #1: Run a query to get you your count of headers (SELECT
COUNT(DISTINCT artist) FROM thatfunkymusic WHERE...)

Step #2: Run your current query and pour it into your existing CursorAdapter

Step #3: Create a custom Adapter that wraps around your existing
CursorAdapter (see CWAC-Adapter). This adapter will need to return the
correct count, adjust all references to positions to take the headers
into account, return the proper number of view types, return the
headers for the proper positions, and all that jazz.

http://github.com/commonsguy/cwac-adapter

In other words, it is doable without a bunch of individual queries,
but it is not terribly straight-forward. I have added this to my
running list of "reusable components to write someday", but if
somebody beats me to it, that'd be absolutely delightful.

-- 
Mark Murphy
CommonsWare
mmur...@commonsware.com
http://commonsware.com

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


Re: [android-developers] how to parse this string using json

2010-06-16 Thread Brad Gies

Where are you getting the JSON String from?
If you change the double quotes to single quotes it will convert to a 
JSON Array, and you can get each object by using :


JSONObject jObj = JArray.getJSONObject(0);
JSONObject jObj = JArray.getJSONObject(1);

[{'id': 1, 'fields': {'Name': 'hello1', 'Age': '10' }},  {'id': 2, 
'fields': {'Name': 'hello2', 'Age': '12'}}]




On 15/06/2010 11:47 PM, rahul jain wrote:

[{"id": 1, "fields": {"Name": "hello1", "Age": "10" }},
{"id": 2, "fields": {"Name": "hello2", "Age": "12"}}]
   


--
Sincerely,

Brad Gies
---
Bistro Bot - Bistro Blurb
http://www.bgies.com
http://www.bistroblurb.com
http://www.bistrobot.com
---

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

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


Re: [android-developers] android and restful api

2010-06-16 Thread Frank Weiss
Please read this page carefully:
http://developer.android.com/intl/de/reference/android/os/AsyncTask.html

Google for blogs on the subject "AsyncTask".

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

2010-06-16 Thread Nathan

On Jun 16, 2:29 am, MarcoAndroid  wrote:
> 1) 3-4M for one image is a lot since you have total of 16M for the
> whole app! Dunno the answer to your question

Yep

> 2) 25*256K in bitmaps is already over 6,4M. Added to 1) makes already
> over 10M! AFAIK you should only use .recycle() if you really don't
> need them anymore. Unclear to me what "really don't need" means.

That you can't use the bitmap object for drawing after you call
recycle. You'd have to recreate it.

> 3) 32x32 pixels is about 204800 bytes if you count 4 bytes per pixel
I was thinking 4096 bytes.

> 4) These icons are probably not big right?
>
No ,they are only 32x32 as well.

At one point, though, I have 50 or so icons in a gridview.

If I call:

 imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
 imageView.setImageResource(icon_id);

Does anyone know if the ImageView will create and preserve a bitmap of
the scaled up size? If so, that's bad, and I need to exert more
control.

> The allocation tracker didn't give enough details for me, so am using
> the Eclipse Memory Analyzer Tool. Here's a pretty handy tutorial on
> how to use it & detect memory leaks, maybe 
> useful:http://ttlnews.blogspot.com/2010/01/attacking-memory-problems-on-andr...
>

I think that will help.

Nathan

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

2010-06-16 Thread nikhil
Let me know if you get the solution to this problem.

On Jun 15, 4:26 pm, hansamann  wrote:
> Sorry, no answer, but you just helped me a lot by letting me know that
>
> android:configChanges="orientation"
>
> stops thewebviewreloading!!!
>
> Sven
>
> On Jun 15, 2:16 pm, nikhil  wrote:
>
> > I have awebviewand I am using
> > android:configChanges="orientation" to restrain thewebviewfrom
> > reloading everytime theorientationchanges.
>
> > I also have two different folders layout-port and layout-land to
> > define the layouts for different orientations.
>
> > If I use android:configChanges="orientation" then the above two
> > folders are ignored. Can I have both working at the same time?

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


[android-developers] blank screen with opengl

2010-06-16 Thread Simone
I got this, to show a rectangle:

private float[] sCoords = {
// X, Y, Z
 GameRenderer.W/3, GameRenderer.H/3, 0,
 GameRenderer.W/3,  20f, 0,
 30f,  20f, 0,
 30f, GameRenderer.H/3, 0
};

...

gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFVertexBuffer);
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLE_FAN, VERTS,
GL10.GL_UNSIGNED_SHORT, mIndexBuffer);

and previously:

public void onSurfaceChanged(GL10 gl, int w, int h) {
   gl.glViewport (0, 0,  w, h);
   gl.glMatrixMode (GL10.GL_PROJECTION);
   gl.glLoadIdentity ();
   gl.glOrthox(0, w, 0, h, -1, 1);
   W=w;
   H=h;
   rect = new Rectangle();
}


I should see a rectangle, but I only see a white screen.
Any help?
Simone

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


[android-developers] logcat buffer size

2010-06-16 Thread Jeffrey Blattman
i want to increase the logcat buffer size. that is, when i do "logcat" from
adb or from a shell, i want to see more historical log entries.

i see that logcat has a "-r " option, but that requires "-f
" also. i don't understand what this means. i want to change the
size of the default buffer, why is it asking me for a file name? my
understanding is that logcat is just a wrapper around /dev/log/*?

i realize i might have a fundamental misunderstanding about what "-r"
actually does. for example, it sounds like it may cause the system to create
a file-based rotated log, in addition to the /dev/log/* devices? that's not
really what i want.

? 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: Orientation and Webview

2010-06-16 Thread Maps.Huge.Info (Maps API Guru)
If you change the default behavior of your app with the configChanges,
then you just have to handle the loading of a different resource
yourself. Also, don't forget to handle the keyboard as well.

-John Coryat

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

2010-06-16 Thread Nathan


On Jun 16, 3:43 am, Yahel  wrote:
> Maybe you can tell us what the 4 mb pictures is used for.
>

It's a screen buffer. It's not useful to me unless it covers the
entire screen - and then some because of arbitrary rotation. So it can
easily be a 908x908 image on Incredible.

> Say if you are working on a game and it is your scrolling background,
> maybe you could use tiles instead and only have smaller chunks.
>

That's what the 25 or so chunks in number two are. But as pointed out
here, they can be taking up even more room, albeit in smaller chunks.
I believe the buffer saves me from rendering these 25 images and
hundreds of smaller ones, plus some lines and points each time. I
won't rule out eliminating the screen buffer, but I'd have to profile
it.


> I take it you also set the BitmapFactory.Options.inInputShareable to
> true so that BitmapFactory.Options.InPurgeable MIGHT not make a copy
> of the data ?
>
Yes. I set both of those. On 1.6 or higher that is.

I can see that it is likely that inPurgeable is not effective enough
for my cache of images in number two. If it were, there would be 6
megabytes of bitmaps that could be purged before returning failure.
Since it is a hint, it's certainly possible that the HTC Incredible
doesn't do much for it. If that holds up under analysis, then perhaps
the best scheme to force purgeability at certain times.

Nathan

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

2010-06-16 Thread sasq

Ok, then I will probably stick with my current solution... if the
title has a solid background and is relatively small it all looks
pretty OK.
The only issue is the missing line under the title and the fact that
you can click the title to select the item below it.

The problem with your solution seems to be if you scroll directly to
the center of a large list, then you'd have to scan back to the
beginning to find the correct offset.

-- Jonas


On Jun 16, 6:15 pm, Mark Murphy  wrote:
> >> Actually inserting the headers as a second viewtype requires you to
> >> scan the whole result to get an accurate count.
>
> >> The best I've come up with is returning the Header combined with the
> >> first item as a single view so as to keep the count correct, but then
> >> selection looks wrong.
>
> >> Any tips?
>
> Step #1: Run a query to get you your count of headers (SELECT
> COUNT(DISTINCT artist) FROM thatfunkymusic WHERE...)
>
> Step #2: Run your current query and pour it into your existing CursorAdapter
>
> Step #3: Create a custom Adapter that wraps around your existing
> CursorAdapter (see CWAC-Adapter). This adapter will need to return the
> correct count, adjust all references to positions to take the headers
> into account, return the proper number of view types, return the
> headers for the proper positions, and all that jazz.
>
> http://github.com/commonsguy/cwac-adapter
>
> In other words, it is doable without a bunch of individual queries,
> but it is not terribly straight-forward. I have added this to my
> running list of "reusable components to write someday", but if
> somebody beats me to it, that'd be absolutely delightful.
>
> --
> Mark Murphy
> CommonsWare
> mmur...@commonsware.comhttp://commonsware.com

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


Re: [android-developers] Run android apps on Linux natively

2010-06-16 Thread Alan Carvalho de Assis
Hi,

On 5/18/10, suhas  wrote:
> Hello,
>   I have ported and built the android kernel for x86 and it is
> booting
> up on ubuntu. Now I want to know how to run android applications
> natively on ubuntu without SDK. As I have said i have the android
> kernel working. How do I go about running or executing these android
> applications.? The simple helloworld java application would be more
> than enough.
>

FYI:
http://arstechnica.com/open-source/news/2009/05/canonical-developers-aim-to-make-android-apps-run-on-ubuntu.ars

RGs,

Alan

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

2010-06-16 Thread Nathan

I tried the Eclipse MAT tool. Really cool stuff.

Unfortunately, it appears blind to bitmaps, at least so far.

I was relieved to find out that the 4 Megabyte bitmap is only taking
up 32 bytes. ;)

The cache of 25 bitmaps was listed as the biggest suspect. But with a
retained heap of 600K, this only includes the original bytes, and
doesn't tell me if any of the uncompressed bitmaps are taking up
memory.

This is going to be a serious limitation of tools if they can't see
bitmaps, especially if bitmaps are your biggest suspects for leaks.

Romain, do you know if you can make any tool see bitmaps?

Nathan

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


Re: [android-developers] Re: Bitmaps and OutOfMemoryError: Best Practices needed

2010-06-16 Thread Romain Guy
Bitmaps are allocated on the native heap but their size is counted
against the Java heap limit. You can use tools like MAT to see whether
you are leaking Bitmap objects but you can't rely on these tools to
measure the amount of memory used by those bitmaps. Thankfully, it's
very easy to figure out how much memory is used by a bitmap :)

On Wed, Jun 16, 2010 at 11:44 AM, Nathan  wrote:
>
> I tried the Eclipse MAT tool. Really cool stuff.
>
> Unfortunately, it appears blind to bitmaps, at least so far.
>
> I was relieved to find out that the 4 Megabyte bitmap is only taking
> up 32 bytes. ;)
>
> The cache of 25 bitmaps was listed as the biggest suspect. But with a
> retained heap of 600K, this only includes the original bytes, and
> doesn't tell me if any of the uncompressed bitmaps are taking up
> memory.
>
> This is going to be a serious limitation of tools if they can't see
> bitmaps, especially if bitmaps are your biggest suspects for leaks.
>
> Romain, do you know if you can make any tool see bitmaps?
>
> Nathan
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



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

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

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


Re: [android-developers] Re: ListView with sections from a SINGLE Cursor

2010-06-16 Thread Mark Murphy
On Wed, Jun 16, 2010 at 1:56 PM, sasq  wrote:
> Ok, then I will probably stick with my current solution... if the
> title has a solid background and is relatively small it all looks
> pretty OK.
> The only issue is the missing line under the title and the fact that
> you can click the title to select the item below it.
>
> The problem with your solution seems to be if you scroll directly to
> the center of a large list, then you'd have to scan back to the
> beginning to find the correct offset.

No, just cache it.

-- 
Mark Murphy
CommonsWare
mmur...@commonsware.com
http://commonsware.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 sections from a SINGLE Cursor

2010-06-16 Thread sasq


On Jun 16, 8:52 pm, Mark Murphy  wrote:
> On Wed, Jun 16, 2010 at 1:56 PM, sasq  wrote:
>
> > The problem with your solution seems to be if you scroll directly to
> > the center of a large list, then you'd have to scan back to the
> > beginning to find the correct offset.
>
> No, just cache it.

Provided the View has asked for those items - which AFAIK it wont if
the dataset is large enough and you jump directly into it.
(say you do something like a google search that returns millions of
hits...)

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


[android-developers] Correct way to set up buffer for glReadPixels?

2010-06-16 Thread Geefer
Hi,
What is the correct way to set up a buffer for the return data for
gl.glReadPixels? Does it have to be a direct buffer or is simply
wrapping an integer array ok (with IntBuffer.wrap)? I have seen both
used by various people in online examples.

I am currently wrapping an integer array and it works fine - except on
one particular phone manufacturer (Sony) on which apparently the data
returned is sometimes corrupt - and I am wondering if this might be
the cause?

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


Re: [android-developers] Re: ListView with sections from a SINGLE Cursor

2010-06-16 Thread Mark Murphy
On Wed, Jun 16, 2010 at 2:59 PM, sasq  wrote:
>> > The problem with your solution seems to be if you scroll directly to
>> > the center of a large list, then you'd have to scan back to the
>> > beginning to find the correct offset.
>>
>> No, just cache it.
>
> Provided the View has asked for those items - which AFAIK it wont if
> the dataset is large enough and you jump directly into it.
> (say you do something like a google search that returns millions of
> hits...)

If you have sample code that demonstrates this, please point me to it! Thanks!

-- 
Mark Murphy
CommonsWare
mmur...@commonsware.com
http://commonsware.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: Bitmaps and OutOfMemoryError: Best Practices needed

2010-06-16 Thread Nathan
On Jun 16, 11:48 am, Romain Guy  wrote:
> Bitmaps are allocated on the native heap but their size is counted
> against the Java heap limit. You can use tools like MAT to see whether
> you are leaking Bitmap objects but you can't rely on these tools to
> measure the amount of memory used by those bitmaps.

Too bad.

> Thankfully, it's
> very easy to figure out how much memory is used by a bitmap :)

Not true in all cases. Look at BitmapFactory.Options:

---
public boolean inPurgeable

Since: API Level 4
If this is set to true, then the resulting bitmap will allocate its
pixels such that *they can be purged if the system needs to reclaim
memory*. In that instance, when the pixels need to be accessed again
(e.g. the bitmap is drawn, getPixels() is called), they will be
automatically re-decoded. For the re-decode to happen, the bitmap must
have access to the encoded data, either by sharing a reference to the
input or by making a copy of it. This distinction is controlled by
inInputShareable. If this is true, then the bitmap may keep a shallow
reference to the input. If this is false, then the bitmap will
explicitly make a copy of the input data, and keep that. Even if
sharing is allowed, the implementation may still decide to make a deep
copy of the input data.
-

Unless you assume using inPurgeable is utterly useless, I can't tell
if those bitmaps are being purged when necessary.

That means that bitmap is using either 0, 29K bytes, 256k bytes.
That's quite a range.

In total, that means that this bitmap collection is using somewhere
between 600K bytes and 7K bytes. Quite a range also.

So is inPurgeable useless or does it work?

Nathan

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

2010-06-16 Thread Kumar Bibek
If you know the path, you can access all the details through the
MediaStore content provider.

Cursor cursor = managedQuery(Uri.parse(data.getDataString()), null,
null, null, null);
cursor.moveToNext();

// Retrieve the path and the mime type
String path = cursor.getString(cursor
.getColumnIndex(MediaStore.MediaColumns.DATA));
String mimeType = cursor.getString(cursor
.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE));

For this, you need to know the ContentURI of the image/video.

Thanks and Regards,
Kumar Bibek
http://tech-droid.blogspot.com

On Jun 15, 4:30 pm, chetan achar  wrote:
> There is a file called Mediafile.java and MediaScanner.java in
> frameworks base. Just go through it.
>
>
>
> On Tue, Jun 15, 2010 at 4:46 PM, allstars  wrote:
> > hi
> > i would like to get the mime type of my local media file (3gpp ,
> > mp4, ...etc)
>
> > if it is of video
> > then i want to allocate a SurfaceView for it additionally
> > otherwise i just use MediaPlayer to play it
>
> > i have found opencore has provided some interface for that
> > and used by mediascanner.cpp
>
> > but it seems in android media framework it isnt
>
> > so can i achieve this by using android media framework?
>
> > 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
>
> --
> With Regards,
> Chetz

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


[android-developers] Setting background color on row layout prevents display of highlight on select

2010-06-16 Thread Connick
I'm setting background color based on a given state of an object in each row
in a list. That part is working just fine but when I set the background
color on the outermost layout the row no longer highlights when selected.
Probably a specific attribute I'm not setting/changing?

Thanks,
Stace

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

[android-developers] /log/dev/radio, /log/dev/events

2010-06-16 Thread BuckeyeDroid
Does anyone know where these files get created?

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: Help me out with my Listview custom row layout, I already tried many combinations

2010-06-16 Thread Kumar Bibek
There are some errors I found. Have a look at this xml.

But without knowing what exactly you want, I can't really help you
with the layout. A screenshot will be helpful.


http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="4dip">








Thanks and Regards,
Kumar Bibek
http://tech-droid.blogspot.com

On Jun 13, 7:42 pm, Shai  wrote:
> Hi,
> I am having trouble getting my layout to give me result I need, I
> already tried many options and it seems that I'm doing something wrong
> or completely missing something.
>
> I have a listview with a custom row layout I can't seem to working
> although it shouldn't be complex.
> I need of the list row to insist of:
>
> Icon --  title text (bigger and bold) with a short multi line text
> under the title -- ImageButton
>
> My problem in most of my tests is the icon to the right usually
> doesn't appear, I guess my center group grows and takes all the space
> of the button.
> My last failed attempt was with a Relative Layout, didn't have too
> much luck with a Linear Layout either.
>
> Here is the row XML:
>
> 
> http://schemas.android.com/apk/res/
> android"
>      android:layout_width="fill_parent"
>      android:layout_height="wrap_content"
>      android:padding="4dip">
>              android:id="@+id/icon"
>         android:layout_width="48dip"
>         android:layout_height="48dip"
>         android:src="@drawable/icon"
>         android:layout_marginRight="4dip"
>         />
>
>             android:id="@+id/centertext"
>      android:layout_width="wrap_content"
>      android:layout_height="wrap_content"
>      android:layout_toRightOf="@+id/icon"
>      android:orientation="vertical"
>          >
>                      android:id="@+id/titletext"
>             android:textSize="16sp"
>             android:textStyle="bold"
>             android:textColor="@color/titlecolor"
>             android:layout_width="fill_parent"
>             android:layout_height="wrap_content"
>
>             />
>                          android:id="@+id/summarytext"
>             android:layout_width="fill_parent"
>                 android:layout_height="fill_parent"
>             android:textSize="10sp"
>             android:textColor="@color/titlecolor"
>             android:singleLine="false"
>
>         />
>     
>
>          android:id="@+id/android_button"
>     android:layout_width="48dip"
>     android:layout_height="48dip"
>     android:layout_toRightOf="@+id/centertext"
>     android:src="@drawable/playbutton"
>     android:background="#"
>         />
>
> 
>
> Any pointers on what am I doing wrong ?  Would you suggest keeping the
> relative view or dropping it ?
>
> How can I force my vertical LinearLayout (@+id/centertext) to leave
> space for my button ? I tried both 'wrap_content' and 'fill_parent'

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Setting background color on row layout prevents display of highlight on select

2010-06-16 Thread Stacy
Getting closer using android:drawSelectorOnTop on the list ...only
hiccup now is that the selector is also on top of the text!


On Jun 16, 3:18 pm, Connick  wrote:
> I'm setting background color based on a given state of an object in each row
> in a list. That part is working just fine but when I set the background
> color on the outermost layout the row no longer highlights when selected.
> Probably a specific attribute I'm not setting/changing?
>
> Thanks,
> Stace

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

2010-06-16 Thread Kumar Bibek
Use eclipse to pull out any file you want. Go to file explorer view
and there you can find all the files.

Thanks and Regards,
Kumar Bibek
http://tech-droid.blogspot.com

On Jun 14, 4:33 am, lloyd1949  wrote:
> What is the recommended approach?
> I am planning to create a file in the getExternalStorageDirectory()
> and then move that file to something external
>
> First I thought of emailing that file as an attachment. However I
> cannot seem to locate an Intent that allows me to generate the email.
> I suspect that one is not allowed to do that.
>
> Next I thought of offloading via the USB port to a laptop/desktop.
>
> Can anyone point me to examples of eitherf approach?
>
> 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 to make the tab view which like ASTRO Filemanager

2010-06-16 Thread Kumar Bibek
I suspect thats not a TabHost. It's a Gallery.

Thanks and Regards,
Kumar Bibek
http://tech-droid.blogspot.com

On Jun 12, 7:10 am, petitlen  wrote:
> hi,does any one use ASTRO?i feel the tab view in this software is very
> nice and i want to imitate it.
> i find that this tab view is like TabHost,but the tab can sroll from
> left to right.
> this tab view is based TabHost or based gallery+imagebutton?
>
> glad to see your reply

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


Re: [android-developers] blank screen with opengl

2010-06-16 Thread Leigh McRae
Could be anything.  Make sure you have a glGetError in your render loop 
someplace as it might indicate a problem.  Also check for EGL errors.  
Maybe your texture isn't being loaded correctly.  Try starting with 
clearing the screen to pink to be sure your rendering context is 
working.  Then move on to a colored triangle.


Leigh

On 6/16/2010 1:14 PM, Simone wrote:

I got this, to show a rectangle:

private float[] sCoords = {
 // X, Y, Z
  GameRenderer.W/3, GameRenderer.H/3, 0,
  GameRenderer.W/3,  20f, 0,
  30f,  20f, 0,
  30f, GameRenderer.H/3, 0
 };

...

gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFVertexBuffer);
 gl.glEnable(GL10.GL_TEXTURE_2D);
 gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTexBuffer);
 gl.glDrawElements(GL10.GL_TRIANGLE_FAN, VERTS,
GL10.GL_UNSIGNED_SHORT, mIndexBuffer);

and previously:

public void onSurfaceChanged(GL10 gl, int w, int h) {
   gl.glViewport (0, 0,  w, h);
   gl.glMatrixMode (GL10.GL_PROJECTION);
   gl.glLoadIdentity ();
   gl.glOrthox(0, w, 0, h, -1, 1);
   W=w;
   H=h;
   rect = new Rectangle();
}


I should see a rectangle, but I only see a white screen.
Any help?
Simone

   


--
Leigh McRae
www.lonedwarfgames.com

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


[android-developers] Re: How to check the network status for both wifi and 3g mobiles

2010-06-16 Thread Kumar Bibek
Check the ConnectivityManager API.

http://tech-droid.blogspot.com/2010/06/checking-network-availability.html

Thanks and Regards,
Kumar Bibek
http://tech-droid.blogspot.com

On Jun 15, 11:23 am, Imran ahmed  wrote:
> Android developers can check this code to check the network status on
> wifi and 3g mobile
>
> You need the following permission to get status view source print?
> 1        permission>
> 2        android:name="android.permission.ACCESS_NETWORK_STATE"> permission>
>
> Regards,
> Imranwww.androidpeople.com
> Android Community Blog

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

2010-06-16 Thread Kumar Bibek
Well, The cloud-to-device messaging feature that was announced with
Froyo will help you in this.Check out the vidoes at Google I/O 2010

Thanks and Regards,
Kumar Bibek
http://tech-droid.blogspot.com

On Jun 13, 9:44 pm, EricM3  wrote:
> Hello everyone,
>
> I would like to create a website that has a button, and whenever the
> button is pushed, an application or service on my phone will begin.
>
> Could someone please push me in the right direction for where I should
> look to accomplish this?
>
> 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: Setting background color on row layout prevents display of highlight on select

2010-06-16 Thread Kumar Bibek
You are actually overriding the default behaviour. So, you should also
handle the other states besides the default state.
Look at StateDrawables in the Android docs.

Thanks and Regards,
Kumar Bibek

On Jun 17, 12:23 am, Stacy  wrote:
> Getting closer using android:drawSelectorOnTop on the list ...only
> hiccup now is that the selector is also on top of the text!
>
> On Jun 16, 3:18 pm, Connick  wrote:
>
> > I'm setting background color based on a given state of an object in each row
> > in a list. That part is working just fine but when I set the background
> > color on the outermost layout the row no longer highlights when selected.
> > Probably a specific attribute I'm not setting/changing?
>
> > Thanks,
> > Stace

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

2010-06-16 Thread Simone
Hi, I solved the first problem by using gl.glOrthof(0, w, 0, h, -1,
1); instead of gl.glOrthox(0, w, 0, h, -1, 1);
Now it shows a black rectangle, so no textures. I think it could be
because the texture is too large, right?
Simone

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


[android-developers] Re: bug with notifyDataSetChanged() in ArrayAdapter ?

2010-06-16 Thread Kumar Bibek
You have to override the getCount method. Please go through the
examples to check how the Adapters work.

Thanks and Regards,
Kumar Bibek
http://tech-droid.blogspot.com

On Jun 16, 6:07 pm, Christophe 
wrote:
> hello everyone,
>
> I have a strange problem with one of my ListActivity. I have overrided
> the default ArrayAdapter in order to customize my list. I have then
> filled the adapter with an ArrayList.
>
> If I insert an element on the list and then call
> notifyDataSetChanged() on the adapter everything works fine.
>
> But if I insert an element at the END of the list and then call
> notifyDataSetChanged(), the new element doesn't  appear ...
>
> And finally if I override getCount() on my adapter like this :
>
> @Override
> public int getCount() {
>         return myArrayList.size();
>
> }
>
> then everything works fine.
> Is this a bug or am I doing something wrong ?

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


[android-developers] Repackaging Android System Classes in an application

2010-06-16 Thread Greg Giacovelli
Hi,
So I came across this today and was wondering does this work in
production app or does it merely work because my phone allows non
market apks.

Here is an example,
Take a class like, android.view.IWindow, and copy it's source into
your project and recompile it after changing a few things. (Don't
rename or repackage it).

Now when your APK loads in the VM, something odd happens.

06-15 23:30:32.148: DEBUG/installd(555): DexInv: --- BEGIN '/data/app/
vmdl22987.tmp' ---
06-15 23:30:32.818: DEBUG/dalvikvm(1062): DexOpt: 'Landroid/view/
IWindow;' has an earlier definition; blocking out
06-15 23:30:32.818: DEBUG/dalvikvm(1062): DexOpt: 'Landroid/view/
IWindowSession;' has an earlier definition; blocking out
06-15 23:30:33.218: DEBUG/dalvikvm(1062): DexOpt: not verifying
'Landroid/view/IWindow;': multiple definitions
06-15 23:30:33.218: DEBUG/dalvikvm(1062): DexOpt: not verifying
'Landroid/view/IWindowSession;': multiple definitions



So the logging is a little ambiguous, but is it saying that the
classes in this APK are blocking out previous versions and that these
new classes aren't being verified. If so I hope this is only
succeeding because as developers most targets are in development mode
when allowing non market apks (non rooted phones). However does this
work in market released apps as well? This seems like a really nasty
security exploit if I can override system interfaces just for my
application.

-Greg

-Greg

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


Re: [android-developers] Still trying to get my head around permissions - can anybody help?

2010-06-16 Thread Richard C. Cox
Hi Mark,

Thanks for the response.

Yeah, goToSleep may be restricted in the API, but it says nothing about that 
in the SDK Documentation.  I based my assumptions about it being a permission 
issue on a comment I saw over at the Stack Overflow forums.  Somebody mentioned 
that they got a security exception when they tried to call one of the Power 
Manager functions and the response was...it's a level 2 permission, which 
effectively makes it off limits to user programs.

So, I'm not sure.  I guess I was wondering if there was any documentation 
available to definitively states what API object methods an ordinary 3rd party 
application can and can't use.  

Oh, and the app I was writing was a bit of both.  Learning the API and trying 
some practical code bits to see what my app can and can't do.  

Regards,

Richard

> Richard,
> 
> On Jun 15, 2010, at 11:11 AM, Richard C. Cox wrote:
> > I've sent the message numerous times, but I assume it's being moderated
> > from some reason.  I'll try again:
> > 
> > I'm not sure if I completely grasp the Android permissions model.  I
> > recently started working on a simple widget to put the phone to sleep. 
> > Of course, it always gets a security exception because an ordinary user
> > app isn't allowed to call the PowerManager method 'goToSleep' because
> > it's requires the 'signature' level permission DEVICE_POWER.  But I
> > could find nowhere in the docs or on Google that officially says that.
> > 
> > Is there some document that lists the permission levels of android
> > platform defined permissions?
> > 
> > Or, am I looking at permissions completely wrong?
> 
> I'm brand new to Android development myself, so I could be completely wrong
> here. I suspect that it isn't a permissions issue as much as it is a
> restrict API issue. As you state above, ordinary applications aren't
> allowed to call the goToSleep().
> 
> What I think you want is the list of restricted API calls, or rather a list
> of the "internal to Google" content providers. By examining the source
> code you could discover these and perhaps utilize them, but at your own
> peril.
> 
> Was a widget to put the phone to sleep a learning exercise or part of an
> application you wanted to develop? Mark

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


Re: [android-developers] Still trying to get my head around permissions - can anybody help?

2010-06-16 Thread Al
Richard C. Cox wrote:
> Yeah, goToSleep may be restricted in the API, but it says nothing about that
> in the SDK Documentation.

Non-public APIs aren't mentioned in the sdk documentation. They may be
documented in the source code but suppressed from javadoc with @hide.

> So, I'm not sure.  I guess I was wondering if there was any documentation
> available to definitively states what API object methods an ordinary 3rd party
> application can and can't use.

http://developer.android.com/reference/

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


Re: [android-developers] Still trying to get my head around permissions - can anybody help?

2010-06-16 Thread Mark Murphy
On Wed, Jun 16, 2010 at 4:39 PM, Al  wrote:
> Richard C. Cox wrote:
>> Yeah, goToSleep may be restricted in the API, but it says nothing about that
>> in the SDK Documentation.
>
> Non-public APIs aren't mentioned in the sdk documentation. They may be
> documented in the source code but suppressed from javadoc with @hide.

Actually, goToSleep() is public, just only accessible for applications
that hold the DEVICE_POWER permission. The need for that permission is
not documented there, which is simply a documentation bug.

-- 
Mark Murphy
CommonsWare
mmur...@commonsware.com
http://commonsware.com

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


Re: [android-developers] Still trying to get my head around permissions - can anybody help?

2010-06-16 Thread Richard C. Cox
Thanks Al,

Yes, I can see that's Power Manager is part of the public API.  So, it's a 
permissions problem.

Thanks for pointing me to that.

On Wednesday 16 June 2010 16:39:44 Al wrote:
> Richard C. Cox wrote:
> > Yeah, goToSleep may be restricted in the API, but it says nothing about
> > that in the SDK Documentation.
> 
> Non-public APIs aren't mentioned in the sdk documentation. They may be
> documented in the source code but suppressed from javadoc with @hide.
> 
> > So, I'm not sure.  I guess I was wondering if there was any documentation
> > available to definitively states what API object methods an ordinary 3rd
> > party application can and can't use.
> 
> http://developer.android.com/reference/

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


Re: [android-developers] Unable To run Service

2010-06-16 Thread tarek attia
The problem was this in the AndroidManifest.xml :SS

I was registering the service as following



and there was no problem in the compilation,,,I changed it to a lower-case
letter not upper-case letter it worked fine



On Tue, Jun 15, 2010 at 10:35 PM, Mark Murphy wrote:

> On Tue, Jun 15, 2010 at 2:10 PM, tarek attia 
> wrote:
> > The Same Error 
> > What could cause this?
>
> I would recommend starting with an example that is known to work, then
> determining where the differences are.
>
> Here is an example of a local service:
>
> http://github.com/commonsguy/cw-android/tree/master/Service/WeatherPlus/
>
> --
> Mark Murphy
> CommonsWare
> mmur...@commonsware.com
> http://commonsware.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
>



-- 
tarek

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

Re: [android-developers] Still trying to get my head around permissions - can anybody help?

2010-06-16 Thread Richard C. Cox
Thanks Mark,

  Yes, it is public.  I did give the DEVICE_POWER permission to my app, but 
still get the security exception when I call the goToSleep function.  Somebody 
said it was a level 2 (signature) permission, so ordinary 3rd party apps (ones 
that don't hold the same signature as the API) can't use it.  I assumed that 
was correct, since that's the only explaination I could come up with as to why 
I get the security exception when my simple test app calls that function.  
This is all in the emulator, BTW.

  What I was really looking for was some documentation about which permissions 
are at what level.

Best Regards,

Richard

On Wednesday 16 June 2010 16:52:21 Mark Murphy wrote:
> On Wed, Jun 16, 2010 at 4:39 PM, Al  wrote:
> > Richard C. Cox wrote:
> >> Yeah, goToSleep may be restricted in the API, but it says nothing about
> >> that in the SDK Documentation.
> > 
> > Non-public APIs aren't mentioned in the sdk documentation. They may be
> > documented in the source code but suppressed from javadoc with @hide.
> 
> Actually, goToSleep() is public, just only accessible for applications
> that hold the DEVICE_POWER permission. The need for that permission is
> not documented there, which is simply a documentation bug.

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


Re: [android-developers] Still trying to get my head around permissions - can anybody help?

2010-06-16 Thread Mark Murphy
On Wed, Jun 16, 2010 at 5:07 PM, Richard C. Cox  wrote:
>  What I was really looking for was some documentation about which permissions
> are at what level.

Sorry, there is no well-organized documentation on that specific topic.

-- 
Mark Murphy
CommonsWare
mmur...@commonsware.com
http://commonsware.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] share images with twitter app and buzz app

2010-06-16 Thread jdeslip
So, I added the following intent to my app to share images captured.

Intent i=new
Intent(android.content.Intent.ACTION_SEND);
 
i.setDataAndType(Uri.parse(sharedfilename),"image/jpeg");
i.putExtra(Intent.EXTRA_SUBJECT, "Check out
this picture from SquirrelCam");
i.putExtra(Intent.EXTRA_TEXT,"Taken with
SquirrelCam for Android");
i.putExtra(Intent.EXTRA_STREAM,
Uri.parse(sharedfilename));
startActivity(Intent.createChooser(i, "Share
Image"));

It works as expected when using the intent to launch gmail/picassa/
picsay/messenger but the image does not seem to attach it self when I
choose the Buzz of Twitter app from the share menu that pops up.  I.e.
those two apps launch just with the text and not the image attached.

Any idea what I am missing to have this intent launch buzz/twitter
with the image attached?

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


[android-developers] appWidgetId not valid

2010-06-16 Thread sergi...@gmail.com
Hi,

I'm developing a widget with a configuration activity. This activity
is launched correctly where the widget is installed (at first time),
but not the other times when I click on the widget at home screen.

I have debugged the code and I see that the appWidgetId is not valid
(0 value).

The code in the configuration activity which is needed to do this (in
theory) and I write in it:

Intent resultValue = new Intent();

resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
appWidgetId);
setResult(RESULT_OK, resultValue);
finish();

And in my widget class (AppWidgetProvider extends):

Intent settingsIntent = new Intent(context,
SettingsActivity.class);
settingsIntent

.setAction(android.appwidget.AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
PendingIntent settingsPendingIntent = PendingIntent.getActivity(
context, 0, settingsIntent, 0);

RemoteViews remoteViews = new 
RemoteViews(context.getPackageName(),
R.layout.widget);
remoteViews.setTextViewText(R.id.eur_value, data.getValue());

remoteViews.setTextViewText(R.id.value, value);
remoteViews.setOnClickPendingIntent(R.id.widget,
settingsPendingIntent);

ComponentName thisWidget = new ComponentName(context,
MyWidget.class);
appWidgetManager.updateAppWidget(thisWidget, remoteViews);

Somebody have any idea?

Thanks for all

See you,
SBC
http://desbc.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: Even with Min SDK version, building app against 2.2 breaks 1.5?

2010-06-16 Thread blab
Dianne,

Is there a way to prevent aapt v2.2 from "automatically including the
appropriate minimum version for new configurations, so that older
platforms do not see them"?

Due to this sneaky aapt behavior we simply cannot use 2.2 SDK as we
either will loose 1.5 support or increase our APK size by 40%.

All image resources in our game are placed in "drawable-hdpi" folder.
Such structure gives us the minimum APK size with the highest quality
of images.
This worked very well until 2.2. SDK. Although Android 1.5 does not
"know" about "hdpi" postfix it nevertheless magically knows that it
needs to scale the images down by factor of 1.5 (from hdpi to mdpi).

If there is no way to prevent aapt v2.2 from messing around with
resources can you please suggest any workaround?

-Kiryl.





On Jun 9, 3:57 pm, Dianne Hackborn  wrote:
> On Mon, May 24, 2010 at 12:52 PM, Mark Murphy wrote:
>
> > Xavier Ducrohet wrote:
> > > The short of it: 1.5 does not know about -mdpi -hpdi, so it'll take
> > > the first one it finds which could be the wrong one (which means it'll
> > > get scaled).
> > FWIW, the solution given in that presentation was to have both -mdpi and
> > -mdpi-v3, with duplicate resources. -mdpi-v3 would be picked up by
> > Android 1.5; -mdpi would be picked up by newer versions of Android that
> > are legitimately running mdpi displays.
>
> Um, no, you should use -hdpi-v4 so that v3 of the platform does not see the
> hdpi resource (which it does not understand) as a possibility.
>
> Also as of 2.2 aapt will automatically include the appropriate minimum
> version for new configurations, so that older platforms do not see them.
>  Though I notice that it uses -v4 for a resource that has ANY density
> specified, so if you don't have default resources for images you may break
> on 1.5.  That is, you'd want drawable/, drawable-hdpi/, etc; and aapt will
> turn this in to drawable/ and drawable-hdpi-v4/ for you.  If you have
> drawable-mdpi/ and drawable-hdpi/ you will end up with drawable-mdpi-v4/ and
> drawable-hdpi-v4, neither of which v3 (1.5) can accept.
>
> I should probably leave -mdpi as not having a version config...  I think 1.5
> can still handle those, though I'll have to check.
>
> (Note aapt also adds -v4 for -normal, -large, -small, -long, and -notlong;
> and -v8 for -car, -desk, -night, and -notnight.)
>
> --
> 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: Orientation and Webview

2010-06-16 Thread nikhil
Can you give me some pointers on how to change the images according to
the orientation?

My problem is I have webview and imageview on same layout, I wish to
stop webview from reloading and adjust the imageview with landscape
and portrait images.

I am not able to achieve this both.

On Jun 16, 12:27 pm, "Maps.Huge.Info (Maps API Guru)"
 wrote:
> If you change the default behavior of your app with the configChanges,
> then you just have to handle the loading of a different resource
> yourself. Also, don't forget to handle the keyboard as well.
>
> -John Coryat

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


Re: [android-developers] Re: blank screen with opengl

2010-06-16 Thread Max Gilead
I'd suggest going with some basic tutorial like
http://insanitydesign.com/wp/projects/nehe-android-ports/ and building on
what you learn, modifying code little step by step so you're always a couple
of Ctrl-Zs from a working version.
Max

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

2010-06-16 Thread Nik Bhattacharya
I *think* I might have stumbled upon it.

http://developer.android.com/reference/android/content/Intent.html#ACTION_USER_PRESENT

Not very obvious since I was looking for something related to keyguard
or lock, but the API doc does say the following:
Broadcast Action: Sent when the user is present after device wakes up
(e.g when the keyguard is gone).

Anxious to use this : )

On May 24, 12:28 pm, TreKing  wrote:
> On Sat, May 22, 2010 at 8:27 AM, Nik Bhattacharya <
>
> nik.bhattacha...@frogdesign.com> wrote:
> > I would like to know if there is some sort of system broadcast just like
> > the Boot Complete broadcast.
>
> Did you look through the docs? I would assume it would be in there, if it
> exists. If not, then it probably doesn't.
> Don't know what else to tell you.
>
> --- 
> --
> TreKing - Chicago transit tracking app for Android-powered 
> deviceshttp://sites.google.com/site/rezmobileapps/treking
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: ListView

2010-06-16 Thread Sandy
I was able to successfully add HorizontalScrollView to the ListView's
item without having to do any custom changes. I did not fully test all
the functionality but haven't seen any obvious issues so far.

In some of the previous forums it was mentioned that this is not
possible, what are the issues you are having when using the
HorizontalScrollView within a ListView ? Just want to make sure so
that I understand better if I'm missing something that will break and
haven't noticed yet.

I defined my list item to be something like this:

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





   















Thanks,
Sandy

On Jun 10, 2:29 pm, Sandy  wrote:
> I was thinking more along these lines i.e. have  a bunch of buttons
> that are added to the list item and then move these items on a gesture
> by repainting the list item couple of times but I dont know if this
> will work.
>
> 1. Have a  custom list item component which has linear layout of
> buttons.
> 2. Listen to horizontal gesture events in aListVIew
> 3. Animate the list view programmatically to move the buttons on a
> horizontal gesture
>
> If you have ideas for how to make this work without using a secondlistviewor 
> horizontalscrollview , please suggest.
>
> Thanks,
> Sandy
>
> On Jun 10, 6:06 am, Mark Murphy  wrote:
>
>
>
> > Sandy wrote:
> > > Actually the link I was referring to was horizontalscrollview within a
> > > scrollview (NOT alistviewlike i mentioned below). Here it is:
>
> > >http://stackoverflow.com/questions/2646028/android-horizontalscrollvi...
>
> > > This will not work for me because the functionality I desire to have
> > > is a verticalListViewwith 100 list items and the selected item will
> > > have few buttons (around 10) which can be scrolled horizontally.
>
> > I will be stunned if a HorizontalScrollView will work in aListViewrow.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > _The Busy Coder's Guide to Android Development_ Version 3.1
> > Available!- 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] ProgressBar.setProgressDrawable bug

2010-06-16 Thread ls02
Apparently ProgressBar.setProgressDrawable has bug, if called to set
new drawable, progress bar disappears completely. Is there any other
way to change progress bar color dynamically at run time?

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

2010-06-16 Thread nikhil
ok I have solved my issue

I kept theandroid:configChanges="orientation"   setting so
as to prevent webview from reloading.

While for the image view

public void  onConfigurationChanged(Configuration  newConfig)
{
super.onConfigurationChanged(newConfig);

if(newConfig.orientation==1) //portrait
{
ImageView iv = 
(ImageView)findViewById(R.id.ImageView01);
iv.setImageResource(R.drawable.xyz);
}
else //landscape
{
ImageView iv = 
(ImageView)findViewById(R.id.ImageView01);
iv.setImageResource(R.drawable.xyzlandscape);
}
}


On Jun 16, 4:32 pm, nikhil  wrote:
> Can you give me some pointers on how to change the images according to
> the orientation?
>
> My problem is I have webview and imageview on same layout, I wish to
> stop webview from reloading and adjust the imageview with landscape
> and portrait images.
>
> I am not able to achieve this both.
>
> On Jun 16, 12:27 pm, "Maps.Huge.Info (Maps API Guru)"
>
>  wrote:
> > If you change the default behavior of your app with the configChanges,
> > then you just have to handle the loading of a different resource
> > yourself. Also, don't forget to handle the keyboard as well.
>
> > -John Coryat

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


[android-developers] Target Java module does not define any source or resource files.

2010-06-16 Thread Jimmy
Hello everyone,

I am building SDK under windows, as instructed, I run the script at ./
development/build/tools/make_windows_sdk.sh.

This gives me much troubles, each time I built, the error message
showed up
"Target Java module does not define any source or resource files.".
Does anyone have an idea why this is happening and how to eliminate
it?

Thanks
Jimmy

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

2010-06-16 Thread Josh F.
OK, this is interesting.  I now have a series of users who are
reporting a work around / temporary fix for the issue.

A few of our users are reporting that if they power off their phones
and eject the battery, wait a few minutes, and turn it back on again -
the problem clears up (at least for a little while).  This seems to me
to be a problem with the phone - but who knows.  No root cause
identified yet.

None of the users have rooted phones or custom ROM images.

Side note: We have decided to find a new way to do things and drop
this DeviceID stuff all together.  It is a pity that Android does not
seem to have any reliable UUID per device.

-- Josh

On Jun 15, 2:45 pm, Wayne Wenthin  wrote:
> I have also seen spaces in the various id strings.   This happens when
> someone roots and uses a specific rom that changes everything up.
>
>
>
>
>
> On Tue, Jun 15, 2010 at 1:17 PM, Dan Sherman  wrote:
> > We've been having issues with some users upgrading their firmware, and
> > having a different device ID after upgrading (which just started within the
> > month, hasn't happened previously over the last year or so).  But we haven't
> > heard any complaints from Incredible users...
>
> > On Tue, Jun 15, 2010 at 4:13 PM, Maps.Huge.Info (Maps API Guru) <
> > cor...@gmail.com> wrote:
>
> >> What exactly do you mean by Device ID?
>
> >> -John Coryat
>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Android Developers" group.
> >> To post to this group, send email to android-developers@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> android-developers+unsubscr...@googlegroups.com >>  cr...@googlegroups.com>
> >> For more options, visit this group at
> >>http://groups.google.com/group/android-developers?hl=en
>
> >  --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Follow us on Twitter �...@fuliginsoftware
> Join the forums.http://www.fuligin.com/forums

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


Re: [android-developers] Re: ListView

2010-06-16 Thread Mark Murphy
On Wed, Jun 16, 2010 at 6:14 PM, Sandy  wrote:
> In some of the previous forums it was mentioned that this is not
> possible, what are the issues you are having when using the
> HorizontalScrollView within a ListView ?

I wasn't expecting it to work, just because scrollable things inside
scrollable things have had issues on Android. Historically, that was
all in the vertical direction (e.g., ListView inside of a ScrollView).
I thought it might hold for situations where the two scrolling
operations were perpendicular as well, and apparently I was mistaken.

Thanks for letting us know!

-- 
Mark Murphy
CommonsWare
mmur...@commonsware.com
http://commonsware.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: application's persistent not work

2010-06-16 Thread James Wang
Hi Dianne,
Would you shed some light on this topic?
Thanks.

James

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

2010-06-16 Thread Robert Macaulay
I recently converted my long lived service(setForeground) app to one
triggered by the AlarmManager.
The nature of the work is I want to be woken up on intervals, but do not
want to wake up the phone if it's not awake. And I don't want the duplicate
alarms that you'd get with setRepeating. So according to the docs, the best
way was to reschedule yourself each time with set. The call I'm making is
this

PendingIntent pi=PendingIntent.getBroadcast(this, 0, i,
PendingIntent.FLAG_CANCEL_CURRENT);
mgr.set(AlarmManager.ELAPSED_REALTIME,
SystemClock.elapsedRealtime()+msTillNext,pi);

I'm using CANCEL_CURRENT because I am encoding setExtra data in the intent
that is different for each call. Its waking an IntentService(specifically
Mark's WakefulIntentService)
This works, I see my app run over and over. I see my app being killed, and
respawned via alarmReceiver. This all works great, but it randomly ceases.
No exceptions in the log. I luckily have the log showing the last running of
the service. The service runs, exits cleanly, and never runs again. I
originally thought it could be that my msTillNext was negative, but the docs
say that if the time is in the past, it will run immediately.

It is a moto droid, running 2.1. Any suggestions? I'm about to write an
alarm watchdog alarm to reschedule. or use setRepeating and store something
in the DB to notice the dupes.

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

Re: [android-developers] AlarmManager ceasing to function. Dropping single shot alarms.

2010-06-16 Thread Mark Murphy
On Wed, Jun 16, 2010 at 9:23 PM, Robert Macaulay
 wrote:
> This works, I see my app run over and over. I see my app being killed, and
> respawned via alarmReceiver. This all works great, but it randomly ceases.
> No exceptions in the log. I luckily have the log showing the last running of
> the service. The service runs, exits cleanly, and never runs again. I
> originally thought it could be that my msTillNext was negative, but the docs
> say that if the time is in the past, it will run immediately.

You may want to test that anyway. For example, make sure that
msTillNext is at least, say, 10, rather than smaller or negative. It
wouldn't be the first time that the docs were wrong, and it shouldn't
have any material impact on your actual app functionality.

> It is a moto droid, running 2.1. Any suggestions? I'm about to write an
> alarm watchdog alarm to reschedule. or use setRepeating and store something
> in the DB to notice the dupes.

You could try adb shell dumpsys. Redirect the output to a file, then
look for the line starting with:

DUMP OF SERVICE alarm:

You may see signs of your alarms in there. See if you can determine
any patterns of what the dump looks like when the next alarm will
succeed versus when it will fail.

-- 
Mark Murphy
CommonsWare
mmur...@commonsware.com
http://commonsware.com

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


Re: [android-developers] Re: application's persistent not work

2010-06-16 Thread Dianne Hackborn
Only apps built into the system image can be persistent.

On Wed, Jun 16, 2010 at 5:19 PM, James Wang  wrote:

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



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

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

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

[android-developers] Re: Strange behaviour with mediaplayer and seekTo (on start-up)

2010-06-16 Thread Mathias Lin
Furthermore, the problem described below also occurs when using a
VideoView instead of a surface + mediaplayer. Below is the code for
this example.
(I am also wondering, why does VideoView not provide a
setOnSeekCompletionListener like the MediaPlayer? I assume that seekTo
is asynchronous here as well, not?)

public class VideoTest extends Activity {

VideoView vidView;

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

vidView = (VideoView) findViewById(R.id.vidView);
vidView.setVideoPath("/sdcard/myapp/main/videos/main.mp4");

vidView.seekTo(16000);
vidView.start();
}

}

On Jun 16, 12:53 pm, Mathias Lin  wrote:
> I'm implementing a custom video player because I need custom video
> controls. I have an app with only one activity, which on start-up
> shall starts playing a video right away.
>
> Now, the problem I have (on my Nexus One):
>
> I don't want the video to start from the beginning, but from a later
> position. Therefore I do a seekTo(16867). Since seekTo is
> asynchronous, I place the start call of the mediaplayer
> (player.start()) in the onSeekComplete of the onSeekCompleteListener.
>
> **The strange behaviour I experience though is that I can see/hear the
> video playing from the beginning for a few millisecs before it
> actually plays from/jumps to the position I seeked to.
> But - on the other hand - the Log output I call before the
> player.start returns the correct position 16867, where I seeked to.**
>
> Below is the relevant code section, the complete class is 
> athttp://pastebin.com/jqAAFsuX
>
>     private void playVideo(String url) {
>         try {
>             btnVideoPause.setEnabled(false);
>             if (player==null) {
>                 player=new MediaPlayer();
>                 player.setScreenOnWhilePlaying(true);
>             }
>             else {
>                 player.stop();
>                 player.reset();
>             }
>             url = "/sdcard/myapp/main/videos/main.mp4";  // <--- just
> for test purposes hardcoded here now
>             player.setDataSource(url);
>             player.setDisplay(holder);
>             player.setAudioStreamType(AudioManager.STREAM_MUSIC);
>             player.setOnCompletionListener(this);
>             player.setOnPreparedListener(this);
>
>             player.setOnSeekCompleteListener(new
> MediaPlayer.OnSeekCompleteListener() {
>                 public void onSeekComplete(MediaPlayer mediaPlayer) {
>                         Log.d("APP", "current pos... "+
> player.getCurrentPosition() );
>                         player.start();          //
> <-- start playback on seek completed
>                         player.setOnSeekCompleteListener(null);
>                     }
>             });
>             player.prepareAsync();
>         }
>         catch (Throwable t) {
>             Log.e(TAG, "Exception in playVideo prep", t);
>         }
>     }
>
>     public void onPrepared(MediaPlayer mediaplayer) {
>         width=player.getVideoWidth();
>         height=player.getVideoHeight();
>         if (width!=0 && height!=0) {
>             holder.setFixedSize(width, height);
>             progressBar.setProgress(0);
>             progressBar.setMax(player.getDuration());
>             player.seekTo(16867);     // <-- seeking
> to position
>         }
>         btnVideoPause.setEnabled(true);
>     }

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


[android-developers] Re: Even with Min SDK version, building app against 2.2 breaks 1.5?

2010-06-16 Thread Dianne Hackborn
On Wed, Jun 16, 2010 at 2:31 PM, blab  wrote:

> Is there a way to prevent aapt v2.2 from "automatically including the
> appropriate minimum version for new configurations, so that older
> platforms do not see them"?
>

Explicitly supply your own version.


> Due to this sneaky aapt behavior we simply cannot use 2.2 SDK as we
> either will loose 1.5 support or increase our APK size by 40%.
>

This isn't true.  Older platforms will not see the resources that were added
for newer platforms.  Just make sure there is a default resource value for
all of your resources.


> All image resources in our game are placed in "drawable-hdpi" folder.
> Such structure gives us the minimum APK size with the highest quality
> of images.
>

This also causes devices with lower density screens to have to scale all of
your images, which can significantly impact performance.  I strongly
recommend against this.  And Android 1.5 does NOT support this scaling.


> This worked very well until 2.2. SDK. Although Android 1.5 does not
> "know" about "hdpi" postfix it nevertheless magically knows that it
> needs to scale the images down by factor of 1.5 (from hdpi to mdpi).
>

You got lucky.  Android 1.5 was never documented to support different
densities, and I can guarantee you that there are serious bugs in what it
might do with 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

Re: [android-developers] Repackaging Android System Classes in an application

2010-06-16 Thread Dianne Hackborn
Don't do this.  This is not a security issue at all; it just makes an app
that will likely break itself.

On Wed, Jun 16, 2010 at 12:47 PM, Greg Giacovelli wrote:

> Hi,
> So I came across this today and was wondering does this work in
> production app or does it merely work because my phone allows non
> market apks.
>
> Here is an example,
> Take a class like, android.view.IWindow, and copy it's source into
> your project and recompile it after changing a few things. (Don't
> rename or repackage it).
>
> Now when your APK loads in the VM, something odd happens.
>
> 06-15 23:30:32.148: DEBUG/installd(555): DexInv: --- BEGIN '/data/app/
> vmdl22987.tmp' ---
> 06-15 23:30:32.818: DEBUG/dalvikvm(1062): DexOpt: 'Landroid/view/
> IWindow;' has an earlier definition; blocking out
> 06-15 23:30:32.818: DEBUG/dalvikvm(1062): DexOpt: 'Landroid/view/
> IWindowSession;' has an earlier definition; blocking out
> 06-15 23:30:33.218: DEBUG/dalvikvm(1062): DexOpt: not verifying
> 'Landroid/view/IWindow;': multiple definitions
> 06-15 23:30:33.218: DEBUG/dalvikvm(1062): DexOpt: not verifying
> 'Landroid/view/IWindowSession;': multiple definitions
>
>
>
> So the logging is a little ambiguous, but is it saying that the
> classes in this APK are blocking out previous versions and that these
> new classes aren't being verified. If so I hope this is only
> succeeding because as developers most targets are in development mode
> when allowing non market apks (non rooted phones). However does this
> work in market released apps as well? This seems like a really nasty
> security exploit if I can override system interfaces just for my
> application.
>
> -Greg
>
> -Greg
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



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

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

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

Re: [android-developers] AlarmManager ceasing to function. Dropping single shot alarms.

2010-06-16 Thread Robert Macaulay
On Wed, Jun 16, 2010 at 8:43 PM, Mark Murphy wrote:

> On Wed, Jun 16, 2010 at 9:23 PM, Robert Macaulay
>  wrote:
> > This works, I see my app run over and over. I see my app being killed,
> and
> > respawned via alarmReceiver. This all works great, but it randomly
> ceases.
> > No exceptions in the log. I luckily have the log showing the last running
> of
> > the service. The service runs, exits cleanly, and never runs again. I
> > originally thought it could be that my msTillNext was negative, but the
> docs
> > say that if the time is in the past, it will run immediately.
>
> You may want to test that anyway. For example, make sure that
> msTillNext is at least, say, 10, rather than smaller or negative. It
> wouldn't be the first time that the docs were wrong, and it shouldn't
> have any material impact on your actual app functionality.


I'll add that check. The only reason I didn't was the javadoc. It does seem
to happen when the phone is sleeping, and my code is woken up early. I'd
LOVE an alarm based on SystemClock.uptimeMillis(). It would make my logic
port from a Thread.sleep() easy.

>
> You could try adb shell dumpsys. Redirect the output to a file, then
> look for the line starting with:
>
> DUMP OF SERVICE alarm:
>
> You may see signs of your alarms in there. See if you can determine
> any patterns of what the dump looks like when the next alarm will
> succeed versus when it will fail.



What does the numbers in Alarm stats mean here? I'm assuming its the alarm
count totals, but not sure on the time or the flg parts.

>From a failed state.
Nothing under "  Elapsed realtime wakeup"
  Alarm Stats:
  51759ms running, 0 wakeups
142 alarms: flg=0x4

--
restarted the alarms,  working state
under "  Elapsed realtime wakeup"
  ELAPSED #1: Alarm{454d4188 type 3 com.zomut.watchdoglite}
type=3 when=156397679 repeatInterval=0 count=0
operation=PendingIntent{454d4178: PendingIntentRecord{454d4100
com.zomut.watchdoglite broadcastIntent}}

Alarm Stats:
  com.zomut.watchdoglite
51813ms running, 0 wakeups
144 alarms: flg=0x4

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

[android-developers] Re: Android finishActivity()

2010-06-16 Thread mike

hi UD,

thanks for your explanation. but this solution will not work for Blur
Screen. i have tried it out before.

if you starts Activity C (Blur Activity) like

Intent i = new Intent(ActivityB.this,
ActivityC.class);
startActivityForResult(i, 1001);

then the Activity C will not appear as blur.

have you tried this before. or i'll send you a simple sample

regards,
Mike

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