[android-developers] Uses cases and code example for SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN and SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION?

2013-01-16 Thread Agus
Hi everyone,

I urgently need an answer for the usage of these new systemuivisibility
flags in JB:
   SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN and
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION.

Setting SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN apparently does not do anything,
and
setting SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION flushes the content to top
behind status bar and flushes the content to bottom behind softkeybar, I
expect that
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION only flushes the content to the
bottom not to the top.

-Agus.

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

[android-developers] SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION broken?

2013-01-15 Thread Agus
Hi all,

When I only set this flag SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, the top
content inset is flushed to the top edge of the screen and the bottom
content inset is flushed to the bottom edge of the screen.
Reading based on the official documentation, I expect that only the bottom
content inset is flushed to the bottom edge of the screen.

Is this a bug or expected ?

-Agus.

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

[android-developers] SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN broken?

2013-01-15 Thread Agus
Hi all,

When I only set this flag SYSTEM_UI_FLAG LAYOUT_FULLSCREEN, I do not see
any visible changes but when I additionaly set the flag
SYSTEM_UI_FLAG_FULLSCREEN and then clear the
SYSTEM_UI_FLAG_FULLSCREEN flag back, the visual effect of this flag
SYSTEM_UI_FLAG LAYOUT_FULLSCREEN persists.

Is this an expected behavior ?

-Agus

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

[android-developers] onLayout is getting called multiple times during orientation

2012-07-22 Thread Agus
Hi all,

I am getting onLayout called twice during orientation with different
dimension values, is this an expected behavior ?

-Agus.

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

2012-07-21 Thread Agus
You missed something which is that :

"use cases" are different than "how to use".

On Sat, Jul 21, 2012 at 8:02 PM, Jim Graham  wrote:

> On Sat, Jul 21, 2012 at 09:57:34AM -0700, Dianne Hackborn wrote:
> > Not sure what you are answering...?  That is not a use case, that is just
> > retrieving the values.  Which, again, I recommend not using for anything.
>
> I'm not sure I understand  Are you saying that display.getWidth and
> display.getHeight don't return valid numbers?  Or did I miss something?
>
> And if that's the case, why even have them in the developers guide?
>
> Thanks,
>--jim
>
> --
> THE SCORE:  ME:  2  CANCER:  0
> 73 DE N5IAL (/4)MiSTie #49997  < Running Mac OS X Lion >
> spooky1...@gmail.com ICBM/Hurricane: 30.44406N 86.59909W
>
>   "'Wrong' is one of those concepts that depends on witnesses."
>  --Catbert:  Evil Director of Human Resources (Dilbert, 05Nov09)
>
> Android Apps Listing at http://www.jstrack.org/barcodes.html
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Usage of DisplayMetrics

2012-07-19 Thread Agus
What are the uses cases in which width and height values of DisplayMetrics
used ?

Is it just for games ?

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

[android-developers] Can you send parcelable across processes without aidl ?

2012-07-09 Thread Agus
Can you send parcelable across processes without aidl ?

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

2012-05-16 Thread Agus
Hi all,

How many times do onMeasure method get called?
Is there a "lifecycle" for this method?

-Agus.

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

[android-developers] Calling setSystemUiVisibility will cause another call to onMeasure on all views?

2012-05-16 Thread Agus
Hi all,

Calling setSystemUiVisibility will cause another invocation of onMeasure to
all views?
If that's the case, how do i prevent that?

-Agus.

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

[android-developers] MessageQueue thread safe?

2012-05-11 Thread Agus
Are MessageQueue operations thread safe?

-regards,
Ag.

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

[android-developers] HIDE_NAVIGATION does not cause Configuration change?

2012-05-04 Thread Agus
Hi all,

Why HIDE_NAVIGATION does not cause Configuration change?
also, when the nav bar is hidden, the dimension reported by the
Display.getMetrics should also change right?

-Agus.

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

[android-developers] Bluetooth obtain custom info from discovery

2012-05-04 Thread Agus
Hi,
I'm working with Bluetooth on an Android project, an I'm trying to
obtain a list of visible bluetooth devices to show the user. My
objective is, obtain the list, check if the user discovered has the
same application opened, and then, add him to the list.

Is it possible add custom info (a header, an id, ... ) to bluetooth
device like an id card, and, from a different device read it from
BluetoothDevice class?

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] Is showing dialog from a dialog possible?

2012-05-01 Thread Agus
Thanks all for the answers,  I asked that question is because of the
nuances of SystemUiVisibility flag if set inside a dialog.
Specifically, when HIDE_NAVIGATION is set to a dialog A, and then dialog is
dismissed, and when dialog is shown again it retains the SystemUiVisibility
flags that was previously set.
When I show another dialog B inside that dialog A, the SystemUiVisibility
flag of A got reset to 0.

On Tue, May 1, 2012 at 4:49 AM, Kostya Vasilyev  wrote:

> In particular, managed dialogs (shown with showDialog(id)) don't preserve
> their relative z-order after an orientation change...
>
> DialogFragments, I believe, do.
>
> 2012/5/1 lbendlin 
>
>> It may be possible all right, but it sure smells like a bad user
>> experience.
>>
>> On Tuesday, May 1, 2012 6:30:46 AM UTC-4, tarun sablok wrote:
>>
>>> It is very much possible ...  just include  the showDialog()  function
>>> with the ID of the dialog where you are handling the events of the dialog..
>>>
>>> On Tue, May 1, 2012 at 6:46 AM, TreKing  wrote:
>>>
>>>> On Mon, Apr 30, 2012 at 7:27 PM, Agus  wrote:
>>>>
>>>>> Is showing dialog from a dialog possible? (Not an activity that gets
>>>>> styled as a dialog.)
>>>>
>>>>
>>>> What are you trying to do?
>>>>
>>>> --**--**
>>>> --**---
>>>> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
>>>> transit tracking app for Android-powered devices
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Android Developers" group.
>>>> To post to this group, send email to android-developers@**
>>>> googlegroups.com 
>>>> To unsubscribe from this group, send email to
>>>> android-developers+**unsubscr...@googlegroups.com
>>>> For more options, visit this group at
>>>> http://groups.google.com/**group/android-developers?hl=en<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
>

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

[android-developers] Is showing dialog from a dialog possible?

2012-04-30 Thread Agus
Is showing dialog from a dialog possible? (Not an activity that gets styled
as a dialog.)

-Agus.

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

2012-04-27 Thread Agus
Hi Dianne,

Why is the systemUiVisibility for the activity window not get reset when
the dialog get dismissed?

-Agus.

On Fri, Apr 27, 2012 at 11:12 AM, Dianne Hackborn wrote:

> It's more complicated than that.  Each window can make a request fot the
> system UI visibility, but since there is only one system UI at some level
> this is global.  The top-most application gets to control it.  That is why
> there is:
>
>
> http://developer.android.com/reference/android/view/View.OnSystemUiVisibilityChangeListener.html
>
>
> On Thu, Apr 26, 2012 at 5:14 PM, Mark Murphy wrote:
>
>> On Thu, Apr 26, 2012 at 8:07 PM, Agus  wrote:
>> > I am wondering if systemUiVisibility flag set via setSystemUiVisibility
>> is a
>> > global flag across apps?
>>
>> No. You only affect your app with that flag.
>>
>> --
>> Mark Murphy (a Commons Guy)
>> http://commonsware.com | http://github.com/commonsguy
>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>
>> Android Training...At Your Office: http://commonsware.com/training
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, 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
>

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

2012-04-26 Thread Agus
Thanks Mark,

As soon as I throw a dialog within activity that has setSystemUiVisibility
set to HIDE_NAVIGATION,  that flag got cleared. Is that the expected
behavior?

-Agus.


On Thu, Apr 26, 2012 at 5:14 PM, Mark Murphy wrote:

> On Thu, Apr 26, 2012 at 8:07 PM, Agus  wrote:
> > I am wondering if systemUiVisibility flag set via setSystemUiVisibility
> is a
> > global flag across apps?
>
> No. You only affect your app with that flag.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android Training...At Your Office: http://commonsware.com/training
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] systemUiVisibility is a global flag across apps?

2012-04-26 Thread Agus
Hi,

I am wondering if systemUiVisibility flag set via setSystemUiVisibility is
a global flag across apps?

-Agus.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Saving layout file is very slow with Eclipse / ADT

2011-02-20 Thread Agus
Another solution is to setup ant build and build manually.

run this command on your project's base directory:
android update project --path .

it will create ant build.xml script

to build, run:
ant release



On Sun, Feb 20, 2011 at 10:26 AM, Zsolt Vasvari  wrote:
> How many resource XML files do you have in your project?  I have close
> to a hundred.  I can turn on verbose mode for compliling and the
> resource compilation step is always hanging on the same file until I
> add another one, then it hangs on the next one.  So it's not that one
> particular file is bad, but that it runs into some limitation (# of
> files, total size, whatever) that causes it to hang up for a long
> time.
>
>
>
> On Feb 20, 10:08 pm, b_t  wrote:
>> I have the same problem too, but only in Windows. In Linux it is fast
>> enought, but in Windows it us extremly slow. When I change resources I
>> have to wait long minutes to continue the work.
>>
>> Same computer, same eclipse/sdk version, same project. The difference
>> is only in OS and waiting time.
>>
>> On Feb 20, 2:11 pm, Kostya Vasilyev  wrote:
>>
>>
>>
>> > Something is wrong with your build environment.
>>
>> > Saving one file (after a sufficient delay) does kick off an automatic
>> > build - but as there shouldn't be a ongoing build at that time yet, you
>> > should not get the dialog you're describing.
>>
>> > Now, if you save two layout / resource files quickly one after another,
>> > then yes, the second one will wait for the automatic build triggered by
>> > the first one to complete, and you will get the dialog.
>>
>> > Try to disable automatic builds, clean the project, including deleting
>> > everything in your project's "bin" folder, then re-enable it back, see
>> > if that fixes things.
>>
>> > -- Kostya
>>
>> > 20.02.2011 2:08, Tom пишет:
>>
>> > > No it happen even with one single layout file.
>>
>> > > --Tom
>> > > --
>> > > You received this message because you are subscribed to the Google
>> > > Groups "Android Developers" group.
>> > > To post to this group, send email to android-developers@googlegroups.com
>> > > To unsubscribe from this group, send email to
>> > > android-developers+unsubscr...@googlegroups.com
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/android-developers?hl=en
>>
>> > --
>> > Kostya Vasilyev --http://kmansoft.wordpress.com- 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

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Saving layout file is very slow with Eclipse / ADT

2011-02-19 Thread Agus
Try disabling automatic build.

On Sat, Feb 19, 2011 at 6:08 PM, Tom  wrote:
> No it happen even with one single layout file.
> --Tom
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] NFC Reader / Transmitter

2011-01-24 Thread Agus
use RFID tag

On Mon, Jan 24, 2011 at 9:16 PM, mduffy215  wrote:
> I am planning ahead for the next release of Android.
>
> Does anyone know of a product that is an NFC reader and also a
> transmitter (i.e., can it send information to and NFC phone and read
> information from and NFC phone)?
>
> Thx!
>
> 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

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

2011-01-14 Thread Agus
hi Mark,

so we should not use MODE_WORLD_READABLE in a content provider implementation?
can you provide a link to the outline you mentioned.


