[android-developers] How to get Android connected to the Internet through sl0 (slip, serial line Internet protocol)

2016-03-22 Thread 'Dirk Petrautzki' via Android Developers
i want to connect my Android device to the Internet via a serial line (the 
serial line will be a point to point air link later, but for first Tests i'm 
just using two connected FTDIs).

What i've done so far is testing the slip link with two Linux machines, that 
are connected together via two FTDIs and one oft them forwards the Internet 
traffic of the other one. This works flawlessly.

AS next step i've build a custom kernel with the ftdi-sio module, installed 
busybox and configured the slip link like before on the Linux machines. Ping 
with IPs works and nslookup with a hostname also works as root, but not as 
normal user. Routing table of Route command is configured to be the same as 
before.

My question now is how to tell Android to use the New slip link sl0 for 
Internet connection for normal user.

Kind regards

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/39f04114-c954-4911-8ef9-4771b7e015a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: Wii Balance Board and Android (already paired) - how to get Data

2016-03-03 Thread Dirk Bellstaedt
It does not work with devices >4.2

Am Mittwoch, 2. März 2016 10:26:26 UTC+1 schrieb Dirk Bellstaedt:
>
> Hello,
>  i want to use Wii Balance Board with my Android Device, i already paired 
> it with my Device ( rooted Custom Rom, but i don't know how, it just worked 
> ;) ),
>  but now i don't know how to grab the RawData of the InputDevice? Is there 
> any way to get it?
> Best Regards
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/bcd7d116-df6b-486a-b98c-fa15c35b03af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Bluetooth Sniffer

2016-03-03 Thread Dirk Bellstaedt
Hi,
Is it possbile to listen to the System Bluetooth Socket to Sniff all In- 
and Outgoing Bluetooth Packages?
Or to listen to a single Bluetooth Connection of a device?
Best Regards

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/ee0af530-b7d5-40b3-bbc1-194ea7f207ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Wii Balance Board and Android (already paired) - how to get Data

2016-03-02 Thread Dirk Bellstaedt
Hello,
 i want to use Wii Balance Board with my Android Device, i already paired 
it with my Device ( rooted Custom Rom, but i don't know how, it just worked 
;) ),
 but now i don't know how to grab the RawData of the InputDevice? Is there 
any way to get it?
Best Regards


-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/0fece391-1847-4bee-b0c2-da78753c9c03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Wii Balance Board and Android (already paired) - how to get Data

2016-03-02 Thread Dirk Bellstaedt
Hello,
 i want to use Wii Balance Board with my Android Device, i already paired 
it with my Device ( rooted Custom Rom, but i don't know how, it just worked 
;) ),
 but now i don't know how to grab the RawData of the InputDevice? Is there 
any way to get it?
Best Regards


-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/3f438401-3e38-45ff-a92f-bc435b4eeddb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] How many TCP connection are alive in android device

2013-09-23 Thread Dirk Jäckel
Hi!

Do you have enough power for the device so it can run 24/7 without
sleeping? i.e. an external battery or power source?

If not, have a look at this example using MQTT. It worked for me but I
am not sure about the licensing of the wmqtt.jar.

http://dalelane.co.uk/blog/?p=1599&cpage=1

It should be possible to adapt this strategy to XMPP.

It boils down to this:

- create a service (make it sticky)
- Create a tcp connection (to a server)
- Register Broadcast Receiver for network connectivity changes and alarm
after 20 minutes (or more/less depending on NAT timeouts of your network
provider)
- Schedule an alarm (to send keepalive packet)
- Go to sleep
- When alarm is triggered: send ping (sleep again)
- When network is lost: cleanup (sleep again)
- When message comes in: handle message (sleep again)
- When connectivity is restored: reconnect (sleep again)

The problem with the paho and the fusecore mqtt-client implementation
is, that they do not allow sending a ping request "manually". So you
have to either patch them or send a bigger publish packet.

Regards,
Dirk


> danaimset <mailto:danaim...@gmail.com>
> 20. September 2013 08:32
> Hi all!
>
> I'm working with one very wide project and we need to support 24/7
> connection with device. 
> This project is for custom ROM and we will not have Google apps installed.
> We are thinking about performance. Maybe someone could help us with
> the following questions:
> How many TCP connections Google Services keep in android ? And what is
> the best practices.
>
> We need to have realtime support for all our components that will be
> controlled through the web admin.
> So we'll have to implement our own Cloud Messaging. We concentrated on
> XMPP solution that we may know.
>
> Maybe someone could suggest the best approach.
>
> Thank you,
> Dan.
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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 unsubscribe from this group and stop receiving emails from it, send
> an email to android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

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


[android-developers] Re: How to keep WiFi on and let screen go to sleep?

2013-04-11 Thread dirk
My information is a few years old, but at the time I was writing a VOIP app 
and ran into a similar issue. The problem I faced is that when the screen 
goes off, the WiFi goes into a low power mode called power save polling 
(PSP), where the WiFi is still active, but latency is very high (which 
kills a VOIP app). As in your case, none of the solutions you tried worked 
other than keeping the screen on. The best I could do was set the screen 
color to black, and dimmed the screen to it's lowest setting. 

PSP mode is discussed here: 
http://code.google.com/p/android/issues/detail?id=9781.

Your case seems slightly different in that the TCP connection is actually 
closed. This sounds like a device specific problem, or a particular 
incompatibility between your device and router. Have you tried a different 
router to see if it helps? Also, if it is the PSP issue, I recall it being 
fixed in some custom ROM (sorry, I don't recall where anymore).

Hope this helps,
Dirk

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Writing to External SD

2012-08-28 Thread Dirk Vranckaert
I have an issue with writing on external SD...

Writing on the external SD as Google puts it is not difficult 
with Environment.getExternalStorageDirectory().
However I want to make a difference for my users so they can choose to 
either backup their data to the 'on device' external memory and the 'SD 
Card' the user put in the device (if any).

If both are available the Environment.getExternalStorageDirectory() method 
always gives me the SD memory build in the device.
If only the SD-card is present I have the SD-card reference.
Currently I solved it by letting the user manually enter the location URI 
of the SD-card, but that's not user-friendly at all so I'dd rather have a 
way to just let them choose between 'On device storage' and 'SD-card 
storage' and let me retrieve the URI myself...

Is there a clean way (or maybe a library) to do so?

Kr,

Dirk

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

2012-07-18 Thread Dirk Vranckaert
I solved my own issue...

I was setting some flags on my intent:
Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NO_HISTORY 
| Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK;

But when using the FLAG_ACTIVITY_NO_HISTORY, my activity that is launched 
is not kept in the activity-stack, meaning when I start from that 
'invisible' activity another activity 'for-result' I can never com back in 
the onActivityResult because it doesn't know where to go... So my activity 
gets killed and nothing happens.

If run my original code without the flag  FLAG_ACTIVITY_NO_HISTORY it works 
perfect...

Thanks for the help anyway (and sorry for my mistake ;) ) and happy coding! 
:)

Kr

Dirk

Op woensdag 18 juli 2012 09:25:14 UTC+2 schreef Dirk Vranckaert het 
volgende:
>
> And also.. If I do not use FLAG_UPDATE_CURRENT, then what flag(s) should I 
> define?
>
> Op woensdag 18 juli 2012 09:23:57 UTC+2 schreef Dirk Vranckaert het 
> volgende:
>>
>> It always worked find to just pass the extras (in fact it's not only the 
>> widget ID that i'm passing, there is some other stuff in there to..). It 
>> since the launced activity starts another activity for result it doesn't 
>> work anymore... So I guess using the extras or the data element won't make 
>> a difference. I even tried to launch the activity without passing anything 
>> and still my onActivityResult method is not reached...
>>
>> So what I currently do is nothing more than this (so without any extras):
>> Intent intent = new Intent(ctx, activity);
>> PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 
>> widgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
>>
>> So then what do you mean with create different actions?
>>
>> Do you mean to create different pendingIntents (so with a different 
>> requestCode, something like "start" + widgetId and "stop" + widgetId) or do 
>> you mean to create two different activities (cause that is whay I already 
>> have, a start- and stop-activity)?
>>
>> Op woensdag 18 juli 2012 09:14:21 UTC+2 schreef TreKing het volgende:
>>>
>>> On Wed, Jul 18, 2012 at 2:13 AM, TreKing  wrote:
>>>
>>>> This makes each PendingIntent unique and they wrote overwrite each other
>>>
>>>
>>> This makes each PendingIntent unique and they *won't* overwrite each 
>>> other.
>>>
>>>
>>> -
>>> 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

Re: [android-developers] PendingIntent launched from widget causes onActivityResult to not be called

2012-07-18 Thread Dirk Vranckaert
And also.. If I do not use FLAG_UPDATE_CURRENT, then what flag(s) should I 
define?

Op woensdag 18 juli 2012 09:23:57 UTC+2 schreef Dirk Vranckaert het 
volgende:
>
> It always worked find to just pass the extras (in fact it's not only the 
> widget ID that i'm passing, there is some other stuff in there to..). It 
> since the launced activity starts another activity for result it doesn't 
> work anymore... So I guess using the extras or the data element won't make 
> a difference. I even tried to launch the activity without passing anything 
> and still my onActivityResult method is not reached...
>
> So what I currently do is nothing more than this (so without any extras):
> Intent intent = new Intent(ctx, activity);
> PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 
> widgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
>
> So then what do you mean with create different actions?
>
> Do you mean to create different pendingIntents (so with a different 
> requestCode, something like "start" + widgetId and "stop" + widgetId) or do 
> you mean to create two different activities (cause that is whay I already 
> have, a start- and stop-activity)?
>
> Op woensdag 18 juli 2012 09:14:21 UTC+2 schreef TreKing het volgende:
>>
>> On Wed, Jul 18, 2012 at 2:13 AM, TreKing  wrote:
>>
>>> This makes each PendingIntent unique and they wrote overwrite each other
>>
>>
>> This makes each PendingIntent unique and they *won't* overwrite each 
>> other.
>>
>>
>> -
>> 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

Re: [android-developers] PendingIntent launched from widget causes onActivityResult to not be called

2012-07-18 Thread Dirk Vranckaert
It always worked find to just pass the extras (in fact it's not only the 
widget ID that i'm passing, there is some other stuff in there to..). It 
since the launced activity starts another activity for result it doesn't 
work anymore... So I guess using the extras or the data element won't make 
a difference. I even tried to launch the activity without passing anything 
and still my onActivityResult method is not reached...

So what I currently do is nothing more than this (so without any extras):
Intent intent = new Intent(ctx, activity);
PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 
widgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT);

So then what do you mean with create different actions?

Do you mean to create different pendingIntents (so with a different 
requestCode, something like "start" + widgetId and "stop" + widgetId) or do 
you mean to create two different activities (cause that is whay I already 
have, a start- and stop-activity)?

Op woensdag 18 juli 2012 09:14:21 UTC+2 schreef TreKing het volgende:
>
> On Wed, Jul 18, 2012 at 2:13 AM, TreKing  wrote:
>
>> This makes each PendingIntent unique and they wrote overwrite each other
>
>
> This makes each PendingIntent unique and they *won't* overwrite each 
> other.
>
>
> -
> 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

Re: [android-developers] PendingIntent launched from widget causes onActivityResult to not be called

2012-07-17 Thread Dirk Vranckaert
I do indeed need that.

What I'm trying to do is:
1) I have a widget with a button, on the button I want to put the 
PendingIntent that I showed in my first post.
2) Then when the user presses that button, an action happens (something is 
started), and I want to change the PendingIntent on the button to something 
new (another activity and different extras) in order to create a 'stop' 
button
3) When the stop button is pressed I again change the PendingIntent to the 
one from step 1

So to achieve that I found out that I have to use a PendingIntent, but or 
the id of the pending-intent I use the id of the widget (because per widget 
the user needs to be able to start the process). And I do that I have to 
use the FLAG_UPDATE_CURRENT, so the pending intent is updated (and not 
removed or whatever) when the user presses the button.
A second reason to use the FLAG_UPDATE_CURRENT is to not loose the 
PendingIntent when it's fired once. Whit this I mean when the user presses 
the button, he can still cancel his action (in the activity that opened he 
just presses the back button of the device). But doing this with the 
PendingIntent.FLAG_ONE_SHOT will make that when the user presses again that 
button on the widget my activity is no longer executed. Or should I do this 
another way...?

Op dinsdag 17 juli 2012 21:14:18 UTC+2 schreef TreKing het volgende:
>
> On Tue, Jul 17, 2012 at 8:35 AM, Dirk Vranckaert  > wrote:
>
>> However if I start it with the PendingIntent with the flag set to 
>> PendingIntent.FLAG_UPDATE_CURRENT part of my flow is not executed anymore
>>
>
> Why are you using UpdateCurrent? Do you have extras in the intent that 
> need to be updated?
>
>
> -
> 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

[android-developers] PendingIntent launched from widget causes onActivityResult to not be called

2012-07-17 Thread Dirk Vranckaert
I have an issue with one of my applications that is using a PendingIntent 
to launch an activity from a widget...

This is the piece of code that does the trick:
PendingIntent pendingIntent = PendingIntent.getActivity(ctx, widgetId, 
intent, PendingIntent.FLAG_UPDATE_CURRENT);
views.setOnClickPendingIntent(resId, pendingIntent);

Now let me explain you the cases:

This is the flow it should do:
[Widget]
-> Click button, launch activity
[StartTimeRegistrationActivity]
-> task needs to be selected so start TaskSelectionActivity for result 
automatically
[TaskSelectionActivity]
<- Task selected, so the TaskSelectionActivity is finished and coming back 
in the onActivityResult
-> Do some automated stuff in this activity
<- Finish the activity (so finish() and go into onDestroy())
If, from somewhere in my application, I start the activity manually (so 
without a pending intent) it's started correctly and executes correctly.

However if I start it with the PendingIntent with the flag set to 
PendingIntent.FLAG_UPDATE_CURRENT part of my flow is not executed anymore, 
specifically the onActivityResult of the StartTimeRegistrationActivity. So 
this becomes the flow:
[Widget]
-> Click button, launch activity
[StartTimeRegistrationActivity]
-> task needs to be selected so start TaskSelectionActivity for result 
automatically
[TaskSelectionActivity]
<- Task selected, so the TaskSelectionActivity is finished, but not coming 
in the onActivityResult but directly to the onDestory() method (not passing 
the finish() method anywhere)
If I change the pending intent to use the flag PendingIntent.FLAG_ONE_SHOT 
the flow is executed correctly. But then, when the 
StartTimeRegistrationActivity is open, and the user presses the back-button 
to cancel his action (a case that is perfectly acceptable for this 
application) he cannot click the button anymore because the 
PendingIntent.FLAG_ONE_SHOT declares that it will be automatically 
cancelled as soon as the send() method is called once on it.

So any ideas here how to work around it?

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

Re: [android-developers] AsyncTask in Android 4.0

2012-05-16 Thread Dirk Jäckel
On Friday, April 20, 2012 11:39:51 PM UTC+2, Dianne Hackborn wrote:
>
> Sorry yes it is API 13, I turned around the logic of the code when I 
> glanced at it:
>
> // If the app is Honeycomb MR1 or earlier, switch its AsyncTask
> // implementation to use the pool executor.  Normally, we use the
> // serialized executor as the default. This has to happen in the
> // main thread so the main looper is set right.
>
>
Please document this here: 
https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#HONEYCOMB_MR2

Or is there a better place for developers to stay informed what a 
targetSDKVersion change means for their app?

Regards,
Dirk

 

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

2012-05-16 Thread Dirk Jäckel
On Saturday, April 21, 2012 12:52:17 AM UTC+2, b0b wrote:
>
>
> > Conclusion: there's probably man apps broken in subtle ways on ICS 
>> because
>> > of this change.
>>
>> Probably not, only because they have to explicitly set the
>> targetSdkVersion to 13+, and I don't know how many people are setting
>> it that high.
>>
>
> Bumping targetSdkVersion to the latest version is something very common 
> and generally harmless.
>

And recommended by developer relations advocates.
 

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

2012-04-05 Thread Dirk Vranckaert
I've been looking into this issue some more and still cannot find out how 
to fix it.
But one thing is for sure, the libraries for my app (which are in the 
'libs' directory) are not included in the ant-build for testing.
Here are two screenshots of a decompile.
The first screenshot shows you a decompile of the application that I 
manually build using my IDE. You can see that it includes my libraries 
(Roboguice for example)



On the second screenshot you can see a decompile of the APK that Ant 
generated during the test-build:



That one does not contain the libraries (no Roboguice for example) that I 
need for the app, only some testing libraries...

But the libraries are in the 'libs' directory so what else can I do to 
enforce them to be taken into account?

Also when I do a release with Ant and I decompile the generated APK file 
the result is the same in the first screenshot (so included the 
libraries...!)


I'm desperate on this one ;) Please someone...

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

2012-04-05 Thread Dirk Vranckaert
If you'dd like to test something yourself, the code is available at 
http://code.google.com/p/worktime/source

