[android-developers] Writing to External SD
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
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 dirkvrancka...@gmail.com 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
Re: [android-developers] PendingIntent launched from widget causes onActivityResult to not be called
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 treking...@gmail.com 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
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 treking...@gmail.com 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
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 treking...@gmail.com 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
[android-developers] PendingIntent launched from widget causes onActivityResult to not be called
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
[android-developers] Re: Ant build fails since upgrading SDK to latest revision
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) https://lh3.googleusercontent.com/-Lz-4MOMEchs/T36KvVLLkUI/AaA/cxHWXwvIxjs/s1600/decompile_manual_build.png On the second screenshot you can see a decompile of the APK that Ant generated during the test-build: https://lh5.googleusercontent.com/-QeLmmkdDpgA/T36K6CXSTSI/AaM/M5fOIBLq-jU/s1600/decompile_ant_build.png 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
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: application android:label=Worktime android:icon=@drawable/logo 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] Re: Writing files in UTF-8
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
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
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] Writing files in UTF-8
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
Re: [android-developers] Writing files in UTF-8
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 dirkvrancka...@gmail.com写道: 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] Re: Writing files in UTF-8
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
[android-developers] Re: Writing files in UTF-8
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
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=enStartdate;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
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
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: Android instrumentation testing, how to start with clean database all the time
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
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
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)
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 nikolay.elen...@gmail.com wrote: On Thu, Feb 9, 2012 at 12:51 AM, Dirk Vranckaert dirkvrancka...@gmail.com 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)
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 nikolay.elen...@gmail.com wrote: On Wed, Feb 8, 2012 at 4:53 PM, Dirk Vranckaert dirkvrancka...@gmail.com 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)
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] Re: nullpointer on getPreferenceManager() in sdk 13 and up
Thank Mark, that did indeed help! On Jan 31, 3:37 pm, Mark Murphy mmur...@commonsware.com 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 dirkvrancka...@gmail.com 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] Customize Android PreferenceFragementActivity not working
} at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:822) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032) at android.app.BackStackRecord.run(BackStackRecord.java:622) at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java: 1382) at android.app.Activity.performStart(Activity.java:4474) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 1929) ... 11 more for tablet: 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] nullpointer on getPreferenceManager() in sdk 13 and up
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: Permission Denial: starting Intent when launching my activity from my widget
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 kmans...@gmail.com wrote: From those logcat messages, I'd think that you have android:permission attributes on the activity or application 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 xfsuno...@gmail.com 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] Permission Denial: starting Intent when launching my activity from my widget
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 the
[android-developers] Re: Permission Denial: starting Intent when launching my activity from my widget
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 xfsuno...@gmail.com 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] Using sd-card in 4.0 emulator
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: Using sd-card in 4.0 emulator
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 mmur...@commonsware.com wrote: On Thu, Jan 5, 2012 at 9:14 AM, Dirk Vranckaert dirkvrancka...@gmail.com 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] Re: Using sd-card in 4.0 emulator
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 mmur...@commonsware.com wrote: On Thu, Jan 5, 2012 at 9:25 AM, Dirk Vranckaert dirkvrancka...@gmail.com 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
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 dirkvrancka...@gmail.com 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 mmur...@commonsware.com wrote: On Thu, Jan 5, 2012 at 9:25 AM, Dirk Vranckaert dirkvrancka...@gmail.com 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
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 mmur...@commonsware.com wrote: On Thu, Jan 5, 2012 at 9:42 AM, Dirk Vranckaert dirkvrancka...@gmail.com 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: Slow scrolling in Date/TimePicker using Holo theme
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 mjholg...@gmail.com 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
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: ScrollView xmlns:android=http://schemas.android.com/apk/res/android; android:layout_width=fill_parent android:layout_height=fill_parent LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical !-- Content... -- DatePicker android:layout_width=fill_parent android:layout_height=wrap_content/ TimePicker android:layout_width=fill_parent android:layout_height=wrap_content/ !-- Content... -- /LinearLayout /ScrollView 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] Transparent background issue with image in 2.2, not 2.3
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] Intent Flags ignored coming from an widget?
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: Intent Flags ignored coming from an widget?
Anyone? Can't figure out why it isnt working... :s On Feb 9, 8:19 pm, Dirk Vranckaert dirkvrancka...@gmail.com 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] ListView items appear 2 or 3 times
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 ListLabel 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 ArrayAdapterLabel { private final String LOG_TAG = ManageLabelsListAdapter.class.getSimpleName(); /** * {@inheritDoc} */ public ManageLabelsListAdapter(ListLabel 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: ListView items appear 2 or 3 times
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 kmans...@gmail.com 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 ListLabel 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 ArrayAdapterLabel { private final String LOG_TAG = ManageLabelsListAdapter.class.getSimpleName(); /** * {@inheritDoc} */ public ManageLabelsListAdapter(ListLabel 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; } } -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com
[android-developers] Re: ListView items appear 2 or 3 times
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 ArrayAdapterLabel { private final String LOG_TAG = ManageLabelsListAdapter.class.getSimpleName(); /** * {@inheritDoc} */ public ManageLabelsListAdapter(ListLabel 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 dirkvrancka...@gmail.com 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 kmans...@gmail.com 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 ListLabel 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
[android-developers] Android Calendar widget
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] Android Calendar widget
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] Intercept launching of apps
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
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 dirkvrancka...@gmail.com 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
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 dirkvrancka...@gmail.com 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
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 patrick.boul...@gmail.com 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 dirkvrancka...@gmail.com 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] Google Maps: Let the user choose a location
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
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: Stalling widget buttons after some time
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?
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 kmans...@gmail.com 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/widget.xml, using appwidget-provider minWidth minHeight. 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 jpbwebs...@gmail.com 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.comandroid-developers%2Bunsubs 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
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 dstefa...@gmail.com 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 dirkvrancka...@gmail.com 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: How to update a Widget dynamically (Not waiting 30 min for onUpdate to be called)?
Kostya, at first sight, that helped! Thanks a lot for pointing me that out! Greetz.. Dirk On 29 mei, 11:04, Kostya Vasilyev kmans...@gmail.com 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 dirkvrancka...@gmail.com 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 sterling.ud...@gmail.com 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 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.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android
[android-developers] Re: How to update a Widget dynamically (Not waiting 30 min for onUpdate to be called)?
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 sterling.ud...@gmail.com 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 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] Stalling widget buttons after some time
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: Stalling widget buttons after some time
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 dirkvrancka...@gmail.com 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] Widget won't start properly some times
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: Widget won't start properly some times
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 kmans...@gmail.com 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 dirkvrancka...@gmail.com написал: 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.comandroid-developers%2Bunsubs 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] No permissions set altough permissions requested
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.apkcan=2q=) 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: No permissions set altough permissions requested
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 treking...@gmail.com wrote: On Thu, May 27, 2010 at 2:37 PM, Dirk Vranckaert dirkvrancka...@gmail.comwrote: 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] Re: Modifying components on widget from activity
Thx Mark, that did it for me :) On 17 apr, 19:18, Mark Murphy mmur...@commonsware.com 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] Starting activity witouth window from widget
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: Starting activity witouth window from widget
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=gstq=Starting+activity+without+layout#1cc71bab92a7ff97 :) On 17 apr, 18:45, Dirk Vranckaert dirkvrancka...@gmail.com 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] Modifying components on widget from activity
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] Custom Dialog
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: LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:padding=10dp TextView android:id=@+id/aboutText android:layout_width=wrap_content android:layout_height=fill_parent android:textColor=#FFF android:text=@string/aboutText / /LinearLayout 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
[android-developers] Re: Custom Dialog
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 coomar@gmail.com wrote: Try getBaseContext(); Thanks and Regards, Kumar Bibek On Mar 16, 1:50 am, Dirk Vranckaert dirkvrancka...@gmail.com 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: LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:padding=10dp TextView android:id=@+id/aboutText android:layout_width=wrap_content android:layout_height=fill_parent android:textColor=#FFF android:text=@string/aboutText / /LinearLayout 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
[android-developers] Re: Custom Dialog
Thx a lot, this works! On 15 mrt, 22:15, Adrian Vintu adrianvi...@gmail.com 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 dirkvrancka...@gmail.comwrote: 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 coomar@gmail.com wrote: Try getBaseContext(); Thanks and Regards, Kumar Bibek On Mar 16, 1:50 am, Dirk Vranckaert dirkvrancka...@gmail.com 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: LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:padding=10dp TextView android:id=@+id/aboutText android:layout_width=wrap_content android:layout_height=fill_parent android:textColor=#FFF android:text=@string/aboutText / /LinearLayout 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
[android-developers] Creating dialogs from a thread
I'm working on an application which loads some data from the net in a thread. However when something goes wrong (no internet connection or sth) I'dd like to create a dialog to show an error message to the user. However my code works fine not using threads but creating a dialog from my thread makes my application crashing. In my activity I have overwritten the onCreateDialog method and looks like this: @Override protected Dialog onCreateDialog(int id) { Dialog dialog = null; switch (id) { case EPISODE_LOADING_DIALOG: ProgressDialog progressDialog = new ProgressDialog(this); progressDialog.setMessage(this.getString (R.string.progressLoadingTitle)); //progressDialog.setTitle(R.string.progressLoadingTitle); dialog = progressDialog; break; case EXCEPTION_DIALOG: if (exceptionMessageResId == null) { exceptionMessageResId = R.string.defaultExceptionMessage; } AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.exceptionDialogTitle) .setMessage(exceptionMessageResId) .setCancelable(false) .setPositiveButton(R.string.dialogOK, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); exceptionMessageResId = null; default: dialog = super.onCreateDialog(id); } return dialog; } The method which is calling a method and catching an exception (within a thread): private void getEpisodes() { try { episodes = myEpisodesService.retrieveEpisodes(user); } catch (InternetConnectivityException e) { String message = Could not connect to host; Log.e(LOG_TAG, message, e); exceptionMessageResId = R.string.internetConnectionFailureReload; showDialog(EXCEPTION_DIALOG); } runOnUiThread(returnEpisodes); } So does anyone of you guys knows what I am doing wrong here? Can't you create a dialog from within a thread? If so, what's the best way of handling my exceptions here? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Creating dialogs from a thread
I certainly will try it out later this evening (studying for my certification right now) but is there any more detailed/advanced explanation about why I can't run a bunch of code in a thread and at the end of the thread start a dialog? Why I have to start a nested thread with just the dialog creation? :s Still don't really get the reason why... Anyway thx in advance for giving me a possible working solution, and I'll certainly keep you informed if it did the job for me (later this evening). On 21 jan, 19:47, TreKing treking...@gmail.com wrote: On Thu, Jan 21, 2010 at 12:28 PM, Dirk Vranckaert dirkvrancka...@gmail.comwrote: So if I understand you correct I should run two nested threads to show the dialog? Yup. So instead of showDialog(int) in the thread, do runOnUiThread(someThread); where someThread just calls showDialog(int) in it's run method. Yes, it's annoying and messy, but you can't do UI related operations in separate threads, so there you go. - 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] Re: Creating dialogs from a thread
It seems your solution does not work either. As long as I'm doing it in a thread it doesn't work. Altough what I tried next was setting the error message for the user in my catch clause. And right after the thread finished I handled the showing of the errors based on wheater some error message was set or not! Thx for your help! (If you get me some advanced explanation on why dialogs cannot be created from within a thread plz let me know!) On 21 jan, 20:47, Dirk Vranckaert dirkvrancka...@gmail.com wrote: I certainly will try it out later this evening (studying for my certification right now) but is there any more detailed/advanced explanation about why I can't run a bunch of code in a thread and at the end of the thread start a dialog? Why I have to start a nested thread with just the dialog creation? :s Still don't really get the reason why... Anyway thx in advance for giving me a possible working solution, and I'll certainly keep you informed if it did the job for me (later this evening). On 21 jan, 19:47, TreKing treking...@gmail.com wrote: On Thu, Jan 21, 2010 at 12:28 PM, Dirk Vranckaert dirkvrancka...@gmail.comwrote: So if I understand you correct I should run two nested threads to show the dialog? Yup. So instead of showDialog(int) in the thread, do runOnUiThread(someThread); where someThread just calls showDialog(int) in it's run method. Yes, it's annoying and messy, but you can't do UI related operations in separate threads, so there you go. - 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] ListView
Hi all there, I'm trying to use a ListView but can't get it to work. Is there any good example? I get some data from the web and then want to parse it into the ListView. The way I tried it was with a custom written ArrayAdapter but I then get some rendering issues, for example no data is shown and when I start to scroll the data is filled in in some rows but the not the data belonging it that row and that kind of stuf. Any good example or ideas to help me going? 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: ListView
Some extra help: watchlist.xml = http://pastebin.com/f738bc9d6 episode_row.xml = http://pastebin.com/f27442ce7 the activity: http://pastebin.com/f53a0df 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: ListView
Here is an excerpt from one of my books that discusses the process: http://commonsware.com/Android/excerpt.pdf I tried the examples coming with the SDK in combination with some more advanced stuff I found online but didn't work. I now had a look at Mark's PDF and modified some things and found my main/biggest problem: This is how I retrieved the TextView element of each row: TextView topText = (TextView) findViewById(R.id.episodeRowTitle); And this is what it should be (watch the 'row.'): TextView topText = (TextView) row.findViewById(R.id.episodeRowTitle); So I guess beceause I forgot the 'row.' I go my first created row and had it overwritten all the time. Is that correct? ViewHolders that give you better performance but are harder to grasp. Christine, I will certainly give this a test now I got my ListView working! Thx a lot all!! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en