On Fri, Jan 14, 2011 at 7:16 AM, Mark Murphy  wrote:
> On Thu, Jan 13, 2011 at 10:05 PM, John Lussmyer  
> wrote:
>> So, all the documentation about making things "World Writeable" is a flat
>> out lie?
>
> No.
>
> MODE_WORLD_WRITEABLE is available for a handful of methods on Context
> (e.g., openFileOutput()) and for ParcelFileDescriptor (mostly used by
> content providers, AFAIK). Ideally, there would be an equivalent
> operation for standard Java file I/O within the area demarcated by
> getFilesDir() -- I can only guess as to why setWritable() was dropped.
>
> MODE_WORLD_WRITEABLE on a file is a really bad idea, for the same
> security reasons that world-writable files are a bad idea in any
> operating system.
>
> Use any of the mechanisms that I outlined in a previous thread of
> yours for inter-process communication on Android.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android App Developer Books: http://commonsware.com/books
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

2011-01-14 Thread Agus
if you block the home/back buttons then they will be stuck in the game,
if not then they can use app manager to force close, or go to android
settings screen.

On Thu, Jan 13, 2011 at 12:35 PM, bob  wrote:
> I made a slot machine game for Android a few weeks ago, and I forgot
> to include code to allow a user to quit the app.  How do most Android
> apps
>
> allow the user to quit, and do they have a way to quit my slot machine
> even though I forgot to code it in?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] AsyncTask why not must be created in UI thread?

2010-12-28 Thread Agus
asynctask runs in a separate thread, it has a pool of thread

On Tue, Dec 28, 2010 at 5:08 AM, water boiled  wrote:
> Asynctask why not must created in ui thread?
>
> thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Android - InputStream SQLiteDatabase - How to read more than one xml file

2010-12-24 Thread Agus
use transactions, it will be much faster

On Fri, Dec 24, 2010 at 5:39 AM, giuseppe  wrote:
> I'have this code
>
> public class DatabaseHelper extends SQLiteOpenHelper {
>
>        public static final String DATABASE_NAME = "prova";
>
>        protected Context context;
>
>        public DatabaseHelper(Context context) {
>                super(context, DATABASE_NAME, null, 1);
>                this.context = context;
>        }
>
>       �...@override
>        public void onCreate(SQLiteDatabase db) {
>                String s;
>                try {
>                        Toast.makeText(context, "1", 2000).show();
>                        InputStream in =
> context.getResources().openRawResource(R.raw.mysql);
>                        DocumentBuilder builder =
> DocumentBuilderFactory.newInstance().newDocumentBuilder();
>                        Document doc = builder.parse(in, null);
>                        NodeList statements = doc.getElementsByTagName("st");
>                        for (int i=0; i                                s = 
> st.item(i).getChildNodes().item(0).getNodeValue();
>                                db.execSQL(s);
>                        }
>                } catch (Throwable t) {
>                        Toast.makeText(context, t.toString(), 5).show();
>                }
>        }
>
>       �...@override
>        public void onUpgrade(SQLiteDatabase db, int oldVersion, int
> newVersion) {
>                db.execSQL("DROP TABLE IF EXISTS employees");
>                onCreate(db);
>        }
>
> }
>
> This class read myxml file and executes sql instruction that are in
> the statements .
>
> Because the XML file is about 4MB I'have to split it in three or four
> files, but I don't know how to modify the code to do this. Thanks for
> any suggestion.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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 can my service change values of variables and UI textfields of my activities?

2010-10-20 Thread Agus
you send an intent from the service and have a broadcastreceiver in
the activities

On Wed, Oct 20, 2010 at 5:56 AM, saex  wrote:
> Hi
>
> I have an application that get/send data from/to a remote DB on
> internet.
>
> I need to get my application working in background mode, then i supose
> that i have to put all the send/get remote data in a service.
>
> but How can this service change values of variables and UI
> textfields of my activities?
>
> i can't find any information about this, all the tutorials i am
> finding are of simple services that doesn't do something like that
>
> can someone explain me how to do it please?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: How to get the SharedPreferences name managed by PreferenceActivity outside of the PreferenceActivity class?

2010-10-20 Thread Agus
You are right, should be this:
String packageName = ctx.getPackageName();



On Wed, Oct 20, 2010 at 8:40 AM, TreKing  wrote:
> On Wed, Oct 20, 2010 at 4:46 AM, Agus  wrote:
>>
>> ctx.getApplicationContext()
>
> This is completely redundant.
>
> Also, why do you need the "name" anyway?
>
> -
> TreKing - Chicago transit tracking app for Android-powered devices
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: How to get the SharedPreferences name managed by PreferenceActivity outside of the PreferenceActivity class?

2010-10-20 Thread Agus
Turns out that there is no API method for solving my problem, below is
a 4-line solution.

public static String getSharedPreferenceName(Context ctx, int 
prefResId){
String packageName = 
ctx.getApplicationContext().getPackageName();
Resources res = ctx.getResources();
String entryName = res.getResourceEntryName(prefResId);
return packageName+"_"+entryName;
}

On Wed, Oct 20, 2010 at 2:32 AM, Agus  wrote:
> Within the PreferenceActivity class, I can obtain the sharedpreference
> name by calling:
> getPreferenceManager().getSharedPreferencesName();
>
> How to get the SharedPreferences name managed by PreferenceActivity
> outside of the PreferenceActivity class?
>

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


[android-developers] How to get the SharedPreferences name managed by PreferenceActivity outside of the PreferenceActivity class?

2010-10-20 Thread Agus
Within the PreferenceActivity class, I can obtain the sharedpreference
name by calling:
getPreferenceManager().getSharedPreferencesName();

How to get the SharedPreferences name managed by PreferenceActivity
outside of the PreferenceActivity class?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 can i take EditText box data when user clicks on the soft keyboard Enter key

2010-10-15 Thread Agus
read the android sdk

On Fri, Oct 15, 2010 at 3:48 AM, rokson  wrote:
> Hi Friends,
>
> I want to get EditText data when user clicks on the soft keyboard
> Enter key.
>
> How can i do it. Please help me..
>
>
> Thanks and Regards,
>
> Kiran.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 design considerations: AsynchTask vs Service (IntentService?)

2010-10-02 Thread Agus
item #5 seems not user friendly to me.
assuming that user can open other applications on the phone and since
that the sync takes 10-20 minutes i suggest initiating an asynctask in
a service. If you use a service, android will try hard not kill your
application process.


On Tue, Sep 28, 2010 at 11:50 PM, Tia  wrote:
>
> I'm designing an android app which will need todo the following steps:
>
>   1. user pushes a button or otherwise indicates to "synch data".
>   2. synch process will use REST web services to move data to and
> from the server.
>   3. the data will be stored locally in a sqlite database.
>   4. the synch process should provide status updates/messages to the
> UI
>   5. the user should not be allowed to wander off to other parts of
> the application and do more work during the synch process.
>
> The first time the synch process runs, it may take 10-20 minutes.
> After the initial synch, less data will be transferred and stored and
> I expect the process to take 1-2 minutes or less.
>
> I've been doing a lot of reading about android's AsychTask and various
> examples of using a Service ... But I don't fully understand the
> design considerations and trade-offs of choosing one design over the
> other. I currently have my demo project stubbed out using an
> AsychTask. After watching (most of) Developing Android REST client
> applications: 
> http://code.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html#
> I'm left confused the design patterns described here feel overly
> complex, perhaps because I just "don't get it" yet.
>
> Would love to hear from some more experienced android developers out
> there who have already wrestled with these questions.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Run service in different intervals

2010-09-28 Thread Agus
use AlarmManager.

On Tue, Sep 28, 2010 at 11:15 AM, Bhavya Siddappa  wrote:
> Hi,
>
>
>
> Is their way to start a service at a particular timestamp for a specific
> interval & then start it again in the next timestamp?
>
> Scenario:
>
> Start the service at 6.00 am IST till 7.00 am IST and again start it at 3.00
> pm IST
>
>
>
> Thanks,
>
> - Bhavya
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Debugger suddenly can't see my device

2010-09-27 Thread Agus
adb kill-server
adb start-server

On Mon, Sep 27, 2010 at 1:44 PM, Bret Foreman  wrote:
> I was debugging away and moved my phone a bit and the debugger lost
> contact. I figured it was just a loose USB so I reseated the cable and
> attempted to restart the debugger. Now the debugger can't find my
> phone. I can manage the phone from DDMS without any problem so it's
> not a phone, cable, or driver issue. Something went wacko in the
> debugger setup. When I go to Run Configurations in Eclipse, the phone
> is simply not in the list of choices. Any ideas where I can look for
> what's wrong?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Service gets instantiated multiple times

2010-09-27 Thread Agus
Calling bindService will start the service if it has not been started,
so you dont have to call both methods.

On Mon, Sep 27, 2010 at 6:15 AM, Olivier Guilyardi  wrote:
> Hi,
>
> IIUC, there should only be one instance of a given service, it is a singleton.
>
> However, my (audio engine) service gets instantiated multiple times, although 
> I
> do nothing for it.
>
> When the service crashes (for example when I uninstall the app through adb), 
> it
> gets scheduled for restart ("Scheduling restart of crashed service.. "). I
> understand this is an effect of the service being sticky.
>
> After that, when my app starts, it calls startService() and bindService(), and
> the service gets appropriately started and bound. But the service is then
> reinstantiated and onCreate() is called repeatedly, as many times it was
> scheduled for restart.
>
> Each instance then wait for clients to bind and register, but onBind() is only
> called in the "main" service instance. The additional instances wait a bit for
> client to bind, and since that doesn't happen, they call stopSelf().
>
> But stopSelf() has absolutely no effect in these "dead" instances, onDestroy()
> is never called.
>
> The "main" service instance does work as expected, and when it decides to call
> stopSelf(), onDestroy() is indeed called.
>
> Worse, all these dead instances accumulate, they never gets destroyed.
> Therefore, their only possible end is a crash (which happen every time I
> launch/install through adb), and thus scheduled restart.
>
> So that in the end I get many of these dead instances, which are restarted
> progressively once by minute approximately.
>
> What's this??
>
> --
>  Olivier
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Newbiew question: authoroties

2010-09-27 Thread Agus
correction: it is the "android:authorities" attribute

On Mon, Sep 27, 2010 at 12:47 PM, Agus  wrote:
> Check your authority attribute of your ContentProvider component in
> the manifest file.
>
> On Mon, Sep 27, 2010 at 8:10 AM, Pedro Teixeira
>  wrote:
>> Anyone has a clue about this?
>>
>> Please... I have to applications... one has a provider tag in the manifest,
>> the other doesn't have anything.
>> And I keep getting this error but I don't know how can I change it since I
>> don't know which one is the standard.
>>
>>
>> On Sep 27, 2010, at 8:59 AM, Pedro Teixeira wrote:
>>
>>> Hi all,
>>>
>>> I know this will be elementray but I'm not finding anywhere for a
>>> straightforward answer...
>>> I'm getting this : Installation error:
>>> INSTALL_FAILED_CONFLICTING_PROVIDER
>>>
>>> Which apparentlly seems I'm I give the provider an authority which is
>>> already being used by another app on the system.
>>>
>>> I mean.. how do I change that? What authority are everyone talking
>>> about, I can't find anything like that in the manifest...
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-developers@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>>
>> Pedro Teixeira
>>
>> www.pedroteixeira.org
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>

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

2010-09-27 Thread Agus
Check your authority attribute of your ContentProvider component in
the manifest file.

On Mon, Sep 27, 2010 at 8:10 AM, Pedro Teixeira
 wrote:
> Anyone has a clue about this?
>
> Please... I have to applications... one has a provider tag in the manifest,
> the other doesn't have anything.
> And I keep getting this error but I don't know how can I change it since I
> don't know which one is the standard.
>
>
> On Sep 27, 2010, at 8:59 AM, Pedro Teixeira wrote:
>
>> Hi all,
>>
>> I know this will be elementray but I'm not finding anywhere for a
>> straightforward answer...
>> I'm getting this : Installation error:
>> INSTALL_FAILED_CONFLICTING_PROVIDER
>>
>> Which apparentlly seems I'm I give the provider an authority which is
>> already being used by another app on the system.
>>
>> I mean.. how do I change that? What authority are everyone talking
>> about, I can't find anything like that in the manifest...
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
> Pedro Teixeira
>
> www.pedroteixeira.org
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

2010-09-27 Thread Agus
use ant

On Sun, Sep 26, 2010 at 11:38 PM, mahesh patil
 wrote:
> Hi all,
>
> I want to change my apk file name on every compilation of my build.
>
> For example,
> I have my build name currently,
> android.apk
>
> Now I want it to be on every compilation as,
> android_v0_0_1.apk
> android_v0_0_2.apk
> android_v0_0_3.apk
>               .
>               .
>               .
>               .
>        And so on.
>
> How do I achieve these results.
>
> Please help in achieving this.
>
> Thanks and Regards,
> Mahesh Patil.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] retrive values from database?

2010-09-27 Thread Agus
Use the SQLiteOpenHelper, and SQLiteDatabase classes.

To get your database file path:  context.getDatabasePath(DB_NAME)

On Mon, Sep 27, 2010 at 12:02 PM, Gold  wrote:
> Hi..All,
>
>                  I create database using sqlite in command prompt.
>
>                   In my login screen user can enter loginid and
> password. then click the login button. while click the button I need
> to check that ..if login successful I need to  retrive other details
> from the same table . How can i achive this. is there any sample
> code..!
>
> Here is the details
>
> database name : COPU
>
> Table name : Master_UserLogin
>
> columns : LoginID ,  Password,      SiteID,    BOCUDate
>
> once i check loginid and password if it is match i need to display
> siteid and bocudate..
>
> please help me.
>
>
>
> Thanks in advance,
> Gold
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

2010-09-27 Thread Agus
class MyThread extends Thread{
public Handler h;
private CountDownLatch wait = new CountDownLatch(1);
@Override
public void run() {
Looper.prepare();
h = new Handler();
Looper.loop();  
wait.countDown();
}   
public void waitInit(){
try {
wait.await(2000,TimeUnit.SECONDS);
} catch (InterruptedException e) {  

e.printStackTrace();
}
}
};


myThread = new MyThread ();
myThread.start();
myThread.waitInit();
myThread.h.post(
new Runnable(){
   public void run(){
  
   }
}
);