Op donderdag 5 april 2012 07:24:52 UTC+2 schreef Dirk Vranckaert het 
volgende:
>
> In my application I use RoboGuice and the configuration for RoboGuice 
> requires to add an Application-class and specify it in the 
> AndroidManifest.xml file in the application-tag using the 'android:name' 
> attribute.
>
> So this is how my applicaiton-tag in the manifest looks like:
>
>  android:name=".guice.Application">
>
> This always works and still does when I compile inside my IDE (IntelliJ) 
> and deploy it to my device. However when I want to run my tests using Ant 
> (and only via Ant, this also still works in the IDE) I have this error on 
> the console:
>
> [exec] 
> android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests:INSTRUMENTATION_RESULT:
>  
> shortMsg=Unable to instantiate application 
> eu.vranckaert.worktime.guice.Application: java.lang.ClassNotFoundException: 
> eu.vranckaert.worktime.guice.Application in loader 
> dalvik.system.PathClassLoader@44e88928 [exec] INSTRUMENTATION_RESULT: 
> longMsg=java.lang.RuntimeException: Unable to instantiate application 
> eu.vranckaert.worktime.guice.Application: java.lang.ClassNotFoundException: 
> eu.vranckaert.worktime.guice.Application in loader 
> dalvik.system.PathClassLoader@44e88928
>
> The ant statement I execute is:
>
> ant all clean emma debug install test 
>
> This has worked before but started failing since I upgraded my 'Android 
> SDK Tools' to revision 17 and the 'Android SDK Platform-tools' to revision 
> 11.
>
> Anyone who had this issue also or who knows how to fix it
>

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

[android-developers] Ant build fails since upgrading SDK to latest revision

2012-04-04 Thread Dirk Vranckaert


In my application I use RoboGuice and the configuration for RoboGuice 
requires to add an Application-class and specify it in the 
AndroidManifest.xml file in the application-tag using the 'android:name' 
attribute.

So this is how my applicaiton-tag in the manifest looks like:



This always works and still does when I compile inside my IDE (IntelliJ) 
and deploy it to my device. However when I want to run my tests using Ant 
(and only via Ant, this also still works in the IDE) I have this error on 
the console:

[exec] 
android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests:INSTRUMENTATION_RESULT:
 
shortMsg=Unable to instantiate application 
eu.vranckaert.worktime.guice.Application: java.lang.ClassNotFoundException: 
eu.vranckaert.worktime.guice.Application in loader 
dalvik.system.PathClassLoader@44e88928 [exec] INSTRUMENTATION_RESULT: 
longMsg=java.lang.RuntimeException: Unable to instantiate application 
eu.vranckaert.worktime.guice.Application: java.lang.ClassNotFoundException: 
eu.vranckaert.worktime.guice.Application in loader 
dalvik.system.PathClassLoader@44e88928

The ant statement I execute is:

ant all clean emma debug install test 

This has worked before but started failing since I upgraded my 'Android SDK 
Tools' to revision 17 and the 'Android SDK Platform-tools' to revision 11.

Anyone who had this issue also or who knows how to fix it

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

[android-developers] Re: Writing files in UTF-8

2012-03-30 Thread Dirk Vranckaert
Ooh great, didn't think about that.
Now it works perfect! Thanks for all the support with this issue!

Kr,

Dirk

Op vrijdag 30 maart 2012 11:55:34 UTC+2 schreef Remote Red het volgende:
>
> Looping? 
>
> byte[] bom = {(byte)0xEF, (byte)0xBB, (byte)0xBF }; 
> byte[] byteResult = 
> Charset.forName("UTF-8").encode(result.toString()).array(); 
>
> fos = new FileOutputStream(file); 
> fos.write(bom); 
> fos.write(byteResult); 
>
> Doesn't this work?

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

[android-developers] Re: Writing files in UTF-8

2012-03-30 Thread Dirk Vranckaert
Sadly there is no insert and indeed the put overwrites the bytes.

The charset.encode(...) gives me a ByteBuffer that I cannot retrieve 
'empty'...

Adding (put) the BOM first should be ok, but then adding all the test-bytes 
will not work. Then again I have to loop over all the bytes...

Op vrijdag 30 maart 2012 10:34:20 UTC+2 schreef Remote Red het volgende:
>
> > .put(0, (byte) 0xEF) 
> > .put(1, (byte) 0xBB) 
> > .put(2, (byte) 0xBF) 
>
> > However when the file is created and I open it with either notepad++ or 
> > excel the first characters are  not show, the file always starts with * 
> > artdate"* . 
> > 
> > Any idea how to work around this? 
>
> You are using put(). Those three statements will overwrite the 
> first three bytes. 
>
> Isn't there an insert() ? 
>
> If not: just first write the bom and then the bytes.

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

2012-03-30 Thread Dirk Vranckaert
I did specify the type of result ;) It's a StringBuilder and does indeed 
not support the toString("UTF-8")

What I did now:
FileOutputStream fos = null;
byte[] byteResult = Charset.forName("UTF-8").encode(result.toString())
.put(0, (byte) 0xEF)
.put(1, (byte) 0xBB)
.put(2, (byte) 0xBF)
.array();
fos = new FileOutputStream(file);
fos.write(byteResult);

This works! It's showing my hebrew and chinese characters correct!

But I still have one issue:
The string result.toString() starts with this data (double quotes 
included): *"Startdate";"Starttime";"Enddate";*
However when the file is created and I open it with either notepad++ or 
excel the first characters are  not show, the file always starts with *
artdate"* .

Any idea how to work around this? I though that maybe it just took the 
first few characters (always 3) after the BOM into account but I added some 
spaces between the BOM (exactly 3) and then it's ok. It's a work-around but 
not really the best I hope...

Kr,

Dirk

Op vrijdag 30 maart 2012 00:38:08 UTC+2 schreef Lew het volgende:
>
> b0b wrote:
>
>> For your code to work you need:
>>
>> out.write(result.toString("UTF-8));
>>
>
> How do you know that the type of 'result' supports such a method? The OP 
> did not indicate the type of 'result'.
>
> Surely you are aware that 'String' values in Java are always UTF-16?
> <http://docs.oracle.com/javase/7/docs/api/java/lang/String.html>
>
> -- 
> Lew
>
>
>  
>

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

2012-03-29 Thread Dirk Vranckaert
Ooh yeah, I will have a look tomorrow for the UTF-8.

But the question marks in the in the file i attached are because google 
groups did not get it right the document... Locally it works and I can send 
it through mail without issues.

Kr,

Dirk

Op donderdag 29 maart 2012 14:43:33 UTC+2 schreef Remote Red het volgende:
>
> > I've added "out.write('\ufeff');" to write the Byte Order Mark 
>
> That is not the bom for utf-8. You wrote the bom for UTF-16. 
>
> http://en.wikipedia.org/wiki/Byte_order_mark 
>
> The bom for utf-8 is 0xEF, 0xBB, 0xBF. 
>
> > ... and you can 
> > see in the attachment the export now works fine! :) 
>
> Those attachment have no bom and do not contain characters like 
> €å”€å”€å”€à €à €à €ç¼€ç¼€ç¼€ç¼€ç¼€ç¼€ç¼€Ì€Ì€Ì€Ì€Ì€Ì€ 
> but a lot of questionmarks line. 
> ? 
>
> You are not done before it works with the right bom. 
>

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

2012-03-29 Thread Dirk Vranckaert
Allright it works now!
Thank you for poiting out to me the Byte Order Mark.

I've added "out.write('\ufeff');" to write the Byte Order Mark and you can 
see in the attachment the export now works fine! :)

This is my code now:

out = new OutputStreamWriter(
new FileOutputStream(file), "UTF-8"
);
out.write('\ufeff');
out.write(result.toString());
out.flush();

Op donderdag 29 maart 2012 14:11:01 UTC+2 schreef Dirk Vranckaert het 
volgende:
>
> Oups, forgot the file ;)
>
> But update:
> I was wrong, ö ë é
> are not working either!
>
> File is now attached! :)
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en?"Startdate";"Starttime";"Enddate";"Endtime";"Comment";"Project";"Task";"Project-comment";
"3/29/12";"11:55 AM";"Until now...";"";"QaE???";"Your Project";"Your Task!";"";
"3/29/12";"07:03 AM";"3/29/12";"11:54 AM";"";"Your Project";"Your Task!";"";


[android-developers] Re: Writing files in UTF-8

2012-03-29 Thread Dirk Vranckaert
Oups, forgot the file ;)

But update:
I was wrong, ö ë é
are not working either!

File is now attached! :)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en"Startdate";"Starttime";"Enddate";"Endtime";"Comment";"Project";"Task";"Project-comment";
"3/29/12";"11:55 AM";"Until now...";"";"QaE???";"Your Project";"Your Task!";"";
"3/29/12";"07:03 AM";"3/29/12";"11:54 AM";"";"Your Project";"Your Task!";"";


[android-developers] Re: Writing files in UTF-8

2012-03-29 Thread Dirk Vranckaert

>
> Ok. But then why also a BufferedWriter?  

 
The BufferedWriter is indeed obsolete but leaving it out doesn't change 
anything...

so of what type is result in result.toString()?  
>

Result is of type StringBuilder.

Do characters like ö, é come through ok?  
>

These do indeed come through correctly! 

Are you shure you use an utf-8 capable editor?  


Yes I'm sure :) I'm using Notepadd++ ;)

I attached the file as it is exported!

the produced file does not have a BOM (or at least I don't know :) )
How can I write 'them' myself?

Kr,

Dirk

Op donderdag 29 maart 2012 13:50:28 UTC+2 schreef Remote Red het volgende:
>
> Just a thougth: does the produced file have a BOM (Byte Order Mark) 
> as the first bytes? 
>
> If not you have to write them yourself. 
>

Op donderdag 29 maart 2012 13:50:28 UTC+2 schreef Remote Red het volgende:
>
> Just a thougth: does the produced file have a BOM (Byte Order Mark) 
> as the first bytes? 
>
> If not you have to write them yourself. 
>

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

2012-03-29 Thread Dirk Vranckaert

>
> Why are you using FileOutputStream AND OutputStreamWriter AND 
> BufferedWriter?  

 

I need the OutputStreamWriter to specify the encoding, however that doesn't 
seem to work...

What is the type of result? How did you put content in it? 
>
The result is a CSV file, I just loop over some DB records and build a 
string, then I write the string to the writer... 

> You are not checking the returnvalue of your write statement.  

the Writer.write(..) method does not return anything... it's void...!

 Please explain exactly what is wrong with it.

I thought I did, but anyway, I'll do it again:
Very simplistic explained: so in the application text (that the user 
enters) is stored in a DB, I read the contents of the DB and construct a 
string. Then I write the string in the writer (to the file)!
So when I do so for Dutch, German, English, Frensh,... (all western 
languages) it works. However users started reporting that when inputting 
Chinese or Hebrew characters the application works just fine but for the 
export the content of the CSV file is unreadable. You can open the CSV file 
in a text-editor or a spreadsheet editor but the characters that should be 
Chinese or Hebrew are just unreadable characters.

So instead of seeing something like this:
這是一個測試
I see something like this:
â €å”€å”€å”€à €à €à €ç¼€ç¼€ç¼€ç¼€ç¼€ç¼€ç¼€Ì€Ì€Ì€Ì€Ì€Ì€

So it's a matter of encoding that is not correct. But I am encoding in 
UTF-8 so I don't see the issue...

Kr,

Dirk



Op donderdag 29 maart 2012 11:35:37 UTC+2 schreef Remote Red het volgende:
>
>
>
>
> > out = new BufferedWriter(new OutputStreamWriter( 
> > new FileOutputStream(file), "UTF-8" 
> > )); 
>
> Why are you using FileOutputStream AND OutputStreamWriter AND 
> BufferedWriter? 
>
> > out.write(result.toString()); 
>
> What is the type of result? How did you put content in it? 
>
> You are not checking the returnvalue of your write statement. 
>
> > I indeed see that the text is not correct. 
>
> Please explain exactly what is wrong with it.

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

Re: [android-developers] Writing files in UTF-8

2012-03-29 Thread Dirk Vranckaert
When I debug the result.toString() value I see that it's correctly stored 
in the String.
However adding the out.flus(); just after the out.write(...); doesn't 
change anything!

Kr,

Dirk

Op donderdag 29 maart 2012 09:32:33 UTC+2 schreef bin yang het volgende:
>
> try to flush!
>
> 在 2012年3月29日 下午3:25,Dirk Vranckaert 写道:
>
>> In my application users can export their data (or a subset of it) to a 
>> CSV file (to be used in Excel or any other spreadsheet app).
>> However some of my users are reporting that if they export some that 
>> contains non-western characters (like chinese or hebrew writings) the text 
>> is not correctly in the export.
>>
>> When I try this myself I indeed see that the text is not correct. Here is 
>> the code that writes the content to the file (UTF-8 encoded).
>>
>> Writer out = null;
>>  try {
>> out = new BufferedWriter(new OutputStreamWriter(
>>  new FileOutputStream(file), "UTF-8"
>>  ));
>> out.write(result.toString());
>>  } catch (UnsupportedEncodingException e) {
>>  Log.e(LOG_TAG, "The encoding is not supported!", e);
>> } catch (FileNotFoundException e) {
>>  Log.e(LOG_TAG, "The file is not found", e);
>>  } catch (IOException e) {
>> Log.e(LOG_TAG, "Exception occurred during export...", e);
>>  } finally {
>> if (out != null) {
>>  try {
>> out.close();
>>  } catch (IOException e) {
>>  Log.e(LOG_TAG, "Could not close the writer", e);
>> }
>>  }
>> }
>>
>> Is there anything else that I can do to optimize my code to support those 
>> languages?
>>
>> Kr,
>>
>> Dirk Vranckaert
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, 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] Writing files in UTF-8

2012-03-29 Thread Dirk Vranckaert
In my application users can export their data (or a subset of it) to a CSV 
file (to be used in Excel or any other spreadsheet app).
However some of my users are reporting that if they export some that 
contains non-western characters (like chinese or hebrew writings) the text 
is not correctly in the export.

When I try this myself I indeed see that the text is not correct. Here is 
the code that writes the content to the file (UTF-8 encoded).

Writer out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(file), "UTF-8"
));
out.write(result.toString());
} catch (UnsupportedEncodingException e) {
Log.e(LOG_TAG, "The encoding is not supported!", e);
} catch (FileNotFoundException e) {
Log.e(LOG_TAG, "The file is not found", e);
} catch (IOException e) {
Log.e(LOG_TAG, "Exception occurred during export...", e);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
Log.e(LOG_TAG, "Could not close the writer", e);
}
}
}

Is there anything else that I can do to optimize my code to support those 
languages?

Kr,

Dirk Vranckaert

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

[android-developers] Re: Android instrumentation testing, how to start with clean database all the time

2012-03-22 Thread Dirk Vranckaert
I did not really found the answer, but I did find a solution (or another 
way to reach my target :) ).
See my answer at StackOverflow.com =>  
http://stackoverflow.com/questions/9804917/android-testing-start-with-clean-database-for-every-test/9823600#9823600
 

Op woensdag 21 maart 2012 09:26:56 UTC+1 schreef Dirk Vranckaert het 
volgende:
>
> I'm testing my application with Android Instrumentation tests.
>
> So I have a test-class extending  ActivityInstrumentationTestCase2 which 
> contains multiple tests. The code looks like this: 
> http://pastebin.com/0Di3Hwug 
>
> So the activity which is under test has a list of projects. The list of 
> projects is retrieved from the database. And when no database is available, 
> so when the DB is created, I insert one default project.
>
> What I want it to do is to delete the database before every test is run 
> (that's why I have the delete in the setUp() method), and so  if there is 
> no database available the onCreate for the database should be called on 
> creation of my activity (when loading the list of projects).
>
> What it does, it deletes the DB, it creates the DB, then runs my first 
> test, then it deletes the DB, but does not create it, and runs the second 
> test.
>
> In the test that is first run, I create (add) a project to the DB. In the 
> second test, as I delete the DB, I don't want to see that project anymore 
> but it's there!! No idea how that can happen but it seems that the 
> instrumentation tests are keeping a DB instance in memory...
> Or even an instance of the activity? Because when I put a breakpoint in 
> the onCreate of my activity I only get there once for both the tests...
>
> For the maintaining the DB I use ORMLite. You can see my helper class 
> here: 
> http://code.google.com/p/worktime/source/browse/trunk/android-app/src/eu/vranckaert/worktime/dao/utils/DatabaseHelper.java
>
> So how can I work around this or is there another way to achieve what I 
> want?
>

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

2012-03-21 Thread Dirk Vranckaert
I'm testing my application with Android Instrumentation tests.

So I have a test-class extending  ActivityInstrumentationTestCase2 which 
contains multiple tests. The code looks like this: 
http://pastebin.com/0Di3Hwug 

So the activity which is under test has a list of projects. The list of 
projects is retrieved from the database. And when no database is available, 
so when the DB is created, I insert one default project.

What I want it to do is to delete the database before every test is run 
(that's why I have the delete in the setUp() method), and so  if there is 
no database available the onCreate for the database should be called on 
creation of my activity (when loading the list of projects).

What it does, it deletes the DB, it creates the DB, then runs my first 
test, then it deletes the DB, but does not create it, and runs the second 
test.

In the test that is first run, I create (add) a project to the DB. In the 
second test, as I delete the DB, I don't want to see that project anymore 
but it's there!! No idea how that can happen but it seems that the 
instrumentation tests are keeping a DB instance in memory...
Or even an instance of the activity? Because when I put a breakpoint in the 
onCreate of my activity I only get there once for both the tests...

For the maintaining the DB I use ORMLite. You can see my helper class here: 
http://code.google.com/p/worktime/source/browse/trunk/android-app/src/eu/vranckaert/worktime/dao/utils/DatabaseHelper.java

So how can I work around this or is there another way to achieve what I 
want?

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

2012-03-08 Thread Dirk Vranckaert
As continious integration server I'm using Jenkins.

But when I'm locally on my pc building my Android application, the 
ant-build fails when one of my unit tests fails.
However when I build the app on my continious integration server ant does 
not fail when one of my tests is failing.
Both locally and on the server I'm using the same Android SDK, same 
emulator configuration to run my tests and same ant targets 
(all clean emma debug install test).

I don't know if this is the right place to be with this question (in other 
words is it Jenkins releated or is it Android related...) but I hope to 
find just something here... :)

Kr,

Dirk

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