On Mon, Sep 27, 2010 at 9:38 AM, Kakyoin  wrote:
> Hi.
>
> I'm trying to initialize OpenFeint in my game like this:
> -
> protected void onCreate(Bundle savedInstanceState) {
>   super.onCreate(savedInstanceState);
>   OpenFeintSettings settings = new OpenFeintSettings("xxx",
> "xxx","xxx","xxx");
>   OpenFeint.initialize(this, settings, new OpenFeintDelegate() {});
>   
> -
> Result:
> 1. OpenFeint initialization sometimes take so song(network actions?).
> It blocks the main thread.
> 2. My application remains in onCreate() for too long.
> 3. My Dev Phone One display ANR(application not responding) dialog
> prompting me to choose between 'Force Close' and 'Wait'
> 4. Soon after that, OpenFeint has done its things and my game shows up
> behind the dialog.
> 5. Now pressing 'Wait' will dismiss the ANR dialog and I can continue
> my game properly.
>
>
>
> But obviously we don't want ANR dialog. So now I put it in a Thread
> like this:
> -
> protected void onCreate(Bundle savedInstanceState) {
>   super.onCreate(savedInstanceState);
>   new Thread(){
>                       �...@override
>                        public void run() {
>                                Looper.prepare();
>                                        OpenFeintSettings settings = new 
> OpenFeintSettings("xxx",
> "xxx","xxx","xxx");
>                                        OpenFeint.initialize(this,
> settings, new OpenFeintDelegate() {});
>                                Looper.loop();
>                        }
>    }.start();
>
> -
> Result: Problem solved. Everything seems to run fine now.
>
> I put Looper.prepare() there because my game will crash if I don't.
> The log message told me to put it there.
> I put Looper.loop();     there because OpenFeint will not initialize
> at all if I don't.
> I've read the doc about Looper but honestly I don't understand what
> the doc says.
>
> Question:
> Question 1. The doc also tell me this:
> -
> public static final void loop ()
>
> Since: API Level 1
> Run the message queue in this thread. Be sure to call quit() to end
> the loop.
> --
> Can anyone explain when & where should I call quit()?
>
> Question 2 What will happen if I don't call Looper.quit()?
>
> Question 3 Let me ask this straight. Am I taking the correct approach?
> Is there some kind of loop running alongside my game all the time if I
> do this?
>
> Thank you 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

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

2010-09-27 Thread Agus
Sorry last solution sent you is wrong since the handler was
instantiated in the UI thread, here's the correct one:

create a subclass MyThread like this:

class MyThread extends Thread{
public Handler h;
private CountDownLatch wait;
@Override
public void run() {
Looper.prepare();
h = new Handler();
Looper.loop();  
}   
public void waitInit(){
try {
wait.await(2000,TimeUnit.SECONDS);
} catch (InterruptedException e) {  

e.printStackTrace();
}
}
};

and then in your onCreate:

myThread = new MyThread();
myThread.waitInit();
myThread.h.post(
new Runnable{
  
}
);






On Mon, Sep 27, 2010 at 9:38 AM, Kakyoin  wrote:
> Hi.
>
> I'm trying to initialize OpenFeint in my game like this:
> -
> protected void onCreate(Bundle savedInstanceState) {
>   super.onCreate(savedInstanceState);
>   OpenFeintSettings settings = new OpenFeintSettings("xxx",
> "xxx","xxx","xxx");
>   OpenFeint.initialize(this, settings, new OpenFeintDelegate() {});
>   
> -
> Result:
> 1. OpenFeint initialization sometimes take so song(network actions?).
> It blocks the main thread.
> 2. My application remains in onCreate() for too long.
> 3. My Dev Phone One display ANR(application not responding) dialog
> prompting me to choose between 'Force Close' and 'Wait'
> 4. Soon after that, OpenFeint has done its things and my game shows up
> behind the dialog.
> 5. Now pressing 'Wait' will dismiss the ANR dialog and I can continue
> my game properly.
>
>
>
> But obviously we don't want ANR dialog. So now I put it in a Thread
> like this:
> -
> protected void onCreate(Bundle savedInstanceState) {
>   super.onCreate(savedInstanceState);
>   new Thread(){
>                       �...@override
>                        public void run() {
>                                Looper.prepare();
>                                        OpenFeintSettings settings = new 
> OpenFeintSettings("xxx",
> "xxx","xxx","xxx");
>                                        OpenFeint.initialize(this,
> settings, new OpenFeintDelegate() {});
>                                Looper.loop();
>                        }
>    }.start();
>
> -
> Result: Problem solved. Everything seems to run fine now.
>
> I put Looper.prepare() there because my game will crash if I don't.
> The log message told me to put it there.
> I put Looper.loop();     there because OpenFeint will not initialize
> at all if I don't.
> I've read the doc about Looper but honestly I don't understand what
> the doc says.
>
> Question:
> Question 1. The doc also tell me this:
> -
> public static final void loop ()
>
> Since: API Level 1
> Run the message queue in this thread. Be sure to call quit() to end
> the loop.
> --
> Can anyone explain when & where should I call quit()?
>
> Question 2 What will happen if I don't call Looper.quit()?
>
> Question 3 Let me ask this straight. Am I taking the correct approach?
> Is there some kind of loop running alongside my game all the time if I
> do this?
>
> Thank you 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

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

2010-09-27 Thread Agus
Try this:
create handler as member variable of your activity;

private Handler h = new Handler();

and then in the onCreate method:

h.post(
new Runnable(){

}
);


On Mon, Sep 27, 2010 at 9:38 AM, Kakyoin  wrote:
> Hi.
>
> I'm trying to initialize OpenFeint in my game like this:
> -
> protected void onCreate(Bundle savedInstanceState) {
>   super.onCreate(savedInstanceState);
>   OpenFeintSettings settings = new OpenFeintSettings("xxx",
> "xxx","xxx","xxx");
>   OpenFeint.initialize(this, settings, new OpenFeintDelegate() {});
>   
> -
> Result:
> 1. OpenFeint initialization sometimes take so song(network actions?).
> It blocks the main thread.
> 2. My application remains in onCreate() for too long.
> 3. My Dev Phone One display ANR(application not responding) dialog
> prompting me to choose between 'Force Close' and 'Wait'
> 4. Soon after that, OpenFeint has done its things and my game shows up
> behind the dialog.
> 5. Now pressing 'Wait' will dismiss the ANR dialog and I can continue
> my game properly.
>
>
>
> But obviously we don't want ANR dialog. So now I put it in a Thread
> like this:
> -
> protected void onCreate(Bundle savedInstanceState) {
>   super.onCreate(savedInstanceState);
>   new Thread(){
>                       �...@override
>                        public void run() {
>                                Looper.prepare();
>                                        OpenFeintSettings settings = new 
> OpenFeintSettings("xxx",
> "xxx","xxx","xxx");
>                                        OpenFeint.initialize(this,
> settings, new OpenFeintDelegate() {});
>                                Looper.loop();
>                        }
>    }.start();
>
> -
> Result: Problem solved. Everything seems to run fine now.
>
> I put Looper.prepare() there because my game will crash if I don't.
> The log message told me to put it there.
> I put Looper.loop();     there because OpenFeint will not initialize
> at all if I don't.
> I've read the doc about Looper but honestly I don't understand what
> the doc says.
>
> Question:
> Question 1. The doc also tell me this:
> -
> public static final void loop ()
>
> Since: API Level 1
> Run the message queue in this thread. Be sure to call quit() to end
> the loop.
> --
> Can anyone explain when & where should I call quit()?
>
> Question 2 What will happen if I don't call Looper.quit()?
>
> Question 3 Let me ask this straight. Am I taking the correct approach?
> Is there some kind of loop running alongside my game all the time if I
> do this?
>
> Thank you 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

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

2010-09-27 Thread Agus
Take a look at the HttpGet and HttpPost method in the API.

On Mon, Sep 27, 2010 at 10:48 AM, dadada  wrote:
> hello,
>
> i want to post data onto google map. since there's no gdata for
> android, i reckon that i have to do it through http post and get which
> i am not good at.
>
> is there some reference code for doing http post and get request?
>
> Both the url to the map and xml are the same
> http://maps.google.com/maps/ms?ie=UTF8&hl=en&vps=1&jsv=260d&oe=UTF8&msa=0&output=georss&msid=106069377598790155454.0004720325247dc0c953a
>
> I guess it should be regarding the content type. Should i be calling
> get http on this url to retrieve the xml? and then modify the xml file
> and do a post http request to this same url again?
>
> Can someone please advise me?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Sending 2 sticky intents will override the previous one?

2010-09-23 Thread Agus
Dianne, so far I understand the following: If sticky intent B has the
same action, categories and uri data as sticky intent A then B will
override A.  Will the extras data in sticky intent A be merged with
the extras data in sticky intent B?

On Thu, Sep 23, 2010 at 9:40 PM, Dianne Hackborn  wrote:
> Yes, that is the point of them.
>
> On Thu, Sep 23, 2010 at 6:45 PM, Agus  wrote:
>>
>> Does sending 2 sticky intents override the previously sent sticky intent?
>> Can any clarify 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
>
>
>
> --
> 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

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


[android-developers] Sending 2 sticky intents will override the previous one?

2010-09-23 Thread Agus
Does sending 2 sticky intents override the previously sent sticky intent?
Can any clarify 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


Re: [android-developers] Re: On using themes?!

2010-09-22 Thread Agus
try using this


On Wed, Sep 22, 2010 at 9:26 AM, Mariano Kamp  wrote:
> As it wasn't possible to submit a new post to the existing/old conversation
> using the web interface I am copying the message here with Danilo's
> permission:
> Hi Mariano.
>
> Did you manage to work using themes from drawables xml?
> I have same problem and there is no any reference but this thread and
> there is no solution here.
> If you find solution please let me know.
>
> I currently "solved" it by using different drawable xml for every
> theme but as you can see this isn't a god solution at all.
>
> About your question about getting a color from a theme (I know its old
> but for future readers :) ) solution I created is like this:
>
>        private static int getColor(final Context context, final int id,
> final int defaultColor) {
>                try {
>                        final Theme theme = context.getTheme();
>                        if (theme == null) {
>                                return defaultColor;
>                        }
>                        TypedValue typedValue = new TypedValue();
>
>                        if (theme.resolveAttribute(id, typedValue, false)) {
>                                final Resources resources =
> context.getResources();
>                                final int resourceId = typedValue.resourceId;
>                                if (typedValue.type ==
> TypedValue.TYPE_INT_COLOR_RGB8 ||
> typedValue.type == TypedValue.TYPE_INT_COLOR_RGB4 || typedValue.type
> == TypedValue.TYPE_INT_COLOR_ARGB4
>                                                || typedValue.type ==
> TypedValue.TYPE_INT_COLOR_ARGB8 ||
> typedValue.type == TypedValue.TYPE_FIRST_COLOR_INT) {
>                                        return typedValue.data;
>                                } else {
>                                        return
> resources.getColor(resourceId);
>                                }
>                        }
>                        return defaultColor;
>                } catch (NotFoundException e) {
>                        // TODO Auto-generated catch block
>                        e.printStackTrace();
>                        return defaultColor;
>                }
>        }
>
> On Tue, May 11, 2010 at 9:08 AM, Mariano Kamp 
> wrote:
>>
>> Hi Dianne.
>> Thanks very much, almost there.
>> I understand the procedure, it would do what I want, but I run into an
>> exception:
>> D/NewsRobDefaultExceptionHandler( 1839): Caused by:
>> java.lang.UnsupportedOperationException: Can't convert to color: type=0x2
>> D/NewsRobDefaultExceptionHandler( 1839): at
>> android.content.res.TypedArray.getColor(TypedArray.java:273)
>> D/NewsRobDefaultExceptionHandler( 1839): at
>> android.graphics.drawable.GradientDrawable.inflate(GradientDrawable.java:647)
>> D/NewsRobDefaultExceptionHandler( 1839): at
>> android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:788)
>> D/NewsRobDefaultExceptionHandler( 1839): at
>> android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
>> D/NewsRobDefaultExceptionHandler( 1839): at
>> android.content.res.Resources.loadDrawable(Resources.java:1690)
>> This happens when using it the way we described here in a drawable xml.
>> However to better understand the error I used it on other attributes and
>> when using it on the background attribute of a View it works. Maybe this
>> approach is incompatible with drawables that are expressed in xml?
>> Btw. Is there any way to get the actual #rgb string for a color from a
>> theme?
>> Cheers,
>> Mariano
>> On Tue, May 11, 2010 at 8:02 AM, Dianne Hackborn 
>> wrote:
>>>
>>> You need to define an attribute for your value:
>>> 
>>> Then make a custom theme that supplies a value for it:
>>> 
>>>     #ff808080
>>> 
>>> And now you can reference that value from other XML:
>>>
>>> http://schemas.android.com/apk/res/android
>>> "
>>> android:shape="rectangle">
>>> >>
>>> android:endColor="#66FF"
>>> android:angle="270" />
>>> 
>>>
>>> Note that "com.my.package" is your manifest's package name.
>>> Also I just wrote this by hand so I won't guarantee it is completely
>>> right. :}
>>> On Mon, May 10, 2010 at 11:02 AM, Mariano Kamp 
>>> wrote:

 Hmmh, also no answer to this question on themes. Maybe the answer cannot
 be given with two lines? So let me explain what I would expect step by step
 and you stop me were I deviate from the Golden Path? I'll try yes/no
 questions.
 In the simplest terms I would expect that in every place I can specify a
 color in RGB (#) I could also specify a symbolic name instead. This
 should work like @color/xyz, but with one more level of indirection that
 lets me switch between themes, like dark and light.
 Is that possible?
 I would expect those themes to be applicable to (a) widgets, (b)
 drawables (see the mentioned example) and (c) when I need t

Re: [android-developers] Re: How much money do you make?

2010-09-21 Thread Agus
@JonFHancock
Is that amount generated from ads or paid?
If from ads i want to know the average #impressions and
%clickthroughrate per month if you don't mind ?

On Tue, Sep 21, 2010 at 11:50 AM, JonFHancock  wrote:
> On an average day, I make $70 to $100 on one paid app.  If I get a
> blog post,  it jumps up above $200 for a few days.  The first time
> Droid Life posted about it, I made $700.  A high-ish profile mention
> in a forum will pull in an extra $20 - $40.  My app is in its 3rd
> month, and serves a niche market.
>
> If your app is marketable, you need to be watching key terms using
> Google Alerts.  Respond to every relevant form and blog post (in as
> much of a non-spammy way as possible), and make bloggers love you.
>
> I just started selling on PayPal too, and it has been quite a hassle
> to support, and is making about $10/day.  That is only three days of
> activity though.  Given time, it may make more money, and I may
> suffocate under the pile of "I didn't get my license" and "where do I
> download it" emails.
>
> On Sep 18, 2:15 pm, cellurl  wrote:
>> ACC (Android Cruise Control) v1.4
>> Applications: Entertainment
>> (5)
>> Comments
>> 614 total
>> 153 active installs (24%)
>> Free Errors Published
>>
>> Back Seat Driver V, Strip Line v9.8
>> Applications: Entertainment
>> (10)
>> Comments
>> 2185 total
>> 304 active installs (13%)
>> Free Errors Published
>>
>> Speed Limit v1.65
>> Applications: Entertainment
>> (7)
>> Comments
>> 44 total
>> 15 active installs (34%)
>> $0.99 Errors Published
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Are Sticky Intents visible to other applications by default? if so how to limit this visibility?

2010-09-17 Thread Agus
Are Sticky Intents visible to other applications by default? if so how
to limit this visibility?

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

2010-09-17 Thread Agus
good answer!

On Fri, Sep 17, 2010 at 12:07 PM, TreKing  wrote:
> On Fri, Sep 17, 2010 at 12:45 PM, xc s  wrote:
>>
>> how to use the gprs in android ??
>
> http://www.catb.org/esr/faqs/smart-questions.html
>
> -
> TreKing - Chicago transit tracking app for Android-powered devices
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: How much money do you make?

2010-09-17 Thread Agus
Just go for paid apps if you want to make fast money, ads generate
VERY little revenue unless you have 1.000.000 ads impressions/day

On Fri, Sep 17, 2010 at 7:40 AM, TreKing  wrote:
> On Thu, Sep 16, 2010 at 5:22 PM, William Ferguson
>  wrote:
>>
>> Very droll.
>
> Perhaps =P
>
>> But it's a good question.
>
> Yes, it would definitely be very interesting to see some stats from various
> developers.
>
> But it IS a fairly private / personal question not many people are going to
> be willing to answer. Notice how no one has actually answered the question,
> including the OP, save for the one person that was already blogging about it
> anyway.
>
> BTW, poly, thanks for sharing and congrats on the success. When I'm making
> that much I'll be flaunting it too =P
>
> -
> TreKing - Chicago transit tracking app for Android-powered devices
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Do static variables of an ApplicationContext subclass left untouched when the process is killed?

2010-09-07 Thread Agus
Thanks for the prompt reply Mark.

If a Service is not running in the same process as the
ApplicationContext, then the system will not try hard to keep the main
process running (ApplicationContext) under low memory?

Does the Service's onDestroy get called prior to the
ApplicationContext's onTerminate() method?

On Tue, Sep 7, 2010 at 7:49 AM, Mark Murphy  wrote:
> On Tue, Sep 7, 2010 at 10:37 AM, Agus  wrote:
>> Do static variables of an ApplicationContext subclass left untouched
>> when the process is killed?
>
> When the process is killed, the Dalvik VM is also destroyed, and so
> all static data members or other objects are purged from the device.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android Training in London: http://skillsmatter.com/go/os-mobile-server
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

2010-09-07 Thread Agus
 returns START_STICKY in your onStartCommand method of your service.

On Mon, Sep 6, 2010 at 8:51 PM, sunny  wrote:
> Dear Folks,
> I have a service that is running within the context of my application. It
> gets invoked at the start of the activity and then gets update when new data
> is inserted or deleted from the database. The problem is that everytime I
> start the activity , it restarts the service. As you may have guessed  - not
> a very intuitive design. Therefore I was wondering if there is a way to
> determine if the service is already running before starting it. I know I can
> bind to the service but I do not want that since the main activity needs to
> exits after the database operation is completed.
>
> I know for system services, you can get the service details from the
> application context. How do you do it for user defined service?
>
> thanks for all help here.
>
> regards
> Sunny.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Do static variables of an ApplicationContext subclass left untouched when the process is killed?

2010-09-07 Thread Agus
Do static variables of an ApplicationContext subclass left untouched
when the process is killed?

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


[android-developers] What is the class name of media scanner service?

2010-08-31 Thread Agus
What is the class name of media scanner service?

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

2010-08-31 Thread Agus
A thread hosted by the ApplicationContext will get killed  by the
System if necessary
but not when hosted by a Service?

On Tue, Aug 31, 2010 at 9:22 AM, Kostya Vasilyev  wrote:
>  The difference is that Activity lifecycle is managed by the user, and
> Service lifecycle is managed by Android.
>
> The user can switch away from an Activity at any time, and, since Android
> isn't aware that there is a worker thread, it can kill the process that
> hosted the Activity (and the worker thread) pretty soon after that.
>
> A Service is a way to tell Android you're doing something important in the
> background, and so the process has a higher chance to be kept alive (and
> your worker thread working).
>
> -- Kostya
>
> 31.08.2010 20:05, cool.manish пишет:
>>
>> Service Component is used to do some task which can be done without
>> user interaction. But for that we have to run a thread in subclass of
>> the Service.
>> I think we can create a thread in Activity class itself then what is
>> the use of Service component?
>> Why don't we create another thread and write the non interacting code
>> in this thread.
>>
>
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget --
> http://kmansoft.wordpress.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

2010-08-27 Thread Agus
Hi,

You can abort fling effect by extending the Gallery class and
overriding the onFling method,
Inside the method, dont call the super method, just return true;



On Tue, Jul 28, 2009 at 4:20 PM, Brady  wrote:
>
> Hi everyone,
>
> I'd like to handle a fling gesture in Gallery and stop the animation
> when the next image is fully displayed on screen. I've successfully
> captured the fling gesture in my GestureListener.
>
> However when I try to call mGallery.clearAnimation() but it doesn't
> stop the fling. I've looked at the Gallery.java source and it would be
> great to have access to the mScroller to tell it to abort the
> animation.
>
> The only luck I've had so far is to dispatch two MotionEvents to the
> Gallery view: a quick TouchDown and TouchUp which stops the animation.
> There must be a better way :) I'd appreciate your help!
>
> Thanks,
> Brady
> --~--~-~--~~~---~--~~
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Protobuf on Android

2010-08-24 Thread Agus
yes, check out the android source repo for a particular .git that
contains protobuf.

On Tue, Aug 24, 2010 at 11:35 AM, JoeSchmoe
 wrote:
> Is there a package somewhere of protobufs?  If not, should I build my
> own and if so, would I build a Java Package, Android App, etc...?
>
> Thanks!
> JoeSchmoe
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] need clarification on Services

2010-08-16 Thread Agus
Yes, create your service in the android.intent.action.BOOT_COMPLETED
intent receiver.

On Mon, Aug 16, 2010 at 10:28 AM, Arjun  wrote:
> Greetings,
>
> Can a services exists as a stand alone with out any activities/
> default. Is it possible to create services with out any activities
> associated with it as a stand alone inside a apk. (just a service).
>
> Thanks,
> Arjun.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] AsyncTask, back button and cancel(boolean)

2010-08-15 Thread Agus
You might want to try using BroadcastReceivers for that scenario.
AsyncTask fires off an intent signaling that operation has been
completed with the information on how to obtain the data or include
the data in the intent.
And have each tab activity register a common receiver to handle the intent.

On Sun, Aug 15, 2010 at 3:32 PM, Filip Havlicek
 wrote:
> The UI works without the results, although I'm worried about other
> scenarios.
> The AsyncTask takes let's say 30 seconds to complete, it's invoked in first
> tab and the results are displayed in second and third tab. If user dismisses
> the ProgressDialog, he can of course navigate to second or third tab. But if
> the tab is displayed when AsyncTask completes, the results aren't displayed
> unless there is some refresh of the tab activity (ie onResume or onCreate).
> Is there a way to "asynchronously" update the tab's content upon AsyncTask's
> completion? For example using Intents? (I'm still not confident about using
> these in some larger scale than startActivity/startActivityForResult).
> (About the first question, I thought about preventing the ProgressDialog
> being dismissed by user pressing BACK button.)
> 2010/8/16 Mark Murphy 
>>
>> On Sun, Aug 15, 2010 at 6:13 PM, Filip Havlicek
>>  wrote:
>> > thanks for your swift reply. I thought my AsyncTask got destroyed
>> > somehow,
>> > but from your response it seems like just my ProgressDialog got
>> > dismissed.
>> > Is there a way I can prevent that?
>>
>> Prevent what?
>>
>> > I want the computation in AsyncTask to be
>> > done before user can interact with the UI again.
>>
>> Personally, I would recommend you design a UI that works both with and
>> without the results of the "computation".
>>
>> > And second question, can I override the back button somehow so I could
>> > catch
>> > the call in my AsyncTask and cancel it?
>>
>> onBackPressed() (Android 2.x) and onKeyDown (Android 1.x) can be used
>> to intercept the BACK button. That being said, you should consider
>> whether you really should be implementing onPause() or onStop()
>> instead, since there are more scenarios than merely the BACK button
>> (e.g., HOME button).
>>
>> --
>> Mark Murphy (a Commons Guy)
>> http://commonsware.com | http://github.com/commonsguy
>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>
>> _The Busy Coder's Guide to Android Development_ Version 3.1 Available!
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


[android-developers] How to change the icon in the default search dialog?

2010-08-14 Thread Agus
How to change the icon in the default search dialog?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 determine if the phone is powered by battery or by charger?

2010-07-28 Thread Agus
How to determine if the phone is powered by battery or by charger?

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

2010-07-27 Thread Agus
which git does this class reside in ?


On Thu, Jan 28, 2010 at 12:07 PM, elephantbug  wrote:
> Hi,
>
> I would like to implement the similar widget as QuickContactBadge from
> which I can launch some internal activities.
>
> I checked out the source code for QuickContactBadge,
> QuickContactActivity etc and simplified them to accommodate our
> requests. It can launch and display at correct position.
>
> However, I can not see the original view below the quick contact tack
> no matter how I try. And I found the window created by
> QuickContactWindow is quite small and I tried to set the background
> etc. Nothing works.
>
> Who can help or give some guidance about how window works?
>
> Say, from Activity A, I click on image, I launch a new activity (or
> window), how can I make the Window of Activity A is still visible?
>
> Or more general, what is the best way to achieve similar behavior like
> QuickContactBadge?
>
> 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

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

2010-07-27 Thread Agus
The best way is to use Parcelable. If you have one or two variables to
pass around you can use XTRAS mechanism. But if you have an object
with 5-10 member fields,  using Parcelable makes it elegant and clean.

Yes you can use static member to pass data around but this will most
often cause memory leak if you are not careful or don't know how to
handle the dangling references.


On Sun, Jul 4, 2010 at 5:34 AM, Thomas Frick  wrote:
> Dear All,
>
> I have two activities.
> Activity A creates an object and stores some data in this object.
> After that, activity B ist started. In activity B I have to use the
> object created in activity A.
>
> What is the best way to pass the object from activity A to B?
>
> I think it is not possible to store an object in the
> SharedPreferences, isn't it?
>
> Is it a good way to call the object in activity A directly from
> activity B?
>
> Thanks for your help.
> Thomas
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] pass handler to another activity

2010-07-27 Thread Agus
try using broadcastReceivers on both activities.
create a thread in the application context, and when it's done
processing the socket broadcast an intent.

On Mon, Jul 26, 2010 at 3:38 AM, zj h  wrote:
> Assume that there activity A and B, A has a handler, now B is activate
> by A, how can i pass the handler to B?
> Currently i have a thread receive messages from socket, and dispatch
> messages to A and B, I think when B is activated, pass handler to B,
> then the handler can receive message from the thread. But I don't know
> how to do.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Link for Android beginners

2010-07-27 Thread Agus
Please RTFM.

On Tue, Jul 27, 2010 at 12:41 PM, TreKing  wrote:
> On Mon, Jul 26, 2010 at 1:15 PM, Yasotharai Ponnusamy 
> wrote:
>>
>> Can anyone send me the link for learn about Android.
>
> No offense, but it seriously blows my mind how people can find this group,
> sign up, and post to it, but can't (or won't) take the time to search for
> and (quickly and easily) find the official documentation.
> Just ... don't ... get it 
>
> -
> TreKing - Chicago transit tracking app for Android-powered devices
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Android to iPhone

2010-07-24 Thread Agus
Do you mean automatic conversion? I have never seen a tool that can do that yet.

On Sat, Jul 24, 2010 at 8:32 PM, Siva G  wrote:
> Has anyone tried to convert an android app to iPhone iOS? Is that even
> possible?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: OutOfMemoryError with Bitmap

2010-07-24 Thread Agus
Is it possible to scale the outputted bitmap while decoding the stream
in one step?
I don't go with a two-step process.

On Sat, Jul 24, 2010 at 8:02 PM, DanH  wrote:
> inJustDecodeBounds in BitmapFactory.Options.
>
> On Jul 24, 9:37 pm, Agus  wrote:
>> Sorry for going slightly off-topic, how do I determine the dimension
>> of the picked gallery image without reading it first using
>> DecodeBitmap.decodeStream(InputStream) method ?
>> I am decoding the original image which causes OutOfMemory error frequently.
>>
>> On Sat, Jul 24, 2010 at 3:47 PM, DanH  wrote:
>> > Yeah, I was assuming that the space for the bitmap is allocated in
>> > Java heap, without thinking that many phones allocate graphics
>> > separately. Obviously, if the bitmap is allocated outside of the Java
>> > heap then freeMemory() does you zero good.  But my point was that
>> > freeMemory() only returns the amount of heap not allocated to objects
>> > at the moment.  If there is heap allocated to "dead" objects (that
>> > would be collected by a GC) then that space is considered "allocated",
>> > from the standpoint of freeMemory().  And, of course, there's no way
>> > to know how much "dead" heap storage there is without actually running
>> > GC.
>>
>> > So whether or not the bitmap is allocated in Java heap, freeMemory()
>> > is not real useful, at least not without actually running a (full) GC
>> > cycle first.
>>
>> > On Jul 24, 5:20 pm, Streets Of Boston  wrote:
>> >> First a small correction on DanH's reply, ARGB_ uses 32 bits (4
>> >> bytes), not 64 bits.
>>
>> >> The memory used by a Bitmap is roughly Width*Height*Depth bytes. (e.g.
>> >> a 1MPixel image in RGB_565 uses 2MByte of memory). I say roughly,
>> >> because the Bitmap object itself, holding the raw data, occupies a few
>> >> bytes itself.
>>
>> >> The problem is that the (garbage collector of) DalvikVM does not 'see'
>> >> the raw image data. It only sees the the memory usage of the Bitmap
>> >> object without the raw data (a few bytes). That's why the call to
>> >> 'freeMemory()' does not seem correct. It only reports the difference
>> >> between the max available memory minus the memory used by Java objects
>> >> (which does not include raw image data).
>>
>> >> However, the raw image data does affect the memory usage of your app's
>> >> Linux process, which is limited to either 16MByte or 24MByte.
>>
>> >> E.g. if your app's free memory is 1.5MByte and you create a 2MByte
>> >> Bitmap, the DalvikVM does not see the need to run the garbage
>> >> collector to free up old un-referenced objects, because to DalvikVM it
>> >> looks like it only needs to create a few bytes for the Bitmap object
>> >> itself and does not see the danger of a possible out-of-memory
>> >> situation.
>>
>> >> In my image-editing app, i try to mitigate this (not quite solve it),
>> >> by calling a System.gc() just before creating a (relatively) large
>> >> Bitmap. This reduces the chance of an out-of-memory error.
>>
>> >> On Jul 24, 2:03 pm, ReyLith  wrote:
>>
>> >> > First of all thank you very much everyone for your help.
>>
>> >> > I continue with a problem. I use Runtime.getRuntime().freeMemory() for
>> >> > obtain the free memory and compare it with the real Bitmap memory.
>> >> > Sometimes I get a free memory less than that occupied by the image.
>> >> > However, if I remove the restriction on the size of the image, I can
>> >> > work with it without any problem. Am I using an incorrect function to
>> >> > get the free memory?. Should I use another function?
>>
>> >> > Thank you very much in advance.
>>
>> >> > On 23 jul, 20:40, DanH  wrote:
>>
>> >> > > Close as I can tell, you use a BitmapFactory.Options and put a
>> >> > > BitmapConfig constant in that that specifies the type of internal
>> >> > > representation you want.  If you use ARGB_ then each pixel will be
>> >> > > 64 bits.  ARGB_ -- 32 bits, RGB_565 -- 16 bits.
>>
>> >> > > On Jul 23, 12:21 pm, ReyLith  wrote:
>>
>> >> > > > Thanks Nathan.
>>
>> >> > > > With this option I can obtain the image characteristics but I 

Re: [android-developers] Re: OutOfMemoryError with Bitmap

2010-07-24 Thread Agus
Sorry for going slightly off-topic, how do I determine the dimension
of the picked gallery image without reading it first using
DecodeBitmap.decodeStream(InputStream) method ?
I am decoding the original image which causes OutOfMemory error frequently.