[android-developers] Re: Problem with writing files to internal memory (not visible on file browser on ICS)

2012-02-09 Thread Dirk Vranckaert
Ok thanks, I understand now ;)
And it works... :)

However I was applying this for the files I created, but that doesn't
seem to be enough. When you create the directory you should also apply
this.

But thanks for helping me out here! :)

On Feb 8, 5:03 pm, Nikolay Elenkov  wrote:
> On Thu, Feb 9, 2012 at 12:51 AM, Dirk Vranckaert
>
>  wrote:
> > Nikolay,
>
> > Thanks for the help but my problem is not to write the file or read
> > the file from my device. With code from above I can write the file to
> > the internal memory. But when my device (galaxy nexus) is connected to
> > my computer it does not see the file I just saved!
>
> > Or did I understand it wrong?
>
> You did :) Even if you save the file successfully, you need to invoke the
> media scanner to make it visible to your computer. Since Honeycomb,
> Android is no longer using USB storage when mounting, but MTP. As a
> result, there might be a mismatch between what is actually on disk and
> what you see when you mount your device. To sync, you need the media
> scanner (which is now a misnomer, since it's not used for media only).

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


[android-developers] Re: Problem with writing files to internal memory (not visible on file browser on ICS)

2012-02-08 Thread Dirk Vranckaert
Nikolay,

Thanks for the help but my problem is not to write the file or read
the file from my device. With code from above I can write the file to
the internal memory. But when my device (galaxy nexus) is connected to
my computer it does not see the file I just saved!

Or did I understand it wrong?

Any help welcome!

Dirk

On Feb 8, 10:32 am, Nikolay Elenkov  wrote:
> On Wed, Feb 8, 2012 at 4:53 PM, Dirk Vranckaert
>
>  wrote:
> > I have a problem when I try to write a file to the device's SD-card.
>
> > 6) Samsung Galaxy Nexus (running 4.0) with the 16 GB build-in SD =>
> > problem!!
>
> > The problem I have is that I cannot see the file that is created:
> > a. when I use a file browser on the device
> > b. when I connect the device to my windows computer (windows 7)
>
> You need to call MediaScannerConnection.scanFile() to get the files
> to show up. Check the external storage sample code:
>
> http://developer.android.com/resources/samples/ApiDemos/src/com/examp...
>
> This is not a bug, it's a feature :)

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


[android-developers] Problem with writing files to internal memory (not visible on file browser on ICS)

2012-02-07 Thread Dirk Vranckaert
I have a problem when I try to write a file to the device's SD-card.

It's an export in CSV format that I save to the directory /Android/
data/eu.vranckaert.worktime/files/worktime/ and the name of the file
is "export.csv" in this case.

File exportDir = ctx.getExternalFilesDir(null);
File file = new File(exportDir, "export.csv");
//Already had the issues before I was applying these
permissions!
file.setReadable(true, false);
file.setWritable(true, false);
file.setExecutable(false, false);
boolean fileAlreadyExists = file.createNewFile();
if(fileAlreadyExists) {
file.delete();
file.createNewFile();
}
FileWriter fw = new FileWriter(file);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(result.toString());
bw.close();
fw.close();

I tested this code and here are the results:
1) Emulator 2.3 with SD => no problem
2) Emulator 3.2 with SD => no problem
3) Emulator 4.0 with SD => no problem
4) HTC Hero (running 2.3.3) with SD => no problem
5) Samsung Galaxy ACE (running 2.3.x) with SD => no problem
6) Samsung Galaxy Nexus (running 4.0) with the 16 GB build-in SD =>
problem!!

The problem I have is that I cannot see the file that is created:
a. when I use a file browser on the device
b. when I connect the device to my windows computer (windows 7)

However I can see the entire directory structure created, just not the
files! I already had this problem before when I was not applying the
permissions, I just thought to try that without any luck.

But I noticed something else, when launching DDMS I can see the file
and download it from the device on my computer.
However this is not user-friendly so I want to have my export working
on ICS as well witouth any hacks for the user to access his exported
files.

I also tried to change the directory where it's saved, instead of the
"/Android/data" directory structure, I set it up to save on my SD-card
to the "/worktime/" directory, but that doesn't work either!

You can check out the DDMS and explorer screenshots I took attached to
the issue on google code: code.google.com/p/worktime/issues/detail?
id=84#c4

Does anyone know what I'm doing wrong or can do better to have this
working?

Kr,

Dirk

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

2012-02-01 Thread Dirk Vranckaert
 same crash as before...

How should I apply this layout file to my fragment activity...? Or
should I create a new layout file?

Kind regards,

Dirk Vranckaert

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: nullpointer on getPreferenceManager() in sdk 13 and up

2012-02-01 Thread Dirk Vranckaert
Thank Mark, that did indeed help!

On Jan 31, 3:37 pm, Mark Murphy  wrote:
> getPreferenceManager() looks like it will return null if you are using
> preference headers. My guess is that you are supposed to use the
> PreferenceManager from your PreferenceFragments.
>
> On Tue, Jan 31, 2012 at 9:22 AM, Dirk Vranckaert
>
>
>
>
>
>
>
>
>
>  wrote:
> > I'm trying to implement a fragemented preferences activity.
>
> > This is only the first part of my activity where it already fails:
>
> > public class PreferencesICSActivity extends PreferenceActivity {
> >    @Override
> >    protected void onCreate(Bundle savedInstanceState) {
> >        super.onCreate(savedInstanceState);
> >        PreferenceManager preferenceManager =
> > PreferencesICSActivity.this.getPreferenceManager();
>
> > preferenceManager.setSharedPreferencesName(Constants.Preferences.PREFERENCE 
> > S_NAME);
> >    }
> > ...
> > }
>
> > I used to do the same in sdk version 7, there it worked. Now however
> > the getPreferenceManager() is null...
> > What am I doing wrong?
>
> > Kr,
>
> > Dirk Vranckaert
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.7 Available!

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


[android-developers] nullpointer on getPreferenceManager() in sdk 13 and up

2012-01-31 Thread Dirk Vranckaert
I'm trying to implement a fragemented preferences activity.

This is only the first part of my activity where it already fails:

public class PreferencesICSActivity extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferenceManager preferenceManager =
PreferencesICSActivity.this.getPreferenceManager();
 
preferenceManager.setSharedPreferencesName(Constants.Preferences.PREFERENCES_NAME);
}
...
}

I used to do the same in sdk version 7, there it worked. Now however
the getPreferenceManager() is null...
What am I doing wrong?

Kr,

Dirk Vranckaert

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

2012-01-15 Thread Dirk
I appreciate your answers very much. I am currently experimenting with
the WakeLock and the AlarmManager, that were great hints !
Just a few words concerning the use case:

I am writing an educational app for the barometer (contained in the
Nexus Prime). Surely it does not make sense to measure the atmospheric
pressure once a second or once a minute. Probably once every 10-60
minutes is more appropriate in everyday life. For these cases, the
AlarmManager migth be the right choice. But in some cases, it might be
interesting to see more frequent updates. Think of balloonists, glider
pilots, sky divers. To address these as well, I need to test with
extreme settings like measuring once a second. For an hour or a few
hours it might be ok to keep the CPU running if the user is aware of
it and explicitly turned on the WakeLock-option.

In all other cases I definetely agree with you and want to warn other
developers, battery really drains fast :-o

Thanks again !

On 14 Jan., 20:17, Dianne Hackborn  wrote:
> And to really really re-iterate -- we are still only talking about
> non-production code.
>
> On Sat, Jan 14, 2012 at 11:16 AM, Dianne Hackborn wrote:
>
>
>
>
>
>
>
>
>
> > Also unless you make your service foreground, its process *will* be killed
> > every now and then while it is in the background.
>
> > And you can use the AlarmManager to avoid holding a wake lock the entire
> > time, but a rate of once a second is way to fast to be appropriate for that
> > -- scheduling Alarms should not be in terms of anything quicker than once a
> > minute and really more like once every 5 minutes or more.
>
> > On Sat, Jan 14, 2012 at 11:00 AM, Kristopher Micinski <
> > krismicin...@gmail.com> wrote:
>
> >> The way you should read mark's response here is:
>
> >> "Don't keep the cpu running, this is a dumb idea, if you're really
> >> doing this it probably indicates there is something wrong with your
> >> design"
>
> >> If this is *strictly* for development, and you'll completely strip out
> >> the code when you release your app, it would probably be fine.
>
> >> kris
>
> >> On Sat, Jan 14, 2012 at 1:05 PM, Mark Murphy 
> >> wrote:
> >> > On Sat, Jan 14, 2012 at 1:00 PM, Dirk 
> >> wrote:
> >> >> Is there a way to control the device's sleep phases programmatically,
> >> >> so I can make sure the logging really takes place ?
>
> >> > Use a WakeLock to keep the CPU running. Your users may not like you
> >> > much, though.
>
> >> > --
> >> > Mark Murphy (a Commons Guy)
> >> >http://commonsware.com|http://github.com/commonsguy
> >> >http://commonsware.com/blog|http://twitter.com/commonsguy
>
> >> > Android Training in NYC:http://marakana.com/training/android/
>
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups "Android Developers" group.
> >> > To post to this group, send email to
> >> android-developers@googlegroups.com
> >> > To unsubscribe from this group, 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
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
>
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see and
> > answer them.
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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


[android-developers] Re: Continuously running Service does not run continuously

2012-01-14 Thread Dirk
Thank you Mark !
Is there a way to control the device's sleep phases programmatically,
so I can make sure the logging really takes place ?

Regards Dirk

On 14 Jan., 18:48, Mark Murphy  wrote:
> On Sat, Jan 14, 2012 at 12:43 PM, Dirk  wrote:
> > I am writing a service which shall continuously log some sensor data
> > over longer periods of time. For testing purposes the service shall
> > log a static debug message once every second. Looking at the log file,
> > after some time (usually 30min to several hours), the logging only
> > takes place every 10 minutes, every half an hour or sometimes even
> > only once an hour. When I connect the phone to my computer, the
> > service starts logging every second again.
>
> That is because the phone is falling asleep. Users like it when their
> phone falls asleep, as this maximizes battery life.
>
> > The service is started once the device completed its boot process (or
> > once the corresponding activity is launched) using:
>
> > Intent serviceIntent = new Intent(getApplicationContext(),
> > TestService.class);
> > startService(serviceIntent);
>
> You do not need getApplicationContext() here. Please replace it with
> the "this" object reference.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training in NYC:http://marakana.com/training/android/

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

2012-01-14 Thread Dirk
Hi,
I am writing a service which shall continuously log some sensor data
over longer periods of time. For testing purposes the service shall
log a static debug message once every second. Looking at the log file,
after some time (usually 30min to several hours), the logging only
takes place every 10 minutes, every half an hour or sometimes even
only once an hour. When I connect the phone to my computer, the
service starts logging every second again.

There are already some posts dealing with the same problem, but I did
not find an appropriate answer. Maybe someone can help to clarify ?

Here are some details of the implementation:

The service is started once the device completed its boot process (or
once the corresponding activity is launched) using:

Intent serviceIntent = new Intent(getApplicationContext(),
TestService.class);
startService(serviceIntent);

The service itself overrides onStartCommand() with

public int onStartCommand(Intent intent, int flags, int startId)
{
return START_STICKY;
}

so that the service shall be restarted if Android decides to stop it.
And in the onCreate method I start a periodic task to log:

Timer timer = new Timer();
timer.schedule(new TimerTask() {
public void run()
{
writeToDebugFile("TestService: Control Message.",
getApplicationContext());
}
}, 0, 1000);

As an alternative I tried to create my own logging-thread, but that
did not help either.
I also tried to let the service run in the foregound using

startForeground(334, myNotification);

without success.

I tested the implementation with an out-of-the-box Nexus Prime, with
no other apps installed or running.

Just in case someone wants to replay the problem, an eclipse export of
a minimal test case can be downloaded here:

http://www.hyfy.de/temp/ContinuousServiceTest.zip

Thanks for any comments !
Regards Dirk

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: "Permission Denial: starting Intent" when launching my activity from my widget

2012-01-11 Thread Dirk Vranckaert
Problem solved... How?
I don't have a clue... But it's solved.
At 4PM yesterday I tried to push the button on my widget, still same
problem. At 8PM I tried it again and suddenly it worked... I did not
install any upgrade or whatever so it must have been a failure of my
Android device (Nexus1). Maybe because I was installing/removing the
app quite some times that it started failing... But then why did it
start again after two days or something..? No idea but I can use my
app again so me happy :)

Thanks for the help anyway!!!

Kr,

Dirk

On Jan 10, 10:09 am, Kostya Vasilyev  wrote:
> From those logcat messages, I'd think that you have android:permission
> attributes on the  or  in your manifest.
>
> http://developer.android.com/guide/topics/manifest/activity-element.h...
>
>
>
> The name of a permission that clients must have to launch the activity or
> otherwise get it to respond to an intent. If a caller of
> startActivity()<http://developer.android.com/reference/android/content/Context.html#s...)>
>  or 
> startActivityForResult()<http://developer.android.com/reference/android/app/Activity.html#star...,
> int)> has not been granted the specified permission, its intent will not be
> delivered to the activity.
> <<<
>
> -- Kostya
>
> 10 января 2012 г. 10:30 пользователь Dirk Vranckaert <
> dirkvrancka...@gmail.com> написал:
>
>
>
>
>
>
>
> > Yes ok but it doesn't make much sense that I should set the export-
> > property for 2 of my 3 activities that I'm calling from my widget,
> > certainly not that it worked before... The "android:exported" property
> > is only ment to be set to true if other components (so from other
> > applications) must be able to call the activity.
>
> > Any ideas?
>
> > Kind Regards,
>
> > Dirk
>
> > On Jan 9, 11:43 pm, Jonathan S  wrote:
> > > Look inhttps://
> > developer.android.com/guide/topics/manifest/activity-element
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, 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: "Permission Denial: starting Intent" when launching my activity from my widget

2012-01-09 Thread Dirk Vranckaert
Yes ok but it doesn't make much sense that I should set the export-
property for 2 of my 3 activities that I'm calling from my widget,
certainly not that it worked before... The "android:exported" property
is only ment to be set to true if other components (so from other
applications) must be able to call the activity.

Any ideas?

Kind Regards,

Dirk

On Jan 9, 11:43 pm, Jonathan S  wrote:
> Look 
> inhttps://developer.android.com/guide/topics/manifest/activity-element

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] "Permission Denial: starting Intent" when launching my activity from my widget

2012-01-09 Thread Dirk Vranckaert
I'm developing the WorkTime application for Android and I am
expieriencing some strange behaviour with my widget.

SO I have a widget on which basically 3 parts are clickable:
1) The header => opens a selection dialog
2) A button => starts an activity to start a new time registration
3) The rest of the widget => launches the main screen of the
application

Before telling you my exact problem I want to mention to you that I
have tried the application on a Nexus One and two emulators (4.0.3 and
2.3.3).
The issue is only valid for the Nexus One!

So a couple of hours ago I was still using the widget normally, all
buttons were working fine.
I then installed a new version of the application (with some minor
fixus, BUT nothing changed to the widget part or any activity called
from within the widget) And suddenly when I was pressing the
header (1) or the button (2) nothing happend and (when connected to my
PC) in the LogCat I saw some exceptions (attached at the bottom!).

Before the update (so no files related to the widget or the activities
launched from the widget have changed!) everything was working fine.

I also tried uninstalling the application and installing the old
version again (the version that has worked a few hours ago), but still
the two activities could not be launched and the same exceptions are
thrown.

The latest code with which I'm having these issues is availble on
http://code.google.com/p/worktime/source/browse/trunk.

Does anyone has any idea what could have gone wrong? :s

I read somewhere that I could add the "android:exported="true""
property in the AndroidManifest.xml file for those two activities, but
why does it suddenly fail for those two activities and it still works
for the third...?

Here are the two exceptions:

01-09 11:37:43.733: WARN/ActivityManager(92): Unable to send
startActivity intent
java.lang.SecurityException: Permission Denial: starting
Intent { flg=0x1080
cmp=eu.vranckaert.worktime/.activities.widget.SelectProjectActivity
bnds=[254,64][466,140] } from null (pid=-1, uid=10073) requires null
at
com.android.server.am.ActivityStack.startActivityLocked(ActivityStack.java:
1973)
at
com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:
2271)
at
com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:
212)
at
com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:
2134)
at
android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:
211)
at
com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:
1467)
at android.os.Binder.execTransact(Binder.java:320)
at dalvik.system.NativeStart.run(Native Method)
01-09 11:37:44.253: DEBUG/dalvikvm(14556): GC_EXPLICIT freed 1582K,
52% free 4478K/9159K, external 2917K/3577K, paused 170ms
01-09 11:37:44.263: INFO/ActivityManager(92): Starting: Intent
{ flg=0x1080
cmp=eu.vranckaert.worktime/.activities.widget.StartTimeRegistrationActivity
bnds=[269,146][451,218] } from pid -1
01-09 11:37:44.263: WARN/ActivityManager(92): Permission denied:
checkComponentPermission() reqUid=10066
01-09 11:37:44.263: WARN/ActivityManager(92): Permission Denial:
starting Intent { flg=0x1080
cmp=eu.vranckaert.worktime/.activities.widget.StartTimeRegistrationActivity
bnds=[269,146][451,218] } from null (pid=-1, uid=10073) requires null
01-09 11:37:44.263: WARN/ActivityManager(92): Unable to send
startActivity intent
java.lang.SecurityException: Permission Denial: starting
Intent { flg=0x1080
cmp=eu.vranckaert.worktime/.activities.widget.StartTimeRegistrationActivity
bnds=[269,146][451,218] } from null (pid=-1, uid=10073) requires null
at
com.android.server.am.ActivityStack.startActivityLocked(ActivityStack.java:
1973)
at
com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:
2271)
at
com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:
212)
at
com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:
2134)
at
android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:
211)
at
com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:
1467)
at android.os.Binder.execTransact(Binder.java:320)
at com.android.server.SystemServer.init1(Native Method)
at com.android.server.SystemServer.main(SystemServer.java:625)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
597)
at dalvik.system.NativeStart.main(Native Method)

-- 
You received this message because you are subscribed to

[android-developers] Re: Using sd-card in 4.0 emulator

2012-01-05 Thread Dirk Vranckaert
I prefer Mac (or even Linux) but my employer enforces me to use
Windows so yeah... :-)

But here's what I just found (posted it already):

Ok I found the problem,
the "my documents" directory is set to be in D:\DVRANCKA . So when
the
AVD manager creates an AVD it's places under D:\DVRANCKA\.android\avd
\...However when I want to launch an AVD it's looked for in the C:
\user
\DVRANCKA\.android\avd\...
Is there somewhere I can configure that for launching he should also
look at D:\DVRANCKA?

On Jan 5, 3:47 pm, Mark Murphy  wrote:
> On Thu, Jan 5, 2012 at 9:42 AM, Dirk Vranckaert
>
>  wrote:
> > I did the check and am running on the latest versions.
>
> > But I noticed something strange. When I open my AVD manager and want
> > to create a new AVD it's not created on disk (although I can see the
> > AVD and all it's preferences in AVD application). I tried deleting all
> > AVD's and manually deleted the .android directory in c:\Users
> > \MY_USERNAME\, then opened the AVD manager again and added an AVD. But
> > now it comes... The AVD is not added in the application. What can I do
> > that I don't have re-install the entire SDK and still can fix my AVD
> > manager...?
>
> Beats me. You're running Windows, which is not my cup of proverbial tea.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, One Low Price!

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

2012-01-05 Thread Dirk Vranckaert
Ok I found the problem,
the "my documents" directory is set to be in D:\DVRANCKA . So when the
AVD manager creates an AVD it's places under D:\DVRANCKA\.android\avd
\...However when I want to launch an AVD it's looked for in the C:\user
\DVRANCKA\.android\avd\...
Is there somewhere I can configure that for launching he should also
look at D:\DVRANCKA?

On Jan 5, 3:42 pm, Dirk Vranckaert  wrote:
> I did the check and am running on the latest versions.
>
> But I noticed something strange. When I open my AVD manager and want
> to create a new AVD it's not created on disk (although I can see the
> AVD and all it's preferences in AVD application). I tried deleting all
> AVD's and manually deleted the .android directory in c:\Users
> \MY_USERNAME\, then opened the AVD manager again and added an AVD. But
> now it comes... The AVD is not added in the application. What can I do
> that I don't have re-install the entire SDK and still can fix my AVD
> manager...?
>
> Kr,
>
> Dirk
>
> On Jan 5, 3:33 pm, Mark Murphy  wrote:
>
>
>
>
>
>
>
> > On Thu, Jan 5, 2012 at 9:25 AM, Dirk Vranckaert
>
> >  wrote:
> > > That's what I did. In the "SD Card" part of the add/edit AVD screen
> > > I've entered the size (100MB). I even tried added the hardware
> > > parameter "hw.sdCard: yes".
> > > But none of these things work..
>
> > They work in my ICS emulator. Make sure you are on the latest edition
> > of the tools and platform-tools.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > Warescription: Three Android Books, Plus Updates, One Low Price!

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

2012-01-05 Thread Dirk Vranckaert
I did the check and am running on the latest versions.

But I noticed something strange. When I open my AVD manager and want
to create a new AVD it's not created on disk (although I can see the
AVD and all it's preferences in AVD application). I tried deleting all
AVD's and manually deleted the .android directory in c:\Users
\MY_USERNAME\, then opened the AVD manager again and added an AVD. But
now it comes... The AVD is not added in the application. What can I do
that I don't have re-install the entire SDK and still can fix my AVD
manager...?

Kr,

Dirk

On Jan 5, 3:33 pm, Mark Murphy  wrote:
> On Thu, Jan 5, 2012 at 9:25 AM, Dirk Vranckaert
>
>  wrote:
> > That's what I did. In the "SD Card" part of the add/edit AVD screen
> > I've entered the size (100MB). I even tried added the hardware
> > parameter "hw.sdCard: yes".
> > But none of these things work..
>
> They work in my ICS emulator. Make sure you are on the latest edition
> of the tools and platform-tools.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, One Low Price!

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

2012-01-05 Thread Dirk Vranckaert
Mark,

That's what I did. In the "SD Card" part of the add/edit AVD screen
I've entered the size (100MB). I even tried added the hardware
parameter "hw.sdCard: yes".
But none of these things work..

Kr,

Dirk

On Jan 5, 3:19 pm, Mark Murphy  wrote:
> On Thu, Jan 5, 2012 at 9:14 AM, Dirk Vranckaert
>
>  wrote:
> > But my code already returns false for
> > "Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);"
> > When going in the android settings of the emulator I cannot see the SD
> > memory, only internal memory...
>
> Add a virtual SD card to your AVD via the AVD Manager. With that in
> place, you will see "USB storage" with your amount in the Storage
> portion of Settings.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, One Low Price!

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

2012-01-05 Thread Dirk Vranckaert
First of all happy holidays and happy 2012 for all of you!

I'm trying to write something to my SD-card, It works in 2.x. But in
the 4.0 emulator I cannot write anything to internal memory or SD-
card.
In the AVD settings I added a 50MB SD card.

But my code already returns false for
"Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);"
When going in the android settings of the emulator I cannot see the SD
memory, only internal memory...

Any idea why the SD card is not mounted or the
getExternalStorageState() does not equal to MEDIA_MOUNTED?

Kr,

Dirk

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Slow scrolling in Date/TimePicker using Holo theme

2011-12-18 Thread Dirk Vranckaert
Thanks for the help Matt! I implemented a CustomDatePicker and
CustomTimePicker, for both classes have overriden the
onInterceptTouchEvent method and works like a charm now! :)

On 16 dec, 16:47, Matt H  wrote:
> Hi Dirk,
>
> I had the same problem (noticed it yesterday, too, coincidentally!).
> The issue is that the ScrollView is intercepting and stealing the
> touch events once your finger moves outside of the Date/Time Picker
> controls.
>
> To work around this, I created sub classes of Date/TimePicker which
> prevent the parent from stealing events after the initial touch down
> (see below). If you use those in your layout XML instead, you should
> find the problem goes away.
>
> Hope that is useful!
>
> Matt.
>
> import android.content.Context;
> import android.util.AttributeSet;
> import android.view.MotionEvent;
> import android.view.ViewParent;
> import android.widget.DatePicker;
>
> public class CustomDatePicker extends DatePicker
> {
>     public CustomDatePicker(Context context, AttributeSet attrs, int
> defStyle)
>     {
>         super(context, attrs, defStyle);
>     }
>
>     public CustomDatePicker(Context context, AttributeSet attrs)
>     {
>         super(context, attrs);
>     }
>
>     public CustomDatePicker(Context context)
>     {
>         super(context);
>     }
>
>     @Override
>     public boolean onInterceptTouchEvent(MotionEvent ev)
>     {
>         /* Prevent parent controls from stealing our events once we've
> gotten a touch down */
>         if (ev.getActionMasked() == MotionEvent.ACTION_DOWN)
>         {
>             ViewParent p = getParent();
>             if (p != null)
>                 p.requestDisallowInterceptTouchEvent(true);
>         }
>
>         return false;
>     }
>
>
>
>
>
>
>
> }

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

2011-12-15 Thread Dirk Vranckaert
I'm trying to build an activity on which the user can change a certain
date and time.
So I created an activity and a layout file, in the layout file
(containing more than just the date and time picker, you can see it
beneath) i define the date and time picker.
The application android 2.1 compatible, but I compile it under 3.2 so
that I can use the Holo theme in the entire application.

Running the application on 2.1 till 3.1 gives me the old-style date
and time picker, where you can type the value or press plus/minus.
Running on 3.2 or 4.0 gives me the new Holo styles date and time
picker, where you can also type or press plus and minus. So far so
good. But with the new style you can also scroll on the day, month,
year, hour and minute, but for some reason that doesn't quite work in
my application! What it does: I try to scroll down (let's say minute
is on 49, I want to change it to 30). It starts scrolling, and the
first pixels are just fine and smooth. But then it blocks and
everytime i initiate a scroll-swipe again it scrolls only a few
pixels. To scroll from 49 to 48 I have to scroll 5 or 6 times... Not
really normal I guess.

I also use the DatePickerDialog in some cases, there scrolling goes
smooth as supposed to be.

So is there anything I forget to do when using a date and/or time
picker in an activity?

Attachments:

Here is my layout file:

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







And here is the part of my activity where I set the values on the date
and time picker:
datePicker = (DatePicker) findViewById(datePickerId);
timePicker = (TimePicker) findViewById(timePickerId);

datePicker.init(part.get(Calendar.YEAR),
part.get(Calendar.MONTH), part.get(Calendar.DAY_OF_MONTH), null);
if (getAndroidApiVersion() >= 13) {
datePicker.setCalendarViewShown(false);
datePicker.setSpinnersShown(true);
}

timePicker.setIs24HourView(true);
timePicker.setCurrentHour(part.get(Calendar.HOUR_OF_DAY));
timePicker.setCurrentMinute(part.get(Calendar.MINUTE));

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


[android-developers] Re: How can we control the background data for Individual Apps ?

2011-10-25 Thread dirk
My question is, what's the user experience? For instance, it would be
really nice if an app can get notified when approaching a limit so
that data is not just cut off mid stream. Does the OS gives some kind
of notification or does the app just stop?

On Oct 21, 1:47 pm, Mark Murphy  wrote:
> There is no API, AFAIK. This is a feature of the settings application.
>
>
>
>
>
>
>
>
>
> On Thu, Oct 20, 2011 at 1:39 PM, Vineet Shukla  wrote:
> > I did a little study on Android 4.0 (ICS) features and learned that
> > --
> > Based on theirdataplans, users can optionally set warning levels or
> > hardlimitsondatausage or disable mobiledataaltogether. Users can
> > also manage the backgrounddataused by individual applications as
> > needed"
> > 
> > I am looking for the API by which we can control the get and control
> > the b/gdatausage by individual apps.
>
> > Rgds,
> > Vineet
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 4.0 Available!

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


[android-developers] Re: Android Layouts Are Horrible

2011-04-04 Thread dirk
Hold on a minute. I really don't care the least bit about underlying
code, that is, the XML that's generated by a really good design tool.
Saying you should have to learn the XML (in this case) is like saying
you have to learn the bytecode that's generated from the java code.
Sure, you always need understand the structure, but with good tools,
you can _focus_ on the structure and not worry about the details.

On Apr 4, 7:01 pm, Robert  wrote:
> Layout is part of development. Having tools to help with that are aids
> but should not be used as an excuse not to learn the underlying code.
> THe designer tools only generate the structures based on the rules
> programmed into them. You will always have a more detailed level of
> control by going to the lowest level available.  Learn it and it'll
> make you a better developer and your programs to be more
> efficient.     Using the higher level tools makes you only as
> efficient at they are.
>
> Yes, it takes time and yes you have to learn it but that's what being
> a real developer is all about.
> Robert

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


[android-developers] Re: Android Layouts Are Horrible

2011-04-04 Thread dirk
Coming from the Windows world where the tools are really top notch, I
have to agree with the sentiment (if not the presentation) of grndvl1
point. Really there should be no need to have to know the XML if you
have a good designer tool. That tool is improving for sure, but it
still has a long way to go.


On Apr 3, 10:01 pm, grndvl1  wrote:
> Why is it I spend more time dealing with the layout of items than the
> actual coding of the program?  The Eclipse Graphical Layout tool
> really blows as it has a ton of errors and can't handle simple things
> like italic text in textview, scrollviews...  The layout parameters
> seem to be a hodge-podge of stuff thrown in there as an after thought,
> seems it wasn't really planned out.  They should have taken a lesson
> from Java's crappy Gridbag layout  and used or at least analyzed how
> Miglayout fixed many issues with Java GUI's.  I won't use any other
> layout manager other than Miglayout.  Anyway just venting here as I
> spent the last 1hr fixing something that should be so simple in a
> Scrollview/TableLayout/TableRow with ImageView and TextView in each
> row.

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

2011-03-23 Thread Dirk Bruere
Thanks.
I'll check out the references tomorrow.
Right now it's 04:24 here
The app I am writing is for a tablet to be connected to customers LAN
designed to control an XP based machine named "Base". I have no
control over their router settings. Nor can I rely on them having an
active Internet connection, as opposed to merely a switched on LAN
(WiFi)

On 23/03/2011, Bob Kerns  wrote:
> By setting up your LAN properly.
>
> You will need:
>
>1. Your LAN's DHCP server to know the proper location of your DNS server.
>This is the DNS server your phone will use.
>2. Your DNS server to know the names addresses of your MS machines. DNS
>is how your phone (and anything else even remotely standard) resolves
>addresses.
>3. Your application to use the FQDN (Fully Qualified Domain Name, e.g.
>myserver.mycompany.com)
>
> There are a number of approaches to doing this. I'll describe just the
> simplest (in the sense of requiring the least technology and making the
> fewest assumptions), not necessarily the easiest or best.
>
>1. Assign a static IP address for your server. If you will only be
>accessing it via LAN, it can be on the internal LAN IP address range, but
>not one that is in use, or allocated to a DHCP address pool.
>2. Register that IP address with your DNS server for mycompany.com. You
>want to add an 'A' record with the name (without the .mycompany.com) and
> the
>IP4 address. You may also want to add an IP6 address, using an 
> record,
>if your network supports that.
>3. Make sure Constants.serverNameStr has the '.mycompany.com' on the end.
>
> Other approaches allow for setting it up and managing it dynamically, for
> example, see this Microsoft article on integrating WINS and DNS:
>
> http://technet.microsoft.com/en-us/library/cc750589.aspx
>
> Or this one on Active Directory and DNS:
>
> http://technet.microsoft.com/en-us/library/cc759550(WS.10).aspx
>
> If you want to access it even if you're not on the LAN, you'll need a public
> IP address, and suitable router configuration for your service to be
> contacted on the proper machine, but it still boils down to the same
> process.
>
> Note that you can have an internal DNS server with data that is not public.
> Your phone (and any device using DHCP) will get the address of the DNS
> server to use for resolving host names from the response from your DHCP
> server. However, this isn't necessary for successful use.
>
>


-- 
Homepage: www.neopax.com/technomage - My new book

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

2011-03-22 Thread Dirk Bruere at NeoPax
I am using
InputMethodManager imm =
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editBox.getWindowToken(), 0);

To hide the soft keyboard when I have finished using an edittext box.
However, it won't come back again!
What do I need to do to cancel the hide?

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

2011-03-22 Thread Dirk Bruere at NeoPax
I have tried using
InetAddress address = InetAddress.getByName(Constants.serverNameStr);
but this goes off to my ISP and gets a page not found reply

Tried using JCIFS
try{
  NbtAddress addr =
NbtAddress.getByName(Constants.serverNameStr);
  }catch (UnknownHostException e) {}

but I get the exception.
How do I find an MS machine on my LAN, by name?

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

2011-03-19 Thread Dirk Vranckaert
All,

For my current project I'm having an issue with images that I have
never seen before on Android.

I have an image (link at bottom) that I use in my application and as
you can see in the screenshot (screenshot of HTC Hero, running 2.2, at
the bottom) and the background is a little gray while the png has a
transparent background... However when testing this on my N1 device,
running 2.3, the background is transparant (screenshot of N1 at the
bottom), as should be...

Does anyone has an idea what causes the issue, I also have the issue
on a 2.2 emulator, not on the 2.3 emulator, and how I could solve it?

Links:
My image: http://vranckaert.eu/android/theimage.png
HTC Hero screenshot: http://vranckaert.eu/android/hero.png
N1 screenshot: http://vranckaert.eu/android/n1.png

Kr,

Dirk

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

2011-03-10 Thread dirk
Another option is to expose a View which includes the joined results.

On Mar 10, 11:40 am, Jay Bloodworth 
wrote:
> Is there a standard or recommended idiom for doing the equivalent of a
> join of data in a local database versus a content provider?  is there
> anything more efficient than explicitly looping on the result set from
> the local database query and doing individual queries of the content
> provider to grab the related rows?
>
> Jay

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

2011-03-09 Thread dirk
I don't believe so. If it's a known number, the only thing I can think
of is to add a contact for that number (with the user's approval, of
course).

Dirk

On Mar 9, 2:58 am, viktor  wrote:
> Hi,
>
> Is it any tricks to change name in Dialer on the fly (when dialer is
> in Ringing state )?
>
> In dialer we can see Name with label "Unknown", I want to replace it
> on my own label.
>
> Thanks

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


[android-developers] Re: Intent Flags ignored coming from an widget?

2011-02-09 Thread Dirk Vranckaert
Anyone? Can't figure out why it isnt working... :s

On Feb 9, 8:19 pm, Dirk Vranckaert  wrote:
> All,
>
> For the app i'm currently writing I  needs some help.
>
> My activity structure when launching the app with the launcher:
> HomeActivity => ListActivity
> On the listActivity I've put a home button with a clear top flag
> (intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);)
> So pressing the home button makes me return to my home activity, on my
> home activity pressing the back button results in the application
> closing. That exactly what I want.
>
> However when you click a button on my widget you directly go to the
> ListActivity. Then you click the home button and the flag on the
> intent is set correctly but the stack isn't cleared at all! So when
> arriving at my home activity I press the back button and instead of
> quitting the application it goes back to my ListActivity.
>
> Any ideas how I can resolve this one?

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