On Sat, Jul 24, 2010 at 3:47 PM, DanH  wrote:
> Yeah, I was assuming that the space for the bitmap is allocated in
> Java heap, without thinking that many phones allocate graphics
> separately. Obviously, if the bitmap is allocated outside of the Java
> heap then freeMemory() does you zero good.  But my point was that
> freeMemory() only returns the amount of heap not allocated to objects
> at the moment.  If there is heap allocated to "dead" objects (that
> would be collected by a GC) then that space is considered "allocated",
> from the standpoint of freeMemory().  And, of course, there's no way
> to know how much "dead" heap storage there is without actually running
> GC.
>
> So whether or not the bitmap is allocated in Java heap, freeMemory()
> is not real useful, at least not without actually running a (full) GC
> cycle first.
>
> On Jul 24, 5:20 pm, Streets Of Boston  wrote:
>> First a small correction on DanH's reply, ARGB_ uses 32 bits (4
>> bytes), not 64 bits.
>>
>> The memory used by a Bitmap is roughly Width*Height*Depth bytes. (e.g.
>> a 1MPixel image in RGB_565 uses 2MByte of memory). I say roughly,
>> because the Bitmap object itself, holding the raw data, occupies a few
>> bytes itself.
>>
>> The problem is that the (garbage collector of) DalvikVM does not 'see'
>> the raw image data. It only sees the the memory usage of the Bitmap
>> object without the raw data (a few bytes). That's why the call to
>> 'freeMemory()' does not seem correct. It only reports the difference
>> between the max available memory minus the memory used by Java objects
>> (which does not include raw image data).
>>
>> However, the raw image data does affect the memory usage of your app's
>> Linux process, which is limited to either 16MByte or 24MByte.
>>
>> E.g. if your app's free memory is 1.5MByte and you create a 2MByte
>> Bitmap, the DalvikVM does not see the need to run the garbage
>> collector to free up old un-referenced objects, because to DalvikVM it
>> looks like it only needs to create a few bytes for the Bitmap object
>> itself and does not see the danger of a possible out-of-memory
>> situation.
>>
>> In my image-editing app, i try to mitigate this (not quite solve it),
>> by calling a System.gc() just before creating a (relatively) large
>> Bitmap. This reduces the chance of an out-of-memory error.
>>
>> On Jul 24, 2:03 pm, ReyLith  wrote:
>>
>> > First of all thank you very much everyone for your help.
>>
>> > I continue with a problem. I use Runtime.getRuntime().freeMemory() for
>> > obtain the free memory and compare it with the real Bitmap memory.
>> > Sometimes I get a free memory less than that occupied by the image.
>> > However, if I remove the restriction on the size of the image, I can
>> > work with it without any problem. Am I using an incorrect function to
>> > get the free memory?. Should I use another function?
>>
>> > Thank you very much in advance.
>>
>> > On 23 jul, 20:40, DanH  wrote:
>>
>> > > Close as I can tell, you use a BitmapFactory.Options and put a
>> > > BitmapConfig constant in that that specifies the type of internal
>> > > representation you want.  If you use ARGB_ then each pixel will be
>> > > 64 bits.  ARGB_ -- 32 bits, RGB_565 -- 16 bits.
>>
>> > > On Jul 23, 12:21 pm, ReyLith  wrote:
>>
>> > > > Thanks Nathan.
>>
>> > > > With this option I can obtain the image characteristics but I don't
>> > > > know the option that indicates me the depth of the pixel. Width and
>> > > > Height are in outWidth and outHeight but I don't know where is the
>> > > > depth. I thought use the getRowBytes() of Bitmap and product it with
>> > > > getHeight() of Bitmap, but I don't know if there is correct.
>>
>> > > > On 23 jul, 18:52, Nathan  wrote:
>>
>> > > > > If you can get the width and height for the image without completely
>> > > > > opening it, then use the width*height*depth.
>>
>> > > > > You probably have to use this option:
>>
>> > > > >http://developer.android.com/intl/de/reference/android/graphics/Bitma...
>>
>> > > > > Nathan
>>
>> > > > > On Jul 23, 9:30 am, ReyLith  wrote:
>>
>> > > > > > So, how can I obtain the depth for know if I can work with the 
>> > > > > > image?
>>
>> > > > > > On 23 jul, 18:18, DanH  wrote:
>>
>> > > > > > > The size of an image file depends greatly on the compression
>> > > > > > > techniques used to create it.  Virtually all image formats 
>> > > > > > > involve
>> > > > > > > some sort of compression such that the total number of bits in 
>> > > > > > > the
>> > > > > > > file is considerably less than the (width * height * depth) 
>> > > > > > > number
>> > > > > > > that represents the raw image.
>>
>> > > > > > > On Jul 23, 7:27 am, ReyLith  wrote:
>>
>> > > > > > > > Hi again,
>

Re: [android-developers] Re: What is a WeakReference?

2010-07-24 Thread Agus
GC can reclaim WeakReference even memory is still plenty, but
SoftReferences will only be cleared when the system is just about to
starve out of memory..