[android-developers] Intent Flags ignored coming from an widget?

2011-02-09 Thread Dirk Vranckaert
All,

For the app i'm currently writing I  needs some help.

My activity structure when launching the app with the launcher:
HomeActivity => ListActivity
On the listActivity I've put a home button with a clear top flag
(intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);)
So pressing the home button makes me return to my home activity, on my
home activity pressing the back button results in the application
closing. That exactly what I want.

However when you click a button on my widget you directly go to the
ListActivity. Then you click the home button and the flag on the
intent is set correctly but the stack isn't cleared at all! So when
arriving at my home activity I press the back button and instead of
quitting the application it goes back to my ListActivity.

Any ideas how I can resolve this one?

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


[android-developers] Re: ListView items appear 2 or 3 times

2011-02-06 Thread Dirk Vranckaert
Ok never mind my last comment.
I started to re-write the ArrayAdapter implementation and got it
working just fine... :)
Thanks for your help!! :)

Here's my update code:

/**
 * The list adapater private inner-class used to display the
manage labels list.
 */
private class ManageLabelsListAdapter extends ArrayAdapter
{
private final String LOG_TAG =
ManageLabelsListAdapter.class.getSimpleName();
/**
 * {@inheritDoc}
 */
public ManageLabelsListAdapter(List labels) {
super(ManageLabelsActivity.this,
R.layout.list_item_labels, labels);
Log.d(LOG_TAG, "Creating the manage labels list
adapater");
}

@Override
public View getView(int position, View convertView, ViewGroup
parent) {
Log.d(LOG_TAG, "Start rendering/recycling row " +
position);
View row;
final Label label = labels.get(position);
Log.d(LOG_TAG, "Got label with name " + label.getName());

if (convertView == null) {
Log.d(LOG_TAG, "Render a new line in the list");
row =
getLayoutInflater().inflate(R.layout.list_item_labels, parent, false);
} else {
Log.d(LOG_TAG, "Recycling an existing line in the
list");
row = convertView;
}

Log.d(LOG_TAG, "Ready to update the name of the label of
the listitem...");
TextView labelname = (TextView)
row.findViewById(R.id.labelname_listitem);
labelname.setText(label.getName());

Log.d(LOG_TAG, "Ready to bind the deleteButton to the
deleteLabel method...");
ImageView deleteButton = (ImageView)
row.findViewById(R.id.btn_delete);
deleteButton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view) {
deleteLabel(label, true);
}
});

Log.d(LOG_TAG, "Done rendering row " + position);
return row;
}
}

On Feb 6, 11:39 pm, Dirk Vranckaert  wrote:
> Thx for the help.
>
> I was trying something like the code snippet below but it doesn't
> help... It seems that the TextView retrieved in the else case is
> always null, any ideas?
>
>             } else {
>                 Log.d(LOG_TAG, "No need for row to be created");
>                 Log.d(LOG_TAG, "Finding the TextView for the label-
> name");
>                 TextView textView = (TextView)
> row.findViewById(R.id.labelname);
>                 if(textView != null) {
>                     Log.d(LOG_TAG, "TextView for label-name found");
>                     Log.d(LOG_TAG, "Setting the name of the
> label...");
>                     textView.setText(label.getName());
>                     ImageView deleteButton = (ImageView)
> row.findViewById(R.id.btn_delete);
>                     Log.d(LOG_TAG, "About to attach the
> onClickListener for deletion of the label");
>                     deleteButton.setOnClickListener(new
> View.OnClickListener() {
>                         public void onClick(View view) {
>                             deleteLabel(label, true);
>                         }
>                     });
>                 }
>             }
>
> On Feb 6, 5:45 pm, Kostya Vasilyev  wrote:
>
>
>
>
>
>
>
> > Dirk,
>
> > You have a bug in your getView() method.
>
> > When a list item layout gets recycled (convertView != null), your code
> > correctly avoids re-inflating a new layout. However, since the item
> > layout is being recycled, it's also necessary to update its views with
> > values for the current item.
>
> > Pseudo-code:
>
> > getView() {
>
> > if (convertView == null) {
> > inflate a view
>
> > }
>
> > /* Always execute below code, for both new and recycled item layouts */
>
> > YourDataItem item = get data item specified by "position"
>
> > TextView view1.setText(item.name);
> > TextView view2.setText(item.address);
> > // etc
>
> > }
>
> > -- Kostya
>
> > 06.02.2011 19:39, Dirk Vranckaert пишет:
>
> > > Hi all,
>
> > > I'm having an issue with the ListView in Android.
>
> > > So I have an activity extending the ListActivity, in the activity I
> > > have an innerclass for my adapater.
> > > Now both on my device and the emulator some entries appear 2 or 3
> > > times in the list (not always the same items) although the size of my
> > > List  is always the same!
>
> > > On the emulator I

[android-developers] Re: ListView items appear 2 or 3 times

2011-02-06 Thread Dirk Vranckaert
Thx for the help.

I was trying something like the code snippet below but it doesn't
help... It seems that the TextView retrieved in the else case is
always null, any ideas?

} else {
Log.d(LOG_TAG, "No need for row to be created");
Log.d(LOG_TAG, "Finding the TextView for the label-
name");
TextView textView = (TextView)
row.findViewById(R.id.labelname);
if(textView != null) {
Log.d(LOG_TAG, "TextView for label-name found");
Log.d(LOG_TAG, "Setting the name of the
label...");
textView.setText(label.getName());
ImageView deleteButton = (ImageView)
row.findViewById(R.id.btn_delete);
Log.d(LOG_TAG, "About to attach the
onClickListener for deletion of the label");
deleteButton.setOnClickListener(new
View.OnClickListener() {
public void onClick(View view) {
deleteLabel(label, true);
}
});
}
    }

On Feb 6, 5:45 pm, Kostya Vasilyev  wrote:
> Dirk,
>
> You have a bug in your getView() method.
>
> When a list item layout gets recycled (convertView != null), your code
> correctly avoids re-inflating a new layout. However, since the item
> layout is being recycled, it's also necessary to update its views with
> values for the current item.
>
> Pseudo-code:
>
> getView() {
>
> if (convertView == null) {
> inflate a view
>
> }
>
> /* Always execute below code, for both new and recycled item layouts */
>
> YourDataItem item = get data item specified by "position"
>
> TextView view1.setText(item.name);
> TextView view2.setText(item.address);
> // etc
>
> }
>
> -- Kostya
>
> 06.02.2011 19:39, Dirk Vranckaert пишет:
>
>
>
>
>
>
>
>
>
> > Hi all,
>
> > I'm having an issue with the ListView in Android.
>
> > So I have an activity extending the ListActivity, in the activity I
> > have an innerclass for my adapater.
> > Now both on my device and the emulator some entries appear 2 or 3
> > times in the list (not always the same items) although the size of my
> > List  is always the same!
>
> > On the emulator I noticed that it's mostly related to the scrolling in
> > the list... If I scroll down some entries are duplicate, if I scroll
> > up and down again the entries have changed all over the list...
>
> > Is there anything in my code that you guys can see that is wrong?
>
> > Here's my code:
>
> >          
> >          this.labels = labelService.findAll();
> >          Collections.sort(this.labels, new LabelByNameComparator());
> >          Log.d(LOG_TAG, labels.size() + " labels loaded!");
> >          ManageLabelsListAdapter adapter = new
> > ManageLabelsListAdapter(labels);
> >          adapter.notifyDataSetChanged();
> >          setListAdapter(adapter);
>
> >      /**
> >       * The list adapater private inner-class used to display the
> > manage labels list.
> >       */
> >      private class ManageLabelsListAdapter extends ArrayAdapter
> > {
> >          private final String LOG_TAG =
> > ManageLabelsListAdapter.class.getSimpleName();
> >          /**
> >           * {@inheritDoc}
> >           */
> >          public ManageLabelsListAdapter(List  labels) {
> >              super(ManageLabelsActivity.this,
> > R.layout.list_item_labels, labels);
> >              Log.d(LOG_TAG, "Creating the manage labels list
> > adapater");
> >          }
>
> >          @Override
> >          public View getView(int position, View convertView, ViewGroup
> > parent) {
> >              Log.d(LOG_TAG, "Getting view...");
> >              View row = convertView;
> >              ManageLabelsListWrapper wrapper;
>
> >              if(row == null) {
> >                  Log.d(LOG_TAG, "Row needs to be created!");
> >                  final Label label = labels.get(position);
> >                  Log.d(LOG_TAG, "Label at list position " + position +
> > " retrieved from DB list: " + label);
>
> >                  LayoutInflater inflater = getLayoutInflater();
> >                  row = inflater.inflate(R.layout.list_item_labels,
> > parent, false);
> >                  Log.d(LOG_TAG, "Label row inflated into layout!");
> >                  wrapper = new ManageLabelsListWrapper(row

[android-developers] ListView items appear 2 or 3 times

2011-02-06 Thread Dirk Vranckaert
Hi all,

I'm having an issue with the ListView in Android.

So I have an activity extending the ListActivity, in the activity I
have an innerclass for my adapater.
Now both on my device and the emulator some entries appear 2 or 3
times in the list (not always the same items) although the size of my
List is always the same!

On the emulator I noticed that it's mostly related to the scrolling in
the list... If I scroll down some entries are duplicate, if I scroll
up and down again the entries have changed all over the list...

Is there anything in my code that you guys can see that is wrong?

Here's my code:


this.labels = labelService.findAll();
Collections.sort(this.labels, new LabelByNameComparator());
Log.d(LOG_TAG, labels.size() + " labels loaded!");
ManageLabelsListAdapter adapter = new
ManageLabelsListAdapter(labels);
adapter.notifyDataSetChanged();
setListAdapter(adapter);

/**
 * The list adapater private inner-class used to display the
manage labels list.
 */
private class ManageLabelsListAdapter extends ArrayAdapter
{
private final String LOG_TAG =
ManageLabelsListAdapter.class.getSimpleName();
/**
 * {@inheritDoc}
 */
public ManageLabelsListAdapter(List labels) {
super(ManageLabelsActivity.this,
R.layout.list_item_labels, labels);
Log.d(LOG_TAG, "Creating the manage labels list
adapater");
}

@Override
public View getView(int position, View convertView, ViewGroup
parent) {
Log.d(LOG_TAG, "Getting view...");
View row = convertView;
ManageLabelsListWrapper wrapper;

if(row == null) {
Log.d(LOG_TAG, "Row needs to be created!");
final Label label = labels.get(position);
Log.d(LOG_TAG, "Label at list position " + position +
" retrieved from DB list: " + label);

LayoutInflater inflater = getLayoutInflater();
row = inflater.inflate(R.layout.list_item_labels,
parent, false);
Log.d(LOG_TAG, "Label row inflated into layout!");
wrapper = new ManageLabelsListWrapper(row);
Log.d(LOG_TAG, "Row wrapped!");

TextView labelName = wrapper.getLabelname_listitem();
Log.d(LOG_TAG, "About to update the name of the label
in the view for TextView " + labelName + " with the value: " +
label.getName());
labelName.setText(label.getName());

ImageView deleteButton = wrapper.getBtn_delete();
deleteButton.setOnClickListener(new
View.OnClickListener() {
public void onClick(View view) {
deleteLabel(label, true);
}
});
}

return row;
}
}

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

2011-01-26 Thread dirk
I've seen the case where on some devices (like the Nexus One and the
Evo) where the while audio track gets played, but the current play
time is not reported correctly. Similarly, the duration gets reported
correctly. Is that the case here?

On Jan 25, 9:40 am, Hank  wrote:
> I don't get any exceptions and the log doesn't provide any
> information. I am trying to play a amr file
>
> On Jan 25, 12:17 pm, TreKing  wrote:
>
> > On Tue, Jan 25, 2011 at 10:02 AM, Hank  wrote:
> > > I have a recording that is around 4 minutes and when I try to play it 
> > > using
> > > the MediaPlayer API, it doesn't play the full file, it cuts off early 
> > > maybe
> > > at most 30 seconds into the file.
>
> > Do you have any more information than that? Exceptions? Log messages? The
> > file type? Etc.
>
> > -
> > 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


[android-developers] Re: Do Androids dream of rule engines?

2010-11-30 Thread Dirk
Hi,
I think Androids should dream of rule engines !

I am working on global event distribution and event processing at the
network's edge (e.g. a mobile phone) and I recently ported several
existing middlewares to Android. One of these is "Esper", a complex
event processing runtime. I do not know that much about rule engines,
but a colleague of mine recently evaluated the suitability of complex
event processing engines and rule engines for protocol verifications.
Therefore, I assume there are scenarios in which both approaches are
reasonably suited. In my case, I use a complex event processing engine
to deal with the multitude of events coming from an Android device's
physical (gps, acceleration, etc.) as well as virtual sensors
(application specific sensors). The same could be achieved with rule
engines as well. This is my reason 1 why Androids should dream of rule
engines.

Reason 2 is based on my efforts for porting "Jadex Active Components"
to Android. Using Jadex one may modularize applications into self-
contained "agents", "processes", etc. A very nice paradigm. Until now,
I only managed to port the so called "Jadex MicroAgents" as well as
"BPMN-based Agents", but Jadex also supports the development of
intelligent "BDI Agents" (BDI = Belief, Desire, Intention), which are
able to reason about the world and what they should do therein. Such a
reasoning process is in most agent systems based on a rule engine (in
case of Jadex it is "Jadex Rules"), which sorts out what plan an agent
should follow to reach its goals. Unfortunately, this has not been
ported yet. Therefore, no BDI agents on Android, which is really a
pitty, as agent-oriented software engineering offers a multitude of
nice concepts for building distributed applications ... and mobile
devices are right on the way to play an active role in distributed
systems.

To cut a long story short: it's time that more heavy-weight components
(like rule engines) are finally supported by mobile platforms, because
this allows developers to benefit from established desktop concepts
even in the mobile world.

Cheers,
Dirk

ps: sorry for being verbose



On 30 Nov., 15:40, Pavel Vlasov  wrote:
> Hi Bob.
>
> Thank you for your feedback!
>
> The reason why I didn't put "why rule engines are needed on Android"
> in the post and on the site (except a little bit on the history page)
> is because I'm primarily Java SE/J2EE guy and no expert in Android.
> This is why the post is a question. It is for Android experts to
> decide whether it is needed and how it can be used. If the community
> shares these thought with me, I'll gladly publish them in the Event
> Bus online documentation, given posters permission.
>
> My reasons to believe that there is a need are listed below:
> - About two years ago Sun Java ME guys from JCP approached me and said
> that Hammurapi Rules (the predecessor of Event Bus) is the only rules
> engine which runs on Java ME and that there is a great need in rule
> engines on mobile devices. They wanted to come up with Java spec for
> rule engines on mobile devices. (Then Oracle acquired Sun and it
> didn't go anywhere.) This was the primary factor to build Event Bus in
> a way that it runs on both Java SE and Android.
> - I think that there are a lot of events flying around in a mobile
> device. A mobile device communicates with the external worlds and
> these communications aren't fast. This is why parallel predicate
> evaluation and parallel handler execution was introduced.
> - I also thought about leveraging it in UI as you described, but again
> - I do not possess the "expert power" in this area - I know how to
> build UI's, but I don't do it on a daily basis. So I decided that it's
> better not to say something than to say something wrong.
>
> Event Bus supports retractions - you can remove event from the bus and
> all conclusions based on this event will be invalidated. However, in
> the current release retraction does not activate any handlers, as it
> used to be in Hammurapi Rules. Thank you for pointing it out - I'll
> add the concept of retraction-activated handlers to the bus.
>
> Do you mind if I incorporate your feedback into the Why section on the
> Android page?
> ---
> Best regards, Pavel.
>
> On Nov 29, 10:07 pm, Bob Kerns  wrote:
>
> > Hi, Pavel. I would like to see the Code of Hammurapi ... I hope it's
> > not written in cuneiform! :=)
>
> > Great name! I think it would be helpful if you were to be a bit more
> > explicit about what makes you believe there is a need for aruleengineon 
> > Android.
>
> > I've written moreruleengines than I can recall offhand, and a big
> > fan ofrulee

[android-developers] Re: VerifyError reloaded

2010-10-01 Thread Dirk
That was fast ! Thank you. Do you know if the fix will be included in
the next Android version ?

On 30 Sep., 19:29, fadden  wrote:
> On Sep 29, 11:32 am, Dirk  wrote:
>
> > In order to get around the problem, I tried to replace the whole
> > switch-statement with lots of if-elseif statements.
> > Unfortunately, another problem arose. The Verifyer now says:
>
> > 09-29 18:02:44.058: WARN/dalvikvm(450): VFY: arbitrarily rejecting
> > large method (regs=127 count=34916)
>
> I fixed that one too while I was at it.  The limit was intended to
> prevent the verifier from soaking up huge amounts of memory, but (a)
> the limit is too low, and (b) there are better mechanisms in the
> system for doing that.  So now it's just a warning that says, "hey,
> this is huge".
>
> With both fixes in place, the original code passes.

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

2010-09-30 Thread Dirk
Thanks for the insights. I broke up the method into several smaller
ones, and now it works !

... at least until it's time to regenerate the class (the class is
automatically generated by ANTLR, a parser generator).

On 29 Sep., 23:15, DanH  wrote:
> Java has some fairly arbitrary restrictions on the size of programs.
> Most are fairly reasonable, but one that isn't so much is the one that
> limits the number of bytecodes in a method to 65535.  (Curiously,
>  methods can have more.)
>
> In general, a verifier should be able to handle any large method up to
> the 65535 limit without choking, but there are a number of oddball
> (and not so oddball) cases where Sun's can't, and most other verifiers
> have similar Achilles heels.  (Eg, I wrote the "BigUglyMethod"
> testcase that breaks Sun's verifier, even though it's only a few
> hundred lines long.)  (And rather than respond by fixing the verifier,
> Sun did a major redesign of the bytecode file format to circumvent the
> problem.  Though curiously they never did the very minor modifications
> that would have been required to lift the 65535 limitation.)
>
> Anyway, it's likely that this program is bumping into several limits
> in the Dalvik.  The best thing to do would be to figure out some way
> to break up the mongo method that's causing these problems.
>
> On Sep 29, 1:32 pm, Dirk  wrote:
>
> > Just for the sake of completeness:
> > In order to get around the problem, I tried to replace the whole
> > switch-statement with lots of if-elseif statements.
> > Unfortunately, another problem arose. The Verifyer now says:
>
> > 09-29 18:02:44.058: WARN/dalvikvm(450): VFY: arbitrarily rejecting
> > large method (regs=127 count=34916)
>
> > There's already another thread on this 
> > topic:http://groups.google.com/group/android-developers/browse_thread/threa...
>
> > Maybe one should keep this issue in mind when fixing the Verifier bug,
> > cause they seem to go hand in hand.
>
> > Cheers Dirk
>
> > The method has several thousand lines ( ~ 3000 to 9000 lines,
> > depending on the formatting) of code
> > On 28 Sep., 22:53, fadden  wrote:
>
> > > On Sep 28, 11:28 am, Dirk  wrote:
>
> > > > Before filing a bug, I would feel much better if someone else could
> > > > have a look and approve that there's really something not working as
> > > > it should.
>
> > > It's a bug in the verifier.  Specifically, dvmCheckSwitchTargets is
> > > treating the switch table offset as a 16-bit value when it's actually
> > > a 32-bit value.  The switch statement data starts at 0x8664.

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

2010-09-29 Thread Dirk
Just for the sake of completeness:
In order to get around the problem, I tried to replace the whole
switch-statement with lots of if-elseif statements.
Unfortunately, another problem arose. The Verifyer now says:

09-29 18:02:44.058: WARN/dalvikvm(450): VFY: arbitrarily rejecting
large method (regs=127 count=34916)

There's already another thread on this topic:
http://groups.google.com/group/android-developers/browse_thread/thread/e2a36821d0476057/b549ddd81b5e8ca7?lnk=raot

Maybe one should keep this issue in mind when fixing the Verifier bug,
cause they seem to go hand in hand.

Cheers Dirk

The method has several thousand lines ( ~ 3000 to 9000 lines,
depending on the formatting) of code
On 28 Sep., 22:53, fadden  wrote:
> On Sep 28, 11:28 am, Dirk  wrote:
>
> > Before filing a bug, I would feel much better if someone else could
> > have a look and approve that there's really something not working as
> > it should.
>
> It's a bug in the verifier.  Specifically, dvmCheckSwitchTargets is
> treating the switch table offset as a 16-bit value when it's actually
> a 32-bit value.  The switch statement data starts at 0x8664.

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

2010-09-28 Thread Dirk
Hej fadden,
I only have a glance of what might be wrong, but I'll post that bug
(and your comment) on the Android bug list.

Thank you very much, I'll really appreciate this !
Cheers Dirk

On 28 Sep., 22:53, fadden  wrote:
> On Sep 28, 11:28 am, Dirk  wrote:
>
> > Before filing a bug, I would feel much better if someone else could
> > have a look and approve that there's really something not working as
> > it should.
>
> It's a bug in the verifier.  Specifically, dvmCheckSwitchTargets is
> treating the switch table offset as a 16-bit value when it's actually
> a 32-bit value.  The switch statement data starts at 0x8664.

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

2010-09-28 Thread Dirk
Hi,
thanks for the replies and sorry for the delay, it took me some time
to extract the application part which throws the VerifyError.
Sure you can have access to the APK and to the sources as well - if
they are of any need.
The APK can be found here: 
http://vsis-www.informatik.uni-hamburg.de/projects/jadex-android/AndroidVerifyTest.apk
And the whole eclipse project, containing the sources, here:
http://vsis-www.informatik.uni-hamburg.de/projects/jadex-android/AndroidVerifyTest.rar

Before filing a bug, I would feel much better if someone else could
have a look and approve that there's really something not working as
it should.

If you have a look at the sources, don't let all the classes confuse
you, the Activity test.verify.AndroidVerifyTestActivity is the
entrypoint which simply instantiates the Class upon which the
VerifyError is throws. All the other classes and packages are just
dependencies.

Thanks in advance,
Dirk

On 28 Sep., 04:06, DanH  wrote:
> VerifyError occurs for two basic reasons:
>
> 1) An error in the bytecodes.
> 2) An error due to a mismatch between two different class files.
>
> It's really unusual to find a case for reason (1) but you apparently
> "lucked out".
> If this is code that runs OK in a regular Java environment but fails
> on Android then I would suspect a bug in the Android verifier (or
> perhaps a "feechur" -- some sort of limitation/restriction).
>
> Apparently fadden suspects a bug in the Android verifier as well.
>
> On Sep 25, 2:33 pm, Dirk  wrote:
>
> > Hi,
> > I'm currently trying to port the famous complex event processing
> > runtime "Esper" to the Android (2.2) platform and am facing a
> > VerifyError, which I - although reading several other post on
> > VerifyErrors - do not understand.
>
> > The project I am trying to build and run contains only Java sources
> > (no libraries). Therefore, I assume, that if these are compiled
> > successfully, they would pass the verification process. But during
> > runtime, I get the following error:
>
> > 09-25 18:33:27.549: WARN/dalvikvm(300): VFY: invalid switch start: at
> > 8, switch offset -31132, count 34530
> > 09-25 18:33:27.549: WARN/dalvikvm(300): VFY:  rejected Lcom/espertech/
> > esper/epl/generated/EsperEPL2GrammarParser
> > $DFA156;.specialStateTransition (ILorg/antlr/runtime/IntStream;)I
> > 09-25 18:33:27.549: WARN/dalvikvm(300): Verifier rejected class Lcom/
> > espertech/esper/epl/generated/EsperEPL2GrammarParser$DFA156;
> > 09-25 18:33:27.559: DEBUG/AndroidRuntime(300): Shutting down VM
> > 09-25 18:33:27.559: WARN/dalvikvm(300): threadid=1: thread exiting
> > with uncaught exception (group=0x4001d800)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300): FATAL EXCEPTION: main
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300): java.lang.VerifyError:
> > com.espertech.esper.epl.generated.EsperEPL2GrammarParser$DFA156
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > com.espertech.esper.epl.generated.EsperEPL2GrammarParser.(EsperEPL2GrammarParser.java:
> > 28870)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > com.espertech.esper.epl.generated.EsperEPL2GrammarParser.(EsperEPL2GrammarParser.java:
> > 338)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > com.espertech.esper.epl.parse.ParseHelper.parse(ParseHelper.java:108)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > com.espertech.esper.core.EPAdministratorImpl.compileEPL(EPAdministratorImpl.java:
> > 299)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > com.espertech.esper.core.EPAdministratorImpl.createEPLStmt(EPAdministratorImpl.java:
> > 142)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > com.espertech.esper.core.EPAdministratorImpl.createEPL(EPAdministratorImpl.java:
> > 94)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > esper.android.EsperAndroidTest.onCreate(EsperAndroidTest.java:39)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> > 1047)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> > 2627)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> > 2679)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > android.app.ActivityThread.access$2300(ActivityThread.java:125)
> > 09-25 18:33:27.589: ERROR/AndroidRuntime(300):     at
> > android.app.ActivityThread$H.handleMe

[android-developers] Re: VerifyError reloaded

2010-09-28 Thread Dirk
Hi,
thanks for the replies and sorry for the delay, it took me some time
to extract the application part which throws the VerifyError.
Sure you can have access to the APK and to the sources as well - if
they are of any need.
The APK can be found here: 
http://vsis-www.informatik.uni-hamburg.de/projects/jadex-android/AndroidVerifyTest.apk
And the whole eclipse project, containing the sources, here:
http://vsis-www.informatik.uni-hamburg.de/projects/jadex-android/AndroidVerifyTest.rar

Before filing a bug, I would feel much better if someone else could
have a look and approve that there's really something not working as
it should.

If you have a look at the sources, don't let all the classes confuse
you, the Activity test.verify.AndroidVerifyTestActivity is the
entrypoint which simply instantiates the Class upon which the
VerifyError is throws. All the other classes and packages are just
dependencies.

Thanks in advance,
Dirk



On 28 Sep., 04:06, DanH  wrote:
> VerifyError occurs for two basic reasons:
>
> 1) An error in the bytecodes.
> 2) An error due to a mismatch between two different class files.
>
> It's really unusual to find a case for reason (1) but you apparently
> "lucked out".
> If this is code that runs OK in a regular Java environment but fails
> on Android then I would suspect a bug in the Android verifier (or
> perhaps a "feechur" -- some sort of limitation/restriction).
>
> Apparently fadden suspects a bug in the Android verifier as well.
>

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