On Sat, Jul 24, 2010 at 2:25 PM, Joseph Earl  wrote:
> I did say '(although I would use SoftReference for the purpose
> described here).' But it wasn't clear enough I agree (and because I
> admittedly wasn't sure enough about the differences)
>
> On Jul 23, 4:25 pm, Matt Quigley  wrote:
>> On Jul 23, 2:37 am, Indicator Veritatis  wrote:
>>
>> > You left out something very important: the code hidden under "//
>> > reload the image" must not assume that it is not itself interrupted by
>> > yet another call to the garbage collector. That is, instead of simply
>> > continuing to use the soft/weak reference, it should make a strong
>> > reference to the same object, allowing this latter reference to either
>> > go out of scope or be set to null when it is done.
>>
>> You are referring to the code that Joseph Earl wrote above.  That code
>> snippet is NOT a proper way to use weak references; that cache should
>> be using soft references.
>>
>> On the other hand, in the example blog post referred to by the OP,
>> which uses weak references, that IS a proper way to use weak
>> references.  The main Activity already has a strong reference to the
>> objects.  The secondary thread does not need to create a strong
>> reference; in fact, that would make the weak reference useless.
>>
>> > But if we are making this strong reference, what was the point of
>> > using the weak/soft reference in the first place? Ah, that is the
>> > tricky thing about using them. Depending on when you can make and
>> > release the strong reference, they might not buy you much; they might
>> > not buy you anything at all. That is why they are not recommended for
>> > much outside of caches and normalized mappings.
>>
>> You are referring to a soft reference, not a weak reference.  Soft
>> references are good for caches.  Weak references are definitely
>> recommended for the idea given in the article, where the main thread
>> has a strong reference, and the background thread has a weak
>> reference.  That way if the main thread is killed (i.e. the app is
>> finished), if the background thread is still running then it won't
>> prevent the weakly referenced objects from being destroyed.
>>
>> I also hate to throw this bit of information into the mix, but it
>> should be known that Android will kill your process, and hence
>> background threads anyways, when all your main threads have been
>> destroyed (i.e. all your activities are finished, and there aren't any
>> services running).  This means that, even if you did have a background
>> thread running, it would be killed, implying that weak references
>> wouldn't help because everything is going to get killed anyways.  That
>> being said, there are still circumstances where the weak references
>> matter: just because one activity is finished, doesn't mean all of
>> your app's activities are necessarily finished.  So it would be good
>> if you went from your main activity into another sub-activity which
>> began a download.  But then the user presses back, because they don't
>> want to bother waiting on the download.  In that case your main
>> activity is still alive, but the background thread is working on the
>> sub-activity that was already finished.  If that background thread had
>> weak references, then that background thread would no longer be
>> holding on to the resources of the sub-activity with strong
>> references, and the system could GC those resources already, before
>> the background thread dies.
>>
>> -Matt
>>
>> -Matt
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: Problem: Long running AsyncTask with reference to Activity

2010-07-24 Thread Agus
Don't use WeakReference, use SoftReference.

On Sat, Jul 24, 2010 at 7:48 AM, RichardC
 wrote:
> Would using a WeakReference from your AsyncTask back to your activity
> help in any way?
>
> See discussion:
> http://groups.google.com/group/android-developers/browse_thread/thread/0732e2ec0039e92c#
>
>
> On Jul 24, 3:13 pm, Joseph Earl  wrote:
>> Ah OK. My bad.
>>
>> On Jul 24, 2:49 pm, Paul Turchenko  wrote:
>>
>> > Threads are not getting killed when activity is destroyed.
>>
>> > On Jul 24, 4:10 pm, Joseph Earl  wrote:
>>
>> > > Yup. Use a service for long running background tasks that do not
>> > > require an Activity to be present.
>> > > Threads started by an Activity are killed anyway when your Activity is
>> > > destroyed (or at least that's how it seems to me).
>> > > You can bind to your service from your Activity to control it.
>>
>> > > On Jul 24, 1:28 pm, sasq  wrote:
>>
>> > > > I have an AsyncTask that scans the file system and publishes progress
>> > > > through Notifications. To do this I need a reference to the current
>> > > > Activity in the AsyncTask.
>>
>> > > > I also don't want to kill the task when the activity is destroyed. How
>> > > > do I avoid leaking the activity and everything it references on each
>> > > > configuration change?
>>
>> > > > One possibility is to remove the reference in OnPause() to be sure it
>> > > > is gone when the Activity is destroyed, but that would mean
>> > > > notifications stops coming as soon as you leave the activity which is
>> > > > no good.
>>
>> > > > Isn't there a recommended way of dealing with AsyncTasks in this way?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Problem: Long running AsyncTask with reference to Activity

2010-07-24 Thread Agus
you can use the application context

On Sat, Jul 24, 2010 at 5:28 AM, sasq  wrote:
>
> I have an AsyncTask that scans the file system and publishes progress
> through Notifications. To do this I need a reference to the current
> Activity in the AsyncTask.
>
> I also don't want to kill the task when the activity is destroyed. How
> do I avoid leaking the activity and everything it references on each
> configuration change?
>
> One possibility is to remove the reference in OnPause() to be sure it
> is gone when the Activity is destroyed, but that would mean
> notifications stops coming as soon as you leave the activity which is
> no good.
>
> Isn't there a recommended way of dealing with AsyncTasks in this way?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Eclipse/Android environment issues

2010-07-23 Thread Agus
Try this :
on the top menu, open up the menu "Project"->Clean

On Fri, Jul 23, 2010 at 11:33 AM, jack.n  wrote:
> I can't seem to get rid of the following run/build error, but the
> Eclipse/Android environment won't give a clue how to fix it.
> Your project contains error(s), please fix them before running your
> application.
> This has happened a couple of times already and I've been able to
> repair it by cleaning and rebuilding, sometimes having to restarting
> eclipse, sometimes having to restart my pc, but now it won't budge.
> I've gone back to a known working version of my app to remove that
> unknown. Typically I can find project errors in the Eclipse Package
> explorer, but my code is fine according to the Package Explorer. Any
> ideas? Any other project debug tools? Is this a known Eclipse/Android
> environment issue?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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 set priorities for multiple BroadcastReceivers when dealing with ordered intent broadcast?

2010-07-23 Thread Agus
Thanks for the help. I'll RTFM more often.

On Fri, Jul 23, 2010 at 9:56 AM, Dianne Hackborn  wrote:
> It is definitely enforced for receives in the manifest...  I'd need to check
> for ones from registerReceiver(), but if it isn't it should be. :)
>
> On Thu, Jul 22, 2010 at 3:58 PM, Mark Murphy 
> wrote:
>>
>> On Thu, Jul 22, 2010 at 5:59 PM, Dianne Hackborn 
>> wrote:
>> > Set the priority integer in the IntentFilter you instantiate, or
>> >  in the manifest.  Note that the default priority is 0
>> > and
>> > apps can only request priorities <= 0.
>>
>> Are you sure? According to the docs, 100 is a valid priority for an
>> app and 100 is not <= 0.
>>
>> --
>> Mark Murphy (a Commons Guy)
>> http://commonsware.com | http://github.com/commonsguy
>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>
>> _The Busy Coder's Guide to Android Development_ Version 3.1 Available!
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>
> --
> 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

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

2010-07-23 Thread Agus
no, just declare your receiver in the manifest.

On Fri, Jul 23, 2010 at 12:40 AM, Kumar Bibek  wrote:
> You have to register the receivers in each of the activities.
>
> -Kumar Bibek
> http://tech-droid.blogspot.com
>
> On Jul 23, 11:12 am, Sandeep  wrote:
>> Hi All,
>>
>> I am working on one project where i am using broadcast receiver in one
>> of my activity to capture the incomming call and its works fine.
>> when one of my other activity is open and that time if call is come
>> then my broadcast receiver is fail to respond.
>> can any one help me for this ?
>> or its nessesorry to declare broadcast receiver in all my activity to
>> do some comman task.
>>
>> thanks & regards
>> sandeep
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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 set priorities for multiple BroadcastReceivers when dealing with ordered intent broadcast?

2010-07-22 Thread Agus
How do you set priority # for dynamically instantiated broadcast receivers?


On Thu, Jul 22, 2010 at 3:58 PM, Mark Murphy  wrote:
> On Thu, Jul 22, 2010 at 5:59 PM, Dianne Hackborn  wrote:
>> Set the priority integer in the IntentFilter you instantiate, or
>>  in the manifest.  Note that the default priority is 0 and
>> apps can only request priorities <= 0.
>
> Are you sure? According to the docs, 100 is a valid priority for an
> app and 100 is not <= 0.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.1 Available!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 set priorities for multiple BroadcastReceivers when dealing with ordered intent broadcast?

2010-07-22 Thread Agus
Hi all,

How to set a priority for multiple BroadcastReceivers when dealing
with ordered intent broadcast?

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

2010-07-18 Thread Agus
works fine on my Nexus One 2.2

On Sun, Jul 18, 2010 at 2:05 PM, Shane Isbell  wrote:
> Can someone with a Nexus One download AppFriend from android market (qr code
> - http://www.zappmarket.com/catalog/27) and give me a stack trace of the
> error message? I've got reports coming in that it crashes on startup (and
> the nice 1 star reviews that follow). The code that it is breaking on is
> really simple, so I'm not sure what the incompatibility could be, as it
> works on G1 and Magic. Thanks for any help.
>
> --
> Shane Isbell (Founder of ZappMarket)
> http://apps.facebook.com/zappmarket/
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Issue with starting two instances of an activity with flag Intent.FLAG_ACTIVITY_REORDER_TO_FRONT and a new extra information in the Intent does not override the original Intent.

2010-07-18 Thread Agus
Hi all,

When starting two activities of the same class within the same
instance using the flag REORDER_TO_FRONT, the new extra information of
the second call does not override the first starting activity. Is this
the desired behavior? How do retrieve the new extras?

For example:
In the StubActivity, I have this code: Intent i = new Intent(this,
A.class); i.putExtra("foobar",1); startActivity(i);

Activity A is displayed, and then this code is called upon a button
press: new Intent(this, A.class); i.putExtra("foobar",2);
i.setFlag(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(i);

Activity A is re-displayed. Now check for the extras:  int foobar =
getIntent().getExtras().getInt("foobar")

Turns out that foobar = 1

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


[android-developers] Where is source code (or git file) for ContactsContract.QuickContact

2010-07-15 Thread Agus
Hi all,

What is the .git file corresponding to ContactsContract.QuickContact class?

Agus.

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

2010-06-18 Thread Agus Hamonangan

Salam,


Agus Hamonangan



-Original Message-
From: ocdtrekkie 
Sender: android-developers@googlegroups.com
Date: Thu, 17 Jun 2010 22:01:30 
To: Android Developers
Reply-To: android-developers@googlegroups.com
Subject: [android-developers] Re: Smooth Image Rotation with Gesture Control?

Can anyone help get me started?  I can program all the logic I need
for my program really well, I just need some help with designing the
UI to function the way I want it to.

On Jun 1, 6:28 pm, ocdtrekkie  wrote:
> I'm trying to figure out the best way to make an image rotate along
> with a user's finger dragging it left or right.  I want to try and
> match the rate a user's finger is moving with the rate the image is
> rotating.
>
> I've got the basic setup for my application going, with the menus and
> whatnot I want to have, and that's all running great on the emulator,
> I'm just not sure how to approach this part.

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

2010-05-24 Thread Agus
What are the requirements for the position?

On Tue, May 25, 2010 at 12:46 AM, Phil Montgomery
 wrote:
> Hi all
>
> I know I've left my run a bit late for this summer, but if there are
> any students looking for intern roles over the summer who want to get
> involved in an exciting Android research project, then I have two
> positions available in the San Francisco bay area (Pleasanton on the
> East Bay to be precise).
>
> Majura (www.majura.com) was recently founded to build a completely new
> approach to device security - we've already been able to garner a lot
> of attention and significant funding.  We're looking for two interns
> right now to help complete our initial proof-of-concept.  We don't
> care about years of experience and a one inch thick resume - rather we
> want people that understand the new wave of non-PC devices, and of
> course know how to develop on these platforms - if you're really
> talented Linux programmer, we'll even teach you how to do Android
> development.  A mathematics background would be useful, as we have
> some heavy duty algorithms in our approach.
>
> A passion for the coming wave of non-PC devices is essential - we're
> not just building apps here, but a whole infrastructure service that
> is targeted at business (initially) and then consumers.  Android is
> just our initial platform, and we're planning to extend this to any
> system, such as Smartgrid. The founders are extremely experienced and
> have bought and sold numerous companies, building businesses from $0
> to >$100M in four years, and making people rich in the process.  We
> also like to have fun in the office and often have business meetings
> out on a hike in the nearby parks - none of those sterile silicon
> valley offices for us!
>
> I know the website is lame right now so don't complain.  And we're not
> hiring beyond interns right now, and do really need them local - once
> we kick this into the next phase we'll start general hiring.
>
> Look forward to hearing from you!
>
> Phil Montgomery
> Founder
> www.majura.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

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

2010-05-24 Thread Agus
Do you provide N-Visa for non-American citizen?

On Fri, May 21, 2010 at 12:44 PM, Anuj Garg wrote:

>  Hello,
>
> Greetings!!
> Hope you are doing very well.
> One of our clients based out of Herndon, VA has 3 positions for Android
> Developers. Below mentioned is the Job Description, Please go through it and
> send across your resume to a...@mystrasolutions.com if you look forward to
> take this one up.
>
> References of your friends and colleagues who might look to take it up are
> welcome.
>
> *Location::** **Herndon** , VA** **
> Type of Employment ::Full Time //C2H (As Preferred)
>
> Work Experience
> Minimum/General Experience:*
> Three to five years of experience with application development, with one to
> three years of experience with mobile applications. The candidate should
> have a good in depth knowledge of relational databases. Experience in
> consuming web services (SOAP/REST) and processing data (XML/JSON) is
> essential. The candidate should meet the following minimal qualifications:
>
> • 2+ years of experience with Java.
> • 2+ years of experience with Eclipse.
> • At least 1 year of experience with Android SDK.
> • At least 1 year of experience with WebServices.
>
> *Education and Training** ***
>
> *Minimum Education:*
> Bachelor’s degree in computer science, information systems, mathematics,
> physics or related discipline.
>
> I look forward to a quick response from you.
>
> Thanks
>
> Anuj Garg
>
> Mystra Solutions
> Phone: 732 659 1244
> Email:  a...@mystrasolutions.com
> Web:   www.mystrasolutions.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

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

[android-developers] BitmapFactory.decodeStream thread safe ?

2010-05-07 Thread Agus
Is the BitmapFactory.decodeStream method thread safe?

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


[android-developers] Is there a way to view app memory usage in Nexus One while in authoring mode?

2010-05-02 Thread Agus
Dear all,

Is there a way to view app memory usage, threads on Nexus One while in
authoring mode? Is it even supported since I am not sure Nexus One is
a dev phone or not.

Agus.

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

2010-04-09 Thread Agus
You are using convertView object which is a recycled view.

On Thu, Apr 8, 2010 at 2:42 AM, Binesy  wrote:

> Hi,
>
> I have been having some strange behavior when refreshing a listview
> from a button in a list item.  Say you have a list of 4 items, indexes
> 0-3 and you click on item 4, and print the index.  3 is printed
> correctly, then i refresh the list.  I click on item 4 again, but this
> time index 0 is printed, click again and we are back to 3.  Why is
> this happening and how can I fix it?
>
> I have included some source below for you to have a look at how I have
> done this.  Any help is much appreciated
>
> Binesy
>
> public class CrazyList extends Activity {
>
>private static final String TAG = "CRAZY LIST";
>
>public class Item {
>public String name = null;
>public int counter = -1;
>
>public Item(String n) {
>name = n;
>counter = 0;
>}
>}
>
>private ArrayList names = null;
>private MyAdapter adapter = null;
>
>
>@Override
>public void onCreate(Bundle savedInstanceState) {
>super.onCreate(savedInstanceState);
>setContentView(R.layout.main);
>
>names = new ArrayList();
>names.add(new Item("Ross"));
>names.add(new Item("Fred"));
>names.add(new Item("Bob"));
>names.add(new Item("Frank"));
>
>ListView list = (ListView)findViewById(R.id.ListView01);
>adapter = new MyAdapter();
>list.setAdapter(adapter);
>}
>
>private void updateButtonText(int index) {
>names.get(index).counter++;
>adapter.notifyDataSetChanged();
>}
>
>private class MyAdapter extends BaseAdapter {
>
>@Override
>public int getCount() {
>return names.size();
>}
>
>@Override
>public Object getItem(int position) {
>return names.get(position);
>}
>
>@Override
>public long getItemId(int position) {
>return position;
>}
>
>@Override
>public View getView(int position, View convertView,
> ViewGroup
> parent) {
>Container c = null;
>
>if(convertView == null) {
>convertView =
> View.inflate(getApplicationContext(), R.layout.item,
> null);
>c = new Container();
>
>c.text = (TextView)
> convertView.findViewById(R.id.TextView01);
>c.button = (Button)
> convertView.findViewById(R.id.Button01);
>c.button.setTag(position);
>
>c.button.setOnClickListener(new
> OnClickListener() {
>
>@Override
>public void onClick(View v) {
>int number =
> (Integer)v.getTag();
>Log.d(TAG, "Button clicked
> is " + number);
>updateButtonText(number);
>}
>});
>
>convertView.setTag(c);
>}
>else
>c = (Container) convertView.getTag();
>
>c.text.setText(names.get(position).name);
>c.button.setText(names.get(position).counter + "");
>
>return convertView;
>}
>
>public class Container {
>public TextView text = null;
>public Button button = null;
> }
>}
> }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
> To unsubscribe, reply using "remove me" as the subject.
>

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

2010-04-09 Thread Agus
Have you tried launching a thread inside your Service and have your Service
binded/started in the Application context?

On Fri, Apr 9, 2010 at 5:23 AM, Jason LeBlanc wrote:

> I have a scenario where I start a Service from a splash screen. If I
> intentionally cause problems in that Service (such as an invalid port for
> the Socket connection) my UI Thread locks up. I have put a Timer in the
> Service, and have it perform logging at every tick. The Timer works from
> within the Service without flaw. So from that, I think I have determined
> that only the UI Thread is suffering.
>
> If I start a Service from an Activity and that Service has an issue (i.e.
> server connection problems), should that result in a lockup in the UI thread
> from which it was launched?
>
>  Is there a technique for starting a Service and having it truly run in
> the background?
>
> Thanks,
> J
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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

To unsubscribe, reply using "remove me" as the subject.


Re: [android-developers] How to parse JSON in Java?

2010-04-07 Thread Agus
new JSONObject(YOUR_JSON_TEXT);

On Wed, Apr 7, 2010 at 2:05 AM, Maxood  wrote:

> I have the following JSON text that i need to parse to get pageName,
> pagePic, post_id, etc. What is the required code?
> pageInfo: {
> pageName: abc
> pagePic: http://profile.ak.fbcdn.net/object2/367/…
> }
> posts: [
> {
> post_id: 160119538822_302076968822
> actor_id: 1183856639
> picOfPersonWhoPosted: http://profile.ak.fbcdn.net/hprofile-ak-…
> nameOfPersonWhoPosted: Andrea Raquel
> message: Sounds cool. Can't wait to see it!
> likesCount: 2
> comments: [
> ]
> timeOfPost: 1266036226
> }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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

To unsubscribe, reply using "remove me" as the subject.


Re: [android-developers] Re: The auto-generated R.java generation is invalid. Can't compile a new APK.

2010-03-18 Thread Agus
Interestingly, if i delete the bin folder, the Android plugin generates the
apk automatically just fine. but the R.java is still invalid.

On Thu, Mar 18, 2010 at 12:48 AM, Maps.Huge.Info (Maps API Guru) <
cor...@gmail.com> wrote:

> Try deleting the R.java source file. That usually clears this problem.
>
> -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

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: The auto-generated R.java generation is invalid. Can't compile a new APK.

2010-03-18 Thread Agus
I did. I generates the same R.java with errors.

On Thu, Mar 18, 2010 at 12:48 AM, Maps.Huge.Info (Maps API Guru) <
cor...@gmail.com> wrote:

> Try deleting the R.java source file. That usually clears this problem.
>
> -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

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

[android-developers] The auto-generated R.java generation is invalid. Can't compile a new APK.

2010-03-18 Thread Agus
Hi all,

When I opened my old project, but surprisingly it generates non-compilable
R.java ,

I have checked all layout xml files for incorrect id attribute of this form:
android:id="@+id/", and found out that I am using all the the correct
values.

In the auto-generated R.java, it has this line:

public static final int =0x7f0b0027;

I am clueless, i need to get compile a new APK and I am stuck with this tiny
issue.

Agus.

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

[android-developers] Google Checkout Finally Arrives in Canada?

2010-03-16 Thread Agus
Based on todays' news Canadians can buy paid apps from the Market. Can
anyone (from Google) confirm if Google Checkout finally work for Canadian
users?

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

2009-12-25 Thread Agus
How to check available RAM storage inside an application?

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

[android-developers] Which one is more efficient, ImageView.setImageBitmap(bitmap) or ImageView.setImageDrawable(drawable)?

2009-12-24 Thread Agus
Which one these two ImageView methods is more efficient,
ImageView.setImageBitmap(bitmap) or ImageView.setImageDrawable(drawable)?

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

[android-developers] Is there a built-in view class to implement the view flipping behavior similar to the Android home screen?

2009-12-24 Thread Agus
Is there a built-in view class to implement the view flipping behavior
similar to the Android home screen?

(Other than the gallery view)

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] ListView methods invalidate() versus invalidateViews()

2009-12-23 Thread Agus
Hi all,

What's the functional difference between these listview methods:
invalidate() and invalidateViews()  ?
Which one is faster to refresh a listview?

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] A question regarding AsyncTasks

2009-12-21 Thread Agus
No you don't wait for the 1st to finish, just create another instance of
AsyncTask.  The implementation of AsyncTask uses pooled threads

On Mon, Dec 21, 2009 at 2:23 AM, Android Development wrote:

> Hello,
>
> In the documentation, I read that it is not possible for executing 2 Async
> Tasks. If execute is called again, it should throw an exception.
>
> The following is given under the heading of "Threading Rules", and i
> quote:
>
> "The task can be executed only once (an exception will be thrown if a
> second execution is attempted.)"
>
> I wish to understand the meaning of this statement.
>
> Does this mean, that if i try and execute the same task twice
> (concurrently) when the first execution of the task was still going on...an
> exception will be thrown ? Will i need to wait for the completion of the
> first task, before i spawn a second task ?
>
> A possible use case:
>
> The user wishes to download a set of files. He clicks on the download
> button by providing the URL. When the first download is still going on, he
> wishes to download another file and provides another URL. Both these user
> actions are serviced by a DownloadTask, that extends the AysncTask.
>
> If i wish to change this default behavior, is there a configuration option
> ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Example of formatted text as an XML resource?

2009-12-20 Thread Agus
Example of formatted text as an XML resource?

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

[android-developers] What is the maximum number of threads allowed per application?

2009-12-20 Thread Agus
What is the maximum number of threads allowed per application?

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

2009-12-18 Thread Agus
use xmlpullparser much easier

On Fri, Dec 18, 2009 at 5:50 PM, redders  wrote:

> Okay, so I know that the parse() method takes an inputsource, and
> normally it'd be better to parse the xml at the source (where it's a
> stream), but in this case I want to be parsing it on a different
> thread to the thread it's being received on.
>
> My question is basically a "why won't this work" question...
> As far as I can tell, the startElement method is never being called
> (no "startelement" entries in logcat after "trying to parse..")
> .. any help appreciated.
>
> Here's the code.
>
> public class NWCommsXMLParser extends DefaultHandler{
>public void startElement(String uri, String name, String qName,
> Attributes atts){
>Log.i("NWXML","startelement: " + uri + "." + name + "." +
> qName +
> "/" + atts.toString());
>}
>public void endElement(String uri, String name, String qName){
>
>}
>public void characters(char ch[], int start, int length) {
>
>}
>public void parseMessage(String xmlMessage){
>
>Log.i("NWXML","Trying to parse: " + xmlMessage);
>try{
>SAXParserFactory parseFactory =
> SAXParserFactory.newInstance();
>SAXParser parser = parseFactory.newSAXParser();
>XMLReader xmlReader = parser.getXMLReader();
>xmlReader.setContentHandler(this);
>StringReader sr = new StringReader(xmlMessage);
>InputSource is = new InputSource(sr);
>xmlReader.parse(is);
>}
>catch(Exception e){
>Log.e("NanoWarsXML","SAX error:" + e);
>}
>}
> }
>
>
> Logcat line before the try{} :
> 12-19 01:31:38.763: INFO/NWXML(3218):
> Trying to parse:
>  12344787645 NWR>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Help! How to create tiled drawable from xml? (Poor documentation of this on the official developer site)

2009-12-17 Thread Agus
Thanks a lot :)

On Thu, Dec 17, 2009 at 1:21 PM, Romain Guy  wrote:

>
> http://code.google.com/p/shelves/source/browse/trunk/Shelves/res/drawable/background_paper.xml
>
> On Thu, Dec 17, 2009 at 11:53 AM, Agus  wrote:
> > Hi all,
> >
> > I need to create a tiled drawable using BitmapDrawable but I need to
> create
> > it from xml resource rather than code.
> >
> > 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
>
>
>
> --
> 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
>

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

[android-developers] Is the Drawable.createFromStream(..) thread-safe?

2009-12-17 Thread Agus
Is Drawable.createFromStream() thread-safe?

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

2009-12-17 Thread Agus
bump

On Fri, Oct 16, 2009 at 1:39 AM, Lazarus 101  wrote:

>
> Just got this exception on 1.6 emulator. Everything in my database was
> lost, the db file was still there but the tables were gone. Did anyone
> else experienced this? What might have caused this? I hope this is
> just an emulator bug...
>
> E/Database(  876): Failed to setLocale() when constructing, closing
> the
> database
> E/Database(  876):
> android.database.sqlite.SQLiteDatabaseCorruptException: database disk
> image is malformed
> E/Database(  876):  at
> android.database.sqlite.SQLiteDatabase.native_setLocale(Native
> Method)
> E/Database(  876):  at
> android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:
> 1637)
> E/Database(  876):  at
> android.database.sqlite.SQLiteDatabase.(SQLiteDatabase.java:
> 1587)
> E/Database(  876):  at
> android.database.sqlite.SQLiteDatabase.openDatabase
> (SQLiteDatabase.java:638)
> E/Database(  876):  at
> android.database.sqlite.SQLiteDatabase.openOrCreateDatabase
> (SQLiteDatabase.java:659)
> ...
> E/Database(  876):  at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1123)
> E/Database(  876):  at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2364)
> E/Database(  876):  at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> 2417)
> E/Database(  876):  at android.app.ActivityThread.access$2100
> (ActivityThread.java:
> 116)
> E/Database(  876):  at android.app.ActivityThread$H.handleMessage
> (ActivityThread.java:
> 1794)
> E/Database(  876):  at android.os.Handler.dispatchMessage
> (Handler.java:
> 99)
> E/Database(  876):  at android.os.Looper.loop(Looper.java:
> 123)
> E/Database(  876):  at android.app.ActivityThread.main
> (ActivityThread.java:
> 4203)
> E/Database(  876):  at java.lang.reflect.Method.invokeNative
> (Native
> Method)
> E/Database(  876):  at java.lang.reflect.Method.invoke(Method.java:
> 521)
> E/Database(  876):  at com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:
> 791)
> E/Database(  876):  at com.android.internal.os.ZygoteInit.main
> (ZygoteInit.java:
> 549)
> E/Database(  876):  at dalvik.system.NativeStart.main(Native
> Method)
> E/Database(  876): Deleting and re-creating corrupt database /data/
> data/com.test/test.db
> E/Database(  876):
> android.database.sqlite.SQLiteDatabaseCorruptException: database disk
> image is malformed
> E/Database(  876):  at
> android.database.sqlite.SQLiteDatabase.native_setLocale(Native
> Method)
> E/Database(  876):  at
> android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:
> 1637)
> E/Database(  876):  at
> android.database.sqlite.SQLiteDatabase.(SQLiteDatabase.java:
> 1587)
> E/Database(  876):  at
> android.database.sqlite.SQLiteDatabase.openDatabase
> (SQLiteDatabase.java:638)
> E/Database(  876):  at
> android.database.sqlite.SQLiteDatabase.openOrCreateDatabase
> (SQLiteDatabase.java:659)
> ...
> E/Database(  876):  at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1123)
> E/Database(  876):  at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2364)
> E/Database(  876):  at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> 2417)
> E/Database(  876):  at android.app.ActivityThread.access$2100
> (ActivityThread.java:
> 116)
> E/Database(  876):  at android.app.ActivityThread$H.handleMessage
> (ActivityThread.java:
> 1794)
> E/Database(  876):  at android.os.Handler.dispatchMessage
> (Handler.java:
> 99)
> E/Database(  876):  at android.os.Looper.loop(Looper.java:
> 123)
> E/Database(  876):  at android.app.ActivityThread.main
> (ActivityThread.java:
> 4203)
> E/Database(  876):  at java.lang.reflect.Method.invokeNative
> (Native
> Method)
> E/Database(  876):  at java.lang.reflect.Method.invoke(Method.java:
> 521)
> E/Database(  876):  at com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:
> 791)
> E/Database(  876):  at com.android.internal.os.ZygoteInit.main
> (ZygoteInit.java:
> 549)
> E/Database(  876):  at dalvik.system.NativeStart.main(Native
> Method)
>
> E/Database(  876): Failure 1 (no such table: app_data) on 0x1d0b68
> when preparing 'DELETE from app_data WHERE key='102''.
> --~--~-~--~~~---~--~~
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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 De

  1   2   >