2010-09-27 Thread Dirk
Hi,
I'm currently trying to port the famous complex event processing
runtime "Esper" to the Android (2.2) platform and am facing a
VerifyError, which I - although reading several other post on
VerifyErrors - do not understand.

The project I am trying to build and run contains only Java sources
(no libraries). Therefore, I assume, that if these are compiled
successfully, they would pass the verification process. But during
runtime, I get the following error:

09-25 18:33:27.549: WARN/dalvikvm(300): VFY: invalid switch start: at
8, switch offset -31132, count 34530
09-25 18:33:27.549: WARN/dalvikvm(300): VFY:  rejected Lcom/espertech/
esper/epl/generated/EsperEPL2GrammarParser
$DFA156;.specialStateTransition (ILorg/antlr/runtime/IntStream;)I
09-25 18:33:27.549: WARN/dalvikvm(300): Verifier rejected class Lcom/
espertech/esper/epl/generated/EsperEPL2GrammarParser$DFA156;
09-25 18:33:27.559: DEBUG/AndroidRuntime(300): Shutting down VM
09-25 18:33:27.559: WARN/dalvikvm(300): threadid=1: thread exiting
with uncaught exception (group=0x4001d800)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): FATAL EXCEPTION: main
09-25 18:33:27.589: ERROR/AndroidRuntime(300): java.lang.VerifyError:
com.espertech.esper.epl.generated.EsperEPL2GrammarParser$DFA156
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.epl.generated.EsperEPL2GrammarParser.(EsperEPL2GrammarParser.java:
28870)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.epl.generated.EsperEPL2GrammarParser.(EsperEPL2GrammarParser.java:
338)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.epl.parse.ParseHelper.parse(ParseHelper.java:108)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.core.EPAdministratorImpl.compileEPL(EPAdministratorImpl.java:
299)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.core.EPAdministratorImpl.createEPLStmt(EPAdministratorImpl.java:
142)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.core.EPAdministratorImpl.createEPL(EPAdministratorImpl.java:
94)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
esper.android.EsperAndroidTest.onCreate(EsperAndroidTest.java:39)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2627)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2679)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.os.Looper.loop(Looper.java:123)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.ActivityThread.main(ActivityThread.java:4627)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
java.lang.reflect.Method.invokeNative(Native Method)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
java.lang.reflect.Method.invoke(Method.java:521)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
dalvik.system.NativeStart.main(Native Method)

(sorry for the bad formatting)

The source of "EsperEPL2GrammarParser" is quite big ( > 40,000 lines)
and so is the above mentioned inner class DFA156, which mainly
contains a switch-statement (> 60 cases) and each case contains
several (> 50?) if-then-else statements. Just an idea ... when reading
the error message above (invalid switch start: at 8, switch offset
-31132, count 34530) my alarm bells ring, cause some values around
32768 (16 bit range) always make me nervous.

Nevertheless, I am confused with this VerifyError and would appreciate
any help getting closer to the error's source. What can I do to
encircle the error ?

Thanks in advance,
Cheers Dirk

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

2010-09-27 Thread Dirk
Hi,
I'm currently trying to port the famous complex event processing
runtime "Esper" to the Android (2.2) platform and am facing a
VerifyError, which I - although reading several other post on
VerifyErrors - do not understand.

The project I am trying to build and run contains only Java sources
(no libraries). Therefore, I assume, that if these are compiled
successfully, they would pass the verification process. But during
runtime, I get the following error:

09-25 18:33:27.549: WARN/dalvikvm(300): VFY: invalid switch start: at
8, switch offset -31132, count 34530
09-25 18:33:27.549: WARN/dalvikvm(300): VFY:  rejected Lcom/espertech/
esper/epl/generated/EsperEPL2GrammarParser
$DFA156;.specialStateTransition (ILorg/antlr/runtime/IntStream;)I
09-25 18:33:27.549: WARN/dalvikvm(300): Verifier rejected class Lcom/
espertech/esper/epl/generated/EsperEPL2GrammarParser$DFA156;
09-25 18:33:27.559: DEBUG/AndroidRuntime(300): Shutting down VM
09-25 18:33:27.559: WARN/dalvikvm(300): threadid=1: thread exiting
with uncaught exception (group=0x4001d800)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): FATAL EXCEPTION: main
09-25 18:33:27.589: ERROR/AndroidRuntime(300): java.lang.VerifyError:
com.espertech.esper.epl.generated.EsperEPL2GrammarParser$DFA156
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.epl.generated.EsperEPL2GrammarParser.(EsperEPL2GrammarParser.java:
28870)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.epl.generated.EsperEPL2GrammarParser.(EsperEPL2GrammarParser.java:
338)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.epl.parse.ParseHelper.parse(ParseHelper.java:108)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.core.EPAdministratorImpl.compileEPL(EPAdministratorImpl.java:
299)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.core.EPAdministratorImpl.createEPLStmt(EPAdministratorImpl.java:
142)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.espertech.esper.core.EPAdministratorImpl.createEPL(EPAdministratorImpl.java:
94)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
esper.android.EsperAndroidTest.onCreate(EsperAndroidTest.java:39)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2627)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2679)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.os.Looper.loop(Looper.java:123)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
android.app.ActivityThread.main(ActivityThread.java:4627)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
java.lang.reflect.Method.invokeNative(Native Method)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
java.lang.reflect.Method.invoke(Method.java:521)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-25 18:33:27.589: ERROR/AndroidRuntime(300): at
dalvik.system.NativeStart.main(Native Method)

The source of "EsperEPL2GrammarParser" is quite big ( > 40,000 lines)
and so is the above mentioned inner class DFA156, which mainly
contains a switch-statement (> 60 cases) and each case contains
several (> 50?) if-then-else statements. Just an idea ... when reading
the error message above (invalid switch start: at 8, switch offset
-31132, count 34530) my alarm bells ring, cause some values around
32768 (16 bit range) always make me nervous.

Nevertheless, I am confused with this VerifyError and would appreciate
any help getting closer to the error's source. What can I do to
encircle the error ?

Thanks in advance,
Cheers Dirk

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

2010-09-27 Thread Dirk Vranckaert
Hey everyone,

In my application I wanted to include a calendar view. However when I
was searching for a calendar widget to use it seems there currently
isn't any calendar widget available in the SDK (android.widget.*), is
that correct?
Are there any good other implementations that I could use?
Cause I searched all over internet but couldn't find anything so far.

If anyone has experience with such a calendar view please let me know
how to start with it!

Grtz..

Dirk

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

2010-09-27 Thread Dirk Vranckaert
Hey everyone,

I was searching for a calendar widget to use in one of my
applications. It seems there currently isn't any calendar widget
available in the SDK (android.widget.*), is that correct?
Are there any good other implementations that I could use?
Cause I searched all over internet but couldn't find anything so far.

To make it just a little more clear, this is what I would want in my
application (or sth similar): 
http://androinica-serve.s3.amazonaws.com/wp-content/uploads/2009/09/puregrid.png

If anyone has experience with such a calendar view please let me know
how to start with it!

Grtz..

Dirk

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

2010-09-23 Thread Dirk Vranckaert
So when I intercept, and the user choses my application to start
default, when I want to let open the application I intercept is that
still possible or will it always return to mine?

Dirk

On Sep 23, 3:02 pm, patrick  wrote:
> If you do this, the user will see a pop-up asking to choose netween
> your app and the messaging app.
> The user can choose to set your app as default handler.
>
> On Sep 23, 1:54 pm, Dirk Vranckaert  wrote:
>
>
>
> > Hey,
>
> > I'm walking around with a little idea for a new Android app although I
> > have my doubts weather it's possible or not. So that's why I came
> > here.
>
> > What I want to do is this: A users uses his phone and suddenly he
> > wants to open his messaging application. Now instead of opening that
> > application I would like to intercept it, do some stuff of my own, and
> > then let the messaging app open.
>
> > Is it possible to do so? And if it is, could you guys give me some
> > tips before I start on this?
>
> > Kind regards,
>
> > Dirk

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

2010-09-23 Thread Dirk Vranckaert
I found this in the emulator logging upon opening the message
application:

09-23 12:45:32.149: INFO/ActivityManager(582): Starting activity:
Intent { action=android.intent.action.MAIN
categories={android.intent.category.LAUNCHER} flags=0x1020
comp={com.android.mms/com.android.mms.ui.ConversationList} }

So I can use the action and category part of the intent (which is not
surprising the same same for any application) but I should also be
able to use the comp part in order to know which application is
launching. Is there anyway to achieve this?

Dirk

On Sep 23, 1:54 pm, Dirk Vranckaert  wrote:
> Hey,
>
> I'm walking around with a little idea for a new Android app although I
> have my doubts weather it's possible or not. So that's why I came
> here.
>
> What I want to do is this: A users uses his phone and suddenly he
> wants to open his messaging application. Now instead of opening that
> application I would like to intercept it, do some stuff of my own, and
> then let the messaging app open.
>
> Is it possible to do so? And if it is, could you guys give me some
> tips before I start on this?
>
> Kind regards,
>
> Dirk

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

2010-09-23 Thread Dirk Vranckaert
When I started an emulator and looked in the loggings I found this:

09-23 12:45:32.149: INFO/ActivityManager(582): Starting activity:
Intent { action=android.intent.action.MAIN
categories={android.intent.category.LAUNCHER} flags=0x1020
comp={com.android.mms/com.android.mms.ui.ConversationList} }

So there is the action and category of the intent, but I should be
able to use the 'comp' part (what does 'comp' mean?) to get my
activity launced. But how?

Dirk

On Sep 23, 1:54 pm, Dirk Vranckaert  wrote:
> Hey,
>
> I'm walking around with a little idea for a new Android app although I
> have my doubts weather it's possible or not. So that's why I came
> here.
>
> What I want to do is this: A users uses his phone and suddenly he
> wants to open his messaging application. Now instead of opening that
> application I would like to intercept it, do some stuff of my own, and
> then let the messaging app open.
>
> Is it possible to do so? And if it is, could you guys give me some
> tips before I start on this?
>
> Kind regards,
>
> Dirk

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

2010-09-23 Thread Dirk Vranckaert
Hey,

I'm walking around with a little idea for a new Android app although I
have my doubts weather it's possible or not. So that's why I came
here.

What I want to do is this: A users uses his phone and suddenly he
wants to open his messaging application. Now instead of opening that
application I would like to intercept it, do some stuff of my own, and
then let the messaging app open.

Is it possible to do so? And if it is, could you guys give me some
tips before I start on this?

Kind regards,

Dirk

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

2010-08-28 Thread Dirk Vranckaert
Hey all,

I've been working on an application lately that is using GMaps to
display a location that is stored in the devices database. However
when no location is available (no GPS signal is available) the user
can go through an edit wizard and at a certain point he can add a
location himself. I already have to code to display the stored
location, but is it possible to write something so the user get's to
see a map and when he clicks/touches on a certain area a map pointer
appears and the location is stored.
Is that possible in any way? Is there any good online documentation
available? I searched through this group and on Google but couldn't
find anything usefull.

Kind regards,

Dirk

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

2010-06-22 Thread Dirk Vranckaert
Hey,

I'm currently trying to create some wizard-like layout for some edit/
add views in my Android application.
Therefore I use only one activity and different layout files which I
load.
Altough there is something wrong with my layout files. The layout
files can be found here: http://pastebin.com/YmW2PmLw

What I'm trying to do:
So I have my screen in which some date and time can be set manually
with the date and time pickers. At the bottom of the screen I want a
bar with a cancel button and next button (I'm not sure yet if I will
keep this cancel button as the device's back button does the same, but
whatever). With the layout file posted this works.

So my problem:
When switching the device from portrait mode to landscape my time
picker get behind the button bar at the bottom, as I added a
scrollView I can scroll to the time picker but a part of the the time
picker stays invisible behind the button bar.

Does any of you think of a solution for that? So I want to scroll but
the scrolling area should come just above the button bar and not
underneath!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 update a Widget dynamically (Not waiting 30 min for onUpdate to be called)?

2010-05-29 Thread Dirk Vranckaert
Kostya,

at first sight, that helped!
Thanks a lot for pointing me that out!

Greetz..

Dirk

On 29 mei, 11:04, Kostya Vasilyev  wrote:
> Dirk,
>
> This is the reason your widget sometimes stops responding to clicking.
>
> Each and every RemoteViews update needs to specify complete state,
> including data and PendingIntents (if any). The home screen process can
> be bumped out of memory, and Android uses the most recent RemoteViews to
> recreate widgets. If it's incomplete and only contains text updates,
> then pending intents will be lost.
>
> Same thing happens on orientation changes - there is no onUpdate(), just
> the mechanism described above.
>
> -- Kostya
>
> 2010/5/29 Dirk Vranckaert 
>
>
>
> > I think String is right about that. I wouldn't do that either just to
> > save battery life!
>
> > However I think it is better to set the update interval of the applet
> > to a high enough amount of time (like 24 hours or sth) and just update
> > the widget manually. I'm currently working on a widget to and in my
> > case the widget only receives an update upon clicking a certain
> > button.
>
> > The way I do that is like this:
>
> > RemoteViews rv = new RemoteViews(context.getPackageName(), WIDGET);
> > rv.setTextViewText(R.id.textField, "Updated value for some text on the
> > widget");
> > ComponentName cn = new ComponentName(context, YourActivity.class);
> > AppWidgetManager mgr = AppWidgetManager.getInstance(context);
> > mgr.updateAppWidget(cn, rv);
>
> > That should basically work to update a widget.
> > Oh and one tip: using the this method you should do all updating just
> > after the line "rv.setTextViewText(...)". If you execute this entire
> > block a few times after each other you can get into troubles when
> > updating the widget.
>
> > Dirk
>
> > On 28 mei, 23:40, String  wrote:
> > > Before you get too far into this, you need to be aware that the widget
> > > architecture isn't designed to update that frequently. There's a lot
> > > of overhead, and updating every ten seconds will seriously impact
> > > battery life. As will having a service continually running in the
> > > background, for that matter.
>
> > > It's a cool idea but I'm not sure it's well suited for a widget,
> > > unfortunately.
>
> > > String
>
> > > On May 28, 2:43 pm, "draf...@gmail.com"  wrote:
>
> > > > I am currently learning about widgets in Android.
>
> > > > I want to create a WIFI widget that will display the SSID, the RSSI
> > > > (Signal) level.
>
> > > > But I also want to be able to send it data from a service I am running
> > > > that calculates the Quality of Sound over wifi.
>
> > > > Here is what I have after some reading and a quick tutorial:
>
> > > > ---
>
> > > >     public class WlanWidget extends AppWidgetProvider{
>
> > > >         RemoteViews remoteViews;
> > > >         AppWidgetManager appWidgetManager;
> > > >         ComponentName thisWidget;
> > > >         WifiManager wifiManager;
>
> > > >         public void onUpdate(Context context, AppWidgetManager
> > > > appWidgetManager,
> > > >                         int[] appWidgetIds) {
> > > >                         Timer timer = new Timer();
> > > >                         timer.scheduleAtFixedRate(new
> > WlanTimer(context, appWidgetManager),
> > > > 1, 1);
>
> > > >         }
>
> > > >         private class WlanTimer extends TimerTask{
>
> > > >                         RemoteViews remoteViews;
> > > >                         AppWidgetManager appWidgetManager;
> > > >                         ComponentName thisWidget;
>
> > > >         public WlanTimer(Context context, AppWidgetManager
> > appWidgetManager)
> > > > {
>
> > > >                         this.appWidgetManager = appWidgetManager;
> > > >                         remoteViews = new
> > RemoteViews(context.getPackageName(),
> > > > R.layout.widget);
> > > >                         thisWidget = new ComponentName(context,
> > WlanWidget.class);
> > > >                         wifiManager =
> > > > (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
>
> > > >         }
>
> > > >         @Override
> > > >         public void run() {
>
> > remot

[android-developers] Re: Stalling widget buttons after some time

2010-05-29 Thread Dirk Vranckaert
Yeah I think it must be something like that if I understand you right.
Kostya also explained me something over here:
http://groups.google.com/group/android-developers/browse_thread/thread/dc4420e6f9057a05/4589ec46352e0157#4589ec46352e0157

And I guess that could be problem that my RemoteViews weren't full-
state object. Now everytime I update the widget I will update both the
texts and the intents on the buttons and at first sight, it seems to
work just fine right now :)

Thanks for the help!

On 29 mei, 11:32, dstefanox  wrote:
> I had similar problem on orientation change - widget stopped
> responding to button clicks after orientation change. Does this happen
> with your widget also?
> Slight difference with my widget is that it was sending intents to
> itself. Anyway, solution was to set pending intents to widget buttons
> every time that onReceive is called (since I am sending intents back
> to widget).
> After that, there was no more problems with orientation change -
> buttons were reacting every time. Maybe you can do something similar?
>
> On May 29, 11:03 am, Dirk Vranckaert  wrote:
>
>
>
> > Anyone?
>
> > Cause I'm really stuck on this issue! Can't find out what I did wrong!
>
> > Dirk

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


[android-developers] Re: Can an AppWidget's RemoteViews be edited/created dynamically, or only from XML?

2010-05-29 Thread Dirk Vranckaert
James,

To modify the widget layout from an activity or service you should use
some could like this:

RemoteViews rv = new RemoteViews(context.getPackageName(), WIDGET);
rv.setTextViewText(R.id.label1, "text for label1");
rv.setTextViewText(R.id.label2, "text for label2");
rv.setTextViewText(R.id.label3, "text for label3");
ComponentName cn = new ComponentName(context, YourActivity.class);
AppWidgetManager mgr = AppWidgetManager.getInstance(context);
mgr.updateAppWidget(cn, rv);

As you can see in the example (written on the fly so not sure that it
is 100% correct) you can edit multiple view-object in just one
RemoteViews object. Don't start using different RemoteViews for each
object on the view you want to edit cause you will run into problems
with the updating right then.

Also, have a look at the RemoteViews class to see what you can exactly
do with it, don't know if you can make things visible or invisible
with it. Although whatever that you want to edit with the RemoteViews
should already being declared in the layout.xml file of your widget if
I'm not wrong!

Kostya,

as far as I know that is not possible. You should then just create
different widgets with the XML configuration file and perhaps you can
reuse the widget provider class you have to implement so that you can
share the logic for both widgets (if the content of both widgets is
the same off cours.)

On 29 mei, 10:42, Kostya Vasilyev  wrote:
> James,
>
> I don't have the answer, but I would like to amend your question.
>
> Switching views is one thing, but what if there are versions of the same
> widget that have different sizes?
>
> Minimal widget size is specified in res/.xml, using
> . Is it posible to specify
> different sizes depending on what widget version the users selects in my
> configuration activity (or some other way)?
>
> I know it works with HTC Sense for its own widgets (e.g. clock,
> weather...), but they might have changed Android to allow for this.
>
> Is there a way to do it with stock Android firmware?
>
> -- Kostya
>
> 2010/5/28 James W 
>
>
>
> > I suspect the answer is no, but it only seems possible at the moment
> > to update an AppWidget via a RemoteViews object which is inflated from
> > a static XML file.
>
> > Is there any way to build a RemoteViews object on the fly, or edit the
> > layout of one that is already there?
>
> > The requirement is that I dont know until runtime exactly how many
> > ImageViews I want to display in my AppWidget.
>
> > Currently I am setting all the ImageViews I may need in the layout XML
> > file as invisible and then just making the ones I want visible, but am
> > I then limited to what I have in the XML file to start with. It would
> > be far more convenient to be able to just add the ones I need on the
> > fly, and set their properties when updating.
>
> > Anyone know if there is a way to do that?
>
> > Thanks
> > James
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Stalling widget buttons after some time

2010-05-29 Thread Dirk Vranckaert
Anyone?

Cause I'm really stuck on this issue! Can't find out what I did wrong!

Dirk

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

2010-05-28 Thread Dirk Vranckaert
I just had the issue also on my device. Strangly when I noticed it has
been little longer than 24 hours since I added the widget. And 24
hours is the updateperiod I've set.
Could it really have anything to do with that and if so, what???

Can't I just disable the updatePeriod?

Dirk

On May 29, 12:03 am, Dirk Vranckaert  wrote:
> Hey all,
>
> I'm currently working on a widget/application and I have an issue with
> that.
> Before I get into the issue you could check out the code which is
> available just over 
> here:http://code.google.com/p/workregistrationwidget-android/source/browse/
>
> So my issue... :)
> The widget contains two buttons. The linking of the buttons with an
> activity happens in my widget provider (http://code.google.com/p/
> workregistrationwidget-android/source/browse/trunk/
> WorkRegistrationWidgetAndroid/src/eu/vranckaert/workRegistrationWidget/
> widgetProvider/WorkRegistrationWidgetProvider.java). So far so good.
> Clicking the buttons interacts with my activities and my widget gets
> updated.
> However after some time (and this did not happen with myself but with
> one of my testers) the buttons just didn't work anymore. He had to
> remove the widget from and add it again (no re-install) and it fixed
> the problem.
>
> So I was thinking about two possible places where it might go wrong:
> 1) First off all I was thinking that the linking with the buttons to
> an activity through an intent maybe isn't the right way. Anyone who
> knows?
> 2) And secondly because there is always large period between when it
> was working and when it wasn't anymore (a few hours at least) I was
> wondering if it could have anything to do with the updatePeriod set in
> the widget info xml file (http://code.google.com/p/
> workregistrationwidget-android/source/browse/trunk/
> WorkRegistrationWidgetAndroid/res/xml/
> work_registration_widget_info.xml) altough it is set to 24 hours.
>
> I should mention that I tested it on Android 1.5, 1.6 (only for a
> small amount time in the emulator), 2.1 and 2.2 and I can't reproduce
> the issue he's having.
>
> Anyone who has any idea cause I'm not seeing any solution anymore?!!

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

2010-05-28 Thread Dirk Vranckaert
Hey all,

I'm currently working on a widget/application and I have an issue with
that.
Before I get into the issue you could check out the code which is
available just over here: 
http://code.google.com/p/workregistrationwidget-android/source/browse/

So my issue... :)
The widget contains two buttons. The linking of the buttons with an
activity happens in my widget provider (http://code.google.com/p/
workregistrationwidget-android/source/browse/trunk/
WorkRegistrationWidgetAndroid/src/eu/vranckaert/workRegistrationWidget/
widgetProvider/WorkRegistrationWidgetProvider.java). So far so good.
Clicking the buttons interacts with my activities and my widget gets
updated.
However after some time (and this did not happen with myself but with
one of my testers) the buttons just didn't work anymore. He had to
remove the widget from and add it again (no re-install) and it fixed
the problem.

So I was thinking about two possible places where it might go wrong:
1) First off all I was thinking that the linking with the buttons to
an activity through an intent maybe isn't the right way. Anyone who
knows?
2) And secondly because there is always large period between when it
was working and when it wasn't anymore (a few hours at least) I was
wondering if it could have anything to do with the updatePeriod set in
the widget info xml file (http://code.google.com/p/
workregistrationwidget-android/source/browse/trunk/
WorkRegistrationWidgetAndroid/res/xml/
work_registration_widget_info.xml) altough it is set to 24 hours.

I should mention that I tested it on Android 1.5, 1.6 (only for a
small amount time in the emulator), 2.1 and 2.2 and I can't reproduce
the issue he's having.

Anyone who has any idea cause I'm not seeing any solution anymore?!!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 update a Widget dynamically (Not waiting 30 min for onUpdate to be called)?

2010-05-28 Thread Dirk Vranckaert
I think String is right about that. I wouldn't do that either just to
save battery life!

However I think it is better to set the update interval of the applet
to a high enough amount of time (like 24 hours or sth) and just update
the widget manually. I'm currently working on a widget to and in my
case the widget only receives an update upon clicking a certain
button.

The way I do that is like this:

RemoteViews rv = new RemoteViews(context.getPackageName(), WIDGET);
rv.setTextViewText(R.id.textField, "Updated value for some text on the
widget");
ComponentName cn = new ComponentName(context, YourActivity.class);
AppWidgetManager mgr = AppWidgetManager.getInstance(context);
mgr.updateAppWidget(cn, rv);

That should basically work to update a widget.
Oh and one tip: using the this method you should do all updating just
after the line "rv.setTextViewText(...)". If you execute this entire
block a few times after each other you can get into troubles when
updating the widget.

Dirk

On 28 mei, 23:40, String  wrote:
> Before you get too far into this, you need to be aware that the widget
> architecture isn't designed to update that frequently. There's a lot
> of overhead, and updating every ten seconds will seriously impact
> battery life. As will having a service continually running in the
> background, for that matter.
>
> It's a cool idea but I'm not sure it's well suited for a widget,
> unfortunately.
>
> String
>
> On May 28, 2:43 pm, "draf...@gmail.com"  wrote:
>
>
>
> > I am currently learning about widgets in Android.
>
> > I want to create a WIFI widget that will display the SSID, the RSSI
> > (Signal) level.
>
> > But I also want to be able to send it data from a service I am running
> > that calculates the Quality of Sound over wifi.
>
> > Here is what I have after some reading and a quick tutorial:
>
> > ---
>
> >     public class WlanWidget extends AppWidgetProvider{
>
> >         RemoteViews remoteViews;
> >         AppWidgetManager appWidgetManager;
> >         ComponentName thisWidget;
> >         WifiManager wifiManager;
>
> >         public void onUpdate(Context context, AppWidgetManager
> > appWidgetManager,
> >                         int[] appWidgetIds) {
> >                         Timer timer = new Timer();
> >                         timer.scheduleAtFixedRate(new WlanTimer(context, 
> > appWidgetManager),
> > 1, 1);
>
> >         }
>
> >         private class WlanTimer extends TimerTask{
>
> >                         RemoteViews remoteViews;
> >                         AppWidgetManager appWidgetManager;
> >                         ComponentName thisWidget;
>
> >         public WlanTimer(Context context, AppWidgetManager appWidgetManager)
> > {
>
> >                         this.appWidgetManager = appWidgetManager;
> >                         remoteViews = new 
> > RemoteViews(context.getPackageName(),
> > R.layout.widget);
> >                         thisWidget = new ComponentName(context, 
> > WlanWidget.class);
> >                         wifiManager =
> > (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
>
> >         }
>
> >         @Override
> >         public void run() {
>
> >                         remoteViews.setTextViewText(R.id.widget_textview,
> >                         wifiManager.getConnectionInfo().getSSID());
> >                         appWidgetManager.updateAppWidget(thisWidget, 
> > remoteViews);
> >         }
>
> >         }
>
> > ---
>
> > The above seems to work ok, it updates the SSID on the widget every 10
> > seconds.
>
> > However what is the most efficent way to get the information from my
> > service that will be already running to update periodically on my
> > widget?
>
> > Also is there a better approach to updating the the widget rather than
> > using a timer and timertask? (Avoid polling)

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

2010-05-27 Thread Dirk Vranckaert
TreKing,

Thanks for your reply.
So currently I already have one application available in the market,
written for 1.5 and higher. It requires internet access so that is
specified in the manifest file. Upon installation is does only ask for
'Network Connection'.
Altough the applet I am writing is written also for 1.5 and higher and
suddenly more access is requested upon install (access that is not
specified in the manifest and not used!).

Any explanation how this may be possible?

On 27 mei, 23:15, TreKing  wrote:
> On Thu, May 27, 2010 at 2:37 PM, Dirk Vranckaert
> wrote:
>
> > Can anyone have a look and tell me what I do wrong or is it just a bug?
>
> Some permissions, like the SD card one, were introduced after 1.5. To
> maintain backward compatibility, apps built for 1.5 are automatically
> granted these permissions since they didn't need them before.
>
> --- 
> --
> TreKing - Chicago transit tracking app for Android-powered 
> deviceshttp://sites.google.com/site/rezmobileapps/treking

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


[android-developers] No permissions set altough permissions requested

2010-05-27 Thread Dirk Vranckaert
Hey all,

For the current application/widget I'm creating I have not set any
permissions yet, altough the apk files I have already generated (for
example this one:
http://code.google.com/p/workregistrationwidget-android/downloads/detail?name=WorkRegistrationWidgetAndroid-preAlphaBuild-4.apk&can=2&q=)
on install it notifies the users that it requests both SD card access
and phone state access. The application source is available here:
http://code.google.com/p/workregistrationwidget-android/

Can anyone have a look and tell me what I do wrong or is it just a
bug?

Kind regards,

Dirk

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

2010-05-27 Thread Dirk Vranckaert
Ok time will tell, but at first sight it seems to work :)

But what I was wondering:
Your explanation makes total sense to me but however how can this
cause the applet to work fine (with only one existing instance) for
hours and hours (almost 24hours at once) and then suddenly the buttons
do not work anymore. How is tat possible?
Can it have something to do with the updateInterval set?

Kind regards,

Dirk

On 27 mei, 20:44, Kostya Vasilyev  wrote:
> Hi,
>
> Looks like your code updates the widget using two steps: pending intents and
> then the current data state.
>
> You need to make sure that each RemoteViews update specifies complete state,
> including all pending intents.
>
> So in this case, just create only one remote views object per update, and
> use it to push both pending intents and current data.
>
> 27.05.2010 22:02 пользователь "Dirk Vranckaert" 
> написал:
>
> Hey all,
>
> I'm currently developing an Android widget but I am experiencing some
> issues.
> So when I added the widget to my desktop (both on emulator and real
> devices) the first time it always works. However sometimes it stops
> working, sometimes when you remove it and add it again it doesn't work
> anymore.
>
> A little more into detail.
> My widget has 2 buttons. Upon clicking those buttons an activity gets
> launched. The code that configures this is available over 
> here:http://pastebin.com/TWp4mLDH
> However when I say the widget does not work anymore, what I mean is
> that clicking one of the buttons does not result in an activity
> getting started. The widget-buttons light up orange as should be but
> no activity gets started.
>
> Here you can see the logs when I add the widget to the phone, in the
> first part of the log it does work, in the second part it doesn't.
> Altough I cannot see any difference in the logging ==> 
> LOGS:http://pastebin.com/z2yxzjsi
>
> All the project's code is available over 
> here:http://code.google.com/p/workregistrationwidget-android/
>
> I really can't think of anything I would be doing wrong!
>
> Kind regards,
>
> Dirk
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com cr...@googlegroups.com>
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Widget won't start properly some times

2010-05-27 Thread Dirk Vranckaert
Hey all,

I'm currently developing an Android widget but I am experiencing some
issues.
So when I added the widget to my desktop (both on emulator and real
devices) the first time it always works. However sometimes it stops
working, sometimes when you remove it and add it again it doesn't work
anymore.

A little more into detail.
My widget has 2 buttons. Upon clicking those buttons an activity gets
launched. The code that configures this is available over here:
http://pastebin.com/TWp4mLDH
However when I say the widget does not work anymore, what I mean is
that clicking one of the buttons does not result in an activity
getting started. The widget-buttons light up orange as should be but
no activity gets started.

Here you can see the logs when I add the widget to the phone, in the
first part of the log it does work, in the second part it doesn't.
Altough I cannot see any difference in the logging ==> LOGS:
http://pastebin.com/z2yxzjsi

All the project's code is available over here:
http://code.google.com/p/workregistrationwidget-android/

I really can't think of anything I would be doing wrong!

Kind regards,

Dirk

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

2010-04-19 Thread Dirk Vranckaert
Thx Mark, that did it for me :)

On 17 apr, 19:18, Mark Murphy  wrote:
> Dirk Vranckaert wrote:
> > On my widget I'm having a button and a textView. When clicking that
> > button some data is registered and I want the TextView to be updated.
> > However I can't get to the TextView instance from within my Activity
> > it seems.
>
> > Any ideas?
>
> Use a RemoteViews, as that is the only way to update an app widget.
>
> ComponentName me=new ComponentName(this, AppWidget.class);
> RemoteViews updateViews=new RemoteViews("apt.tutorial", R.layout.widget);
> AppWidgetManager mgr=AppWidgetManager.getInstance(this);
>
> // populate the RemoteViews
>
> mgr.updateAppWidget(me, updateViews);
>
> You will need to substitute in appropriate values for AppWidget and
> apt.tutorial, but you should have most of that from your IntentService
> or AppWidgetProvider already.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android 2.x Programming 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 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Modifying components on widget from activity

2010-04-17 Thread Dirk Vranckaert
On my widget I'm having a button and a textView. When clicking that
button some data is registered and I want the TextView to be updated.
However I can't get to the TextView instance from within my Activity
it seems.

Any ideas?

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

2010-04-17 Thread Dirk Vranckaert
Sorry all for bothering.
I didn't look well enough in this group, now I found the answer:
http://groups.google.com/group/android-developers/browse_thread/thread/8ac30e3b1870fb98/1cc71bab92a7ff97?lnk=gst&q=Starting+activity+without+layout#1cc71bab92a7ff97

:)

On 17 apr, 18:45, Dirk Vranckaert  wrote:
> I recently (yesterday in fact :)) started creating widgets. So my
> first widget I want to create is something like:
> * A 2x2 widget
> * Containing 2 buttons
>     * Button 1: Register current time and location
>     * Button 2: Open up an activity where configuration can be
> modified, registered times and location can be viewed,...
>
> Now the problem for me is button 1. As I only try to do some
> registration data (so no further user input required after pressing
> the button) I would like to just show a loading bar and after wards
> Toast a message to screen, or a popup if anything goes wrong.
> This is what I do now:
> * In my widgetProvider
> Intent intent = new Intent(context, LogDataActivity.class);
> PendingIntent pintent = PendingIntent.getActivity(context, 0, intent,
> 0);
>
> RemoteViews views = new RemoteViews(context.getPackageName(),
> R.layout.my_widget_view);
> views.setOnClickPendingIntent(R.id.startButton, pintent);
>
> * In my LogDataActivity class
>     public void onCreate(Bundle savedInstanceState) {
>                 super.onCreate(savedInstanceState);
>
>                 //Do some of my stuff
>
>                 Toast.makeText(LogDataActivity.this, "Success",
> Toast.LENGTH_LONG).show();
>
>                 super.finish();
>         }
>
> So what happens: I click the button, a plain black screen pops up
> (Altough I did not specify a layout upon creating the activity), and
> after my work is done the Toast shows up and the activity gets
> 'killed'.
> Basically that is what I want to do except for the black screen to
> show up. Is it possible not to show a screen upon creating the
> activity?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Starting activity witouth window from widget

2010-04-17 Thread Dirk Vranckaert
I recently (yesterday in fact :)) started creating widgets. So my
first widget I want to create is something like:
* A 2x2 widget
* Containing 2 buttons
* Button 1: Register current time and location
* Button 2: Open up an activity where configuration can be
modified, registered times and location can be viewed,...

Now the problem for me is button 1. As I only try to do some
registration data (so no further user input required after pressing
the button) I would like to just show a loading bar and after wards
Toast a message to screen, or a popup if anything goes wrong.
This is what I do now:
* In my widgetProvider
Intent intent = new Intent(context, LogDataActivity.class);
PendingIntent pintent = PendingIntent.getActivity(context, 0, intent,
0);

RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.my_widget_view);
views.setOnClickPendingIntent(R.id.startButton, pintent);

* In my LogDataActivity class
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

//Do some of my stuff

Toast.makeText(LogDataActivity.this, "Success",
Toast.LENGTH_LONG).show();

super.finish();
}

So what happens: I click the button, a plain black screen pops up
(Altough I did not specify a layout upon creating the activity), and
after my work is done the Toast shows up and the activity gets
'killed'.
Basically that is what I want to do except for the black screen to
show up. Is it possible not to show a screen upon creating the
activity?

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


[android-developers] Re: Custom Dialog

2010-03-15 Thread Dirk Vranckaert
Thx a lot, this works!

On 15 mrt, 22:15, Adrian Vintu  wrote:
> This one hs been answered a couple of times on this forum.
>
> Use
> dialog = new Dialog(this);
> instead of
> dialog = new Dialog(getApplicationContext());
>
> BR,
> Adrian Vintu
>
> http://adrianvintu.com
>
> On Mon, Mar 15, 2010 at 10:05 PM, Dirk Vranckaert
> wrote:
>
> > Thx for the quick response but doesn't change a thing, it gives me
> > exactly the same exception!
>
> > On 15 mrt, 21:58, Kumar Bibek  wrote:
> > > Try getBaseContext();
>
> > > Thanks and Regards,
> > > Kumar Bibek
>
> > > On Mar 16, 1:50 am, Dirk Vranckaert  wrote:
>
> > > > I'm trying to create a custom dialog in my application to show an
> > > > about window but it ain't working. Maybe one of you knows a solution?
>
> > > > So I have an activity with the onCreateDialog(int id) overriden in it:
>
> > > >         @Override
> > > >         protected Dialog onCreateDialog(int id) {
> > > >                 Dialog dialog = null;
> > > >                 switch (id) {
> > > >                         case EPISODE_LOADING_DIALOG:
> > > >                                 ...
> > > >                         case EXCEPTION_DIALOG:
> > > >                                 ...
> > > >                         case ABOUT_DIALOG:
> > > >                                 dialog = new
> > Dialog(getApplicationContext());
>
> > dialog.setContentView(R.layout.aboutdialog);
> > > >                                 dialog.setTitle("MyTitle");
> > > >                                 break;
> > > >                         default:
> > > >                                 ...
> > > >                 }
> > > >                 return dialog;
> > > >         }
>
> > > > My aboutdialog layout files looks like this:
>
> > > > http://schemas.android.com/apk/res/
> > > > android"
> > > >               android:orientation="vertical"
> > > >               android:layout_width="fill_parent"
> > > >               android:layout_height="fill_parent"
> > > >               android:padding="10dp"
>
> > > >      > > >               android:layout_width="wrap_content"
> > > >               android:layout_height="fill_parent"
> > > >               android:textColor="#FFF"
> > > >               android:text="@string/aboutText"
> > > >               />
> > > > 
>
> > > > This is exactly as described here:
> >http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog
> > > > However this my exception thrown:
>
> > > > 03-15 21:48:32.055: ERROR/AndroidRuntime(2004): Uncaught handler:
> > > > thread main exiting due to uncaught exception
> > > > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):
> > > > android.view.WindowManager$BadTokenException: Unable to add window --
> > > > token null is not for an application
> > > > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > > > android.view.ViewRoot.setView(ViewRoot.java:429)
> > > > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > > > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:178)
> > > > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > > > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
> > > > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > > > android.app.Dialog.show(Dialog.java:231)
> > > > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > > > android.app.Activity.showDialog(Activity.java:2407)
> > > > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
>
> > eu.vranckaert.episodeWatcher.EpisodesWatchListActivity.onOptionsItemSelected(EpisodesWatchListActivity.java:
> > > > 130)
> > > > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > > > android.app.Activity.onMenuItemSelected(Activity.java:2085)
> > > > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
>
> > com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:
> > > > 820)
> > > > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > > > com.android.internal.view.menu.MenuItemImpl.invoke(MenuItem

[android-developers] Re: Custom Dialog

2010-03-15 Thread Dirk Vranckaert
Thx for the quick response but doesn't change a thing, it gives me
exactly the same exception!

On 15 mrt, 21:58, Kumar Bibek  wrote:
> Try getBaseContext();
>
> Thanks and Regards,
> Kumar Bibek
>
> On Mar 16, 1:50 am, Dirk Vranckaert  wrote:
>
> > I'm trying to create a custom dialog in my application to show an
> > about window but it ain't working. Maybe one of you knows a solution?
>
> > So I have an activity with the onCreateDialog(int id) overriden in it:
>
> >         @Override
> >         protected Dialog onCreateDialog(int id) {
> >                 Dialog dialog = null;
> >                 switch (id) {
> >                         case EPISODE_LOADING_DIALOG:
> >                                 ...
> >                         case EXCEPTION_DIALOG:
> >                                 ...
> >                         case ABOUT_DIALOG:
> >                                 dialog = new 
> > Dialog(getApplicationContext());
> >                                 dialog.setContentView(R.layout.aboutdialog);
> >                                 dialog.setTitle("MyTitle");
> >                                 break;
> >                         default:
> >                                 ...
> >                 }
> >                 return dialog;
> >         }
>
> > My aboutdialog layout files looks like this:
>
> > http://schemas.android.com/apk/res/
> > android"
> >               android:orientation="vertical"
> >               android:layout_width="fill_parent"
> >               android:layout_height="fill_parent"
> >               android:padding="10dp"
> >               >
> >      >               android:layout_width="wrap_content"
> >               android:layout_height="fill_parent"
> >               android:textColor="#FFF"
> >               android:text="@string/aboutText"
> >               />
> > 
>
> > This is exactly as described 
> > here:http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog
> > However this my exception thrown:
>
> > 03-15 21:48:32.055: ERROR/AndroidRuntime(2004): Uncaught handler:
> > thread main exiting due to uncaught exception
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):
> > android.view.WindowManager$BadTokenException: Unable to add window --
> > token null is not for an application
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > android.view.ViewRoot.setView(ViewRoot.java:429)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:178)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > android.app.Dialog.show(Dialog.java:231)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > android.app.Activity.showDialog(Activity.java:2407)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > eu.vranckaert.episodeWatcher.EpisodesWatchListActivity.onOptionsItemSelected(EpisodesWatchListActivity.java:
> > 130)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > android.app.Activity.onMenuItemSelected(Activity.java:2085)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:
> > 820)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:
> > 139)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:
> > 813)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:
> > 519)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:
> > 122)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > android.view.View.onTouchEvent(View.java:3828)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > android.widget.TextView.onTouchEvent(TextView.java:6291)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
> > android.view.View.dispatchTouchEvent(View.java:3368)
> > 03-15 21:48:32.130: ERROR/AndroidRuntime(2004):     at
>

[android-developers] Custom Dialog

2010-03-15 Thread Dirk Vranckaert
I'm trying to create a custom dialog in my application to show an
about window but it ain't working. Maybe one of you knows a solution?

So I have an activity with the onCreateDialog(int id) overriden in it:

@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog = null;
switch (id) {
case EPISODE_LOADING_DIALOG:
...
case EXCEPTION_DIALOG:
...
case ABOUT_DIALOG:
dialog = new Dialog(getApplicationContext());
dialog.setContentView(R.layout.aboutdialog);
dialog.setTitle("MyTitle");
break;
default:
...
}
return dialog;
}

My aboutdialog layout files looks like this:

http://schemas.android.com/apk/res/
android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:padding="10dp"
  >



This is exactly as described here: 
http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog
However this my exception thrown:

03-15 21:48:32.055: ERROR/AndroidRuntime(2004): Uncaught handler:
thread main exiting due to uncaught exception
03-15 21:48:32.130: ERROR/AndroidRuntime(2004):
android.view.WindowManager$BadTokenException: Unable to add window --
token null is not for an application
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.view.ViewRoot.setView(ViewRoot.java:429)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:178)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.app.Dialog.show(Dialog.java:231)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.app.Activity.showDialog(Activity.java:2407)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
eu.vranckaert.episodeWatcher.EpisodesWatchListActivity.onOptionsItemSelected(EpisodesWatchListActivity.java:
130)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.app.Activity.onMenuItemSelected(Activity.java:2085)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:
820)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:
139)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:
813)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:
519)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:
122)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.view.View.onTouchEvent(View.java:3828)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.widget.TextView.onTouchEvent(TextView.java:6291)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.view.View.dispatchTouchEvent(View.java:3368)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchTouchEvent(PhoneWindow.java:1691)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1525)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.os.Handler.dispatchMessage(Handler.java:99)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.os.Looper.loop(Looper.java:123)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
android.app.ActivityThread.main(ActivityThread.java:3948)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
java.lang.reflect.Method.invokeNative(Native Method)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
java.lang.reflect.Method.invoke(Method.java:521)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:782)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
03-15 21:48:32.130: ERROR/AndroidRuntime(2004): at
dalvik.system.NativeStart.main(Native Method)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group,

  1   2   >