Re: [android-developers] no domain
Just create one as you whant. What people usually do is: com.NameOfYourCompany.NameOfYoutSoftware But basically you can put whatever you want. Best regards. Em 02/01/2013 04:12, bob b...@coolfone.comze.com escreveu: What is the convention for naming your APK package if you don't have your own domain name? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Image background (not 9-patch) for an AppWidget
I created a file digital_clock_background.xml (inside res/drawable) and put this code: ?xml version=1.0 encoding=utf-8? shape xmlns:android=http://schemas.android.com/apk/res/android; android:padding=10dp android:shape=rectangle solid android:color=#00 / stroke android:width=2dp android:color=#00 / padding android:bottom=1dp android:left=1dp android:right=1dp android:top=1dp / corners android:radius=10dp / /shape So my AppWidget layout is basically: ?xml version=1.0 encoding=utf-8? RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/rllWidgetBigger android:layout_width=match_parent android:layout_height=match_parent android:layout_margin=@dimen/widget_margin android:background=@drawable/digital_clock_background ImageView android:id=@+id/imgBackGroundBigger android:layout_width=fill_parent android:layout_height=fill_parent android:layout_alignParentBottom=true android:layout_alignParentLeft=true android:layout_alignParentRight=true android:layout_alignParentTop=true android:contentDescription=@string/app_name android:scaleType=centerCrop android:src=@drawable/digital_andromeda_galaxy_m31 / /RelativeLayout And, well, the RelativeLayout now have rounded corners, but the ImageView doesn't. And it's corners are coming out of the RelativeLayout... Is there anyway to correct it (without putting more padding)? Thanks! Em terça-feira, 4 de dezembro de 2012 00h19min37s UTC-2, Mário César Mancinelli de Araújo escreveu: Hi everyone. It's really not a code issue, but a layout one. So, if anyone could help me, it would be nice. The thing is that I'm gonna have to use an image, an picture, as background for an AppWidget. So, basically, I'm gonna use an ImageView to show the image, setting the scale type to CENTER_CROP. Everything else (TextViews and so on) go on top of that. The problem is that I will need to show a border in the AppWidget, with rounded corners. So, what's the best way of doing that? The only way I can think of is to use a black 9-patch as background of the RelativeLayout (were the ImageView is going to be inside of) and set a small padding to it... But I don't know if it's going to be good enough... So... Any ideas? Thanks in advance! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Image background (not 9-patch) for an AppWidget
Not really... First of all, how do I discover the value of pixels? Because it depends on the Android version, on the manufacture of the equipament... And, most important, I don't have access to the ImageView (I can set properties, but not get because of the RemoteViews). Other thing is that the format (if it is a rectangle or a square) will depend on the AppWidget's minHeight and minWidth. And the images are square and I set scale type to center crop. So... I really don't know if it's possible to solve the problem like this. :/ But thanks anyway. ;) Em 06/12/2012 04:30, vinay kumar vk872...@gmail.com escreveu: Hi, They are number of solution available online but one of them is to recreate a your bitmap with rounded corners. public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int pixels) { Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap .getHeight(), Config.ARGB_); Canvas canvas = new Canvas(output); final int color = 0xff424242; final Paint paint = new Paint(); final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); final RectF rectF = new RectF(rect); final float roundPx = pixels; paint.setAntiAlias(true); canvas.drawARGB(0, 0, 0, 0); paint.setColor(color); canvas.drawRoundRect(rectF, roundPx, roundPx, paint); paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); canvas.drawBitmap(bitmap, rect, rect, paint); return output; } Hope this helps! On Wed, Dec 5, 2012 at 7:30 PM, Mário César Mancinelli de Araújo mandaproma...@gmail.com wrote: I created a file digital_clock_background.xml (inside res/drawable) and put this code: ?xml version=1.0 encoding=utf-8? shape xmlns:android=http://schemas.android.com/apk/res/android; android:padding=10dp android:shape=rectangle solid android:color=#00 / stroke android:width=2dp android:color=#00 / padding android:bottom=1dp android:left=1dp android:right=1dp android:top=1dp / corners android:radius=10dp / /shape So my AppWidget layout is basically: ?xml version=1.0 encoding=utf-8? RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/rllWidgetBigger android:layout_width=match_parent android:layout_height=match_parent android:layout_margin=@dimen/widget_margin android:background=@drawable/digital_clock_background ImageView android:id=@+id/imgBackGroundBigger android:layout_width=fill_parent android:layout_height=fill_parent android:layout_alignParentBottom=true android:layout_alignParentLeft=true android:layout_alignParentRight=true android:layout_alignParentTop=true android:contentDescription=@string/app_name android:scaleType=centerCrop android:src=@drawable/digital_andromeda_galaxy_m31 / /RelativeLayout And, well, the RelativeLayout now have rounded corners, but the ImageView doesn't. And it's corners are coming out of the RelativeLayout... Is there anyway to correct it (without putting more padding)? Thanks! Em terça-feira, 4 de dezembro de 2012 00h19min37s UTC-2, Mário César Mancinelli de Araújo escreveu: Hi everyone. It's really not a code issue, but a layout one. So, if anyone could help me, it would be nice. The thing is that I'm gonna have to use an image, an picture, as background for an AppWidget. So, basically, I'm gonna use an ImageView to show the image, setting the scale type to CENTER_CROP. Everything else (TextViews and so on) go on top of that. The problem is that I will need to show a border in the AppWidget, with rounded corners. So, what's the best way of doing that? The only way I can think of is to use a black 9-patch as background of the RelativeLayout (were the ImageView is going to be inside of) and set a small padding to it... But I don't know if it's going to be good enough... So... Any ideas? Thanks in advance! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android
Re: [android-developers] Re: minimum hardware requirements to develop on
Thanks! I'm gonna check it out. ;-) But, anyway, looks like that to use AIDE you are going to need a bluetooth keyboard. :-\ Best regards, Mario Cesar Mancinelli de Araujo Em 04/12/2012 08:59, Russell Wheeler russellpeterwhee...@gmail.com escreveu: Mario, they have a good google group maybe they can help with this or other questions? https://groups.google.com/forum/?fromgroups=#!forum/android-ide On Monday, December 3, 2012 8:07:09 PM UTC, Mário César Mancinelli de Araújo wrote: About AIDE... I'm in travel, just with my tablet and I'm trying to start a small project, but I'm having a problem: how in hell do I add a new layout, which I'm going to use for an AppWidget? Thanks! Em 03/12/2012 16:27, Russell Wheeler russellpe...@gmail.com** escreveu: It's not called amazing AID, its called AIDE and it is amazing! haha https://play.google.com/store/**apps/details?id=com.aide.ui**hl=enhttps://play.google.com/store/apps/details?id=com.aide.uihl=en It's an IDE that you use directly on your device to code android. You then compile it there and then on your device, install the apk, and test instantly. You don't need a separate machine to develop. However, on the N7 you can't view logs, unless rooted, so hence why I want a machine I can plug in to my device and use adb logcat to help debug stuff. Also, I think I would be more productive with a full keyboard and possibly 2 screens to code on. On Monday, December 3, 2012 4:58:35 PM UTC, bob wrote: What is the amazing AID app? On Sunday, December 2, 2012 1:51:14 PM UTC-6, Russell Wheeler wrote: So far I have been developing directly on my galaxy nexus and nexus 7 using the amazing AID app. However, as the N7 can't provide logs due to it being jelly bean, i feel the need to get a mini notebook in order to utilise adb logcat. My main worry is that something with only 1gb (2gb if i upgrade, which i will) and a 1.5-1.83GHz atom CPU won't be powerful enough. I can possibly get around certain worries by not using emulators and testing directly on my two devices, so that will save me a great deal. Also I am tempted to just use vim and command line tools instead of eclipse which again might save me from a slow PC. What do you guys think? Is the notebook way under powered? What if i just use vim and no emulators? Side note, does anyone actually code in vim/command line? Cheers Russ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@**googlegroups.com To unsubscribe from this group, send email to android-developers+**unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/**group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: minimum hardware requirements to develop on
About AIDE... I'm in travel, just with my tablet and I'm trying to start a small project, but I'm having a problem: how in hell do I add a new layout, which I'm going to use for an AppWidget? Thanks! Em 03/12/2012 16:27, Russell Wheeler russellpeterwhee...@gmail.com escreveu: It's not called amazing AID, its called AIDE and it is amazing! haha https://play.google.com/store/apps/details?id=com.aide.uihl=en It's an IDE that you use directly on your device to code android. You then compile it there and then on your device, install the apk, and test instantly. You don't need a separate machine to develop. However, on the N7 you can't view logs, unless rooted, so hence why I want a machine I can plug in to my device and use adb logcat to help debug stuff. Also, I think I would be more productive with a full keyboard and possibly 2 screens to code on. On Monday, December 3, 2012 4:58:35 PM UTC, bob wrote: What is the amazing AID app? On Sunday, December 2, 2012 1:51:14 PM UTC-6, Russell Wheeler wrote: So far I have been developing directly on my galaxy nexus and nexus 7 using the amazing AID app. However, as the N7 can't provide logs due to it being jelly bean, i feel the need to get a mini notebook in order to utilise adb logcat. My main worry is that something with only 1gb (2gb if i upgrade, which i will) and a 1.5-1.83GHz atom CPU won't be powerful enough. I can possibly get around certain worries by not using emulators and testing directly on my two devices, so that will save me a great deal. Also I am tempted to just use vim and command line tools instead of eclipse which again might save me from a slow PC. What do you guys think? Is the notebook way under powered? What if i just use vim and no emulators? Side note, does anyone actually code in vim/command line? Cheers Russ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Image background (not 9-patch) for an AppWidget
Hi everyone. It's really not a code issue, but a layout one. So, if anyone could help me, it would be nice. The thing is that I'm gonna have to use an image, an picture, as background for an AppWidget. So, basically, I'm gonna use an ImageView to show the image, setting the scale type to CENTER_CROP. Everything else (TextViews and so on) go on top of that. The problem is that I will need to show a border in the AppWidget, with rounded corners. So, what's the best way of doing that? The only way I can think of is to use a black 9-patch as background of the RelativeLayout (were the ImageView is going to be inside of) and set a small padding to it... But I don't know if it's going to be good enough... So... Any ideas? Thanks in advance! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: minimum hardware requirements to develop on
Personally, I feel my productivity would be much less if I didn't use eclipse with all its bells and whistles. Agreed. There are IDEs for tablets, photo editors and so on for Android, but I personally fell lost without a mouse to do many things, mostly for image editing (to create 9-patch files for instance). More than that, there's the problem of creating layouts. Of course, most of it you can create on code, but some parts it's better do it in a UI design. Best regards. -- *Mário César Mancinelli de Araújo* Presidente da Organização Livres Pensadores - http://organizacao.livrespensadores.net/ http://livrespensadores.net/ http://projetolp.org/ *Ensine um homem a utilizar a razão e ele pensará por toda a sua vida.* *- Phil Plait* 2012/12/2 Mark Phillips m...@phillipsmarketing.biz Personally, I feel my productivity would be much less if I didn't use eclipse with all its bells and whistles. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] sqllite database with data
I'm developping an app where I need it too. It's a basic quotes app, so it has two tables: quotes and authors. What I did: created two xml with the data and, when I create the database, I read the xml and populate it. Just simple. Now I have to discover some way to discover if the app was updated and, then, delete and recreate the database. ;-) Best regards. Em 01/12/2012 11:08, Salih Gündüz gunduz.sa...@gmail.com escreveu: Web service is a good solution.But I want user can read the text when they are offline. My apllication will show some text and user can search in this text. On Sat, Dec 1, 2012 at 2:11 PM, sree android android.sreeni...@gmail.comwrote: will maintain server -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] sqllite database with data
Something I forgot: there are two xml with the data for each language, of course. And, for now, it's only Portuguese and English. Em 01/12/2012 12:20, Mário César Mancinelli de Araújo mandaproma...@gmail.com escreveu: I'm developping an app where I need it too. It's a basic quotes app, so it has two tables: quotes and authors. What I did: created two xml with the data and, when I create the database, I read the xml and populate it. Just simple. Now I have to discover some way to discover if the app was updated and, then, delete and recreate the database. ;-) Best regards. Em 01/12/2012 11:08, Salih Gündüz gunduz.sa...@gmail.com escreveu: Web service is a good solution.But I want user can read the text when they are offline. My apllication will show some text and user can search in this text. On Sat, Dec 1, 2012 at 2:11 PM, sree android android.sreeni...@gmail.com wrote: will maintain server -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] sqllite database with data
Thanks, man! It will do the job. :-D Best regards, Mario Cesar M. de Araujo Em 01/12/2012 12:30, Παύλος-Πέτρος Τουρνάρης p.tourna...@gmail.com escreveu: Mario check this out. String versionName = getPackageManager(). getPackageInfo(getPackageName(), 0).versionName; You will programmatically check for the equality of this and an old one that you have saved either using sharedpreferences or any other way you would like. On Sat, Dec 1, 2012 at 4:22 PM, Mário César Mancinelli de Araújo mandaproma...@gmail.com wrote: Something I forgot: there are two xml with the data for each language, of course. And, for now, it's only Portuguese and English. Em 01/12/2012 12:20, Mário César Mancinelli de Araújo mandaproma...@gmail.com escreveu: I'm developping an app where I need it too. It's a basic quotes app, so it has two tables: quotes and authors. What I did: created two xml with the data and, when I create the database, I read the xml and populate it. Just simple. Now I have to discover some way to discover if the app was updated and, then, delete and recreate the database. ;-) Best regards. Em 01/12/2012 11:08, Salih Gündüz gunduz.sa...@gmail.com escreveu: Web service is a good solution.But I want user can read the text when they are offline. My apllication will show some text and user can search in this text. On Sat, Dec 1, 2012 at 2:11 PM, sree android android.sreeni...@gmail.com wrote: will maintain server -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Pulling phpBB posts to an Android app
Actualy you can make a whole new UI for the phpBB, if you were able to access the forum database. It's not dificult, you just have to search for a good documentation about the phpBB. Em 30/11/2012 20:50, bob b...@coolfone.comze.com escreveu: Sounds like a job for java.net.HttpURLConnection. On Tuesday, November 27, 2012 10:18:41 AM UTC-6, Nirab pudasaini wrote: I am developing an android app. I need to pull posts from an online phpBB 3 forum and then display them in my app. How do i achieve this -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Write to another application's internal memory
Maybe a good solution would be creating a lib project to take care of that data and import it in bouth projects. Then, in this lib project you culd use a database, shared preferences or anything you want to hold the data. ;-) Best regards. Em 28/11/2012 00:03, Android Test aandroidt...@gmail.com escreveu: Hi Bob, Because, I don't want it to be visible to users. At the same time do no want other unauthorized applications to be able to access the info. On Wed, Nov 28, 2012 at 12:04 AM, bob b...@coolfone.comze.com wrote: Why not just write it to the SD card? On Tuesday, November 27, 2012 1:56:27 AM UTC-6, Android Test wrote: Hi All, I have 2 applications with different package names. E.g. App1 and App2. App1 needs to write some files to App2's internal memory so that it could be uploaded to the backend. I have used the following in App1 to do so: filePath = getPackageManager().**getPackageInfo(app2.package.**name http://app2.package.name, 0).applicationInfo.dataDir; I can get the correct path but could not write to it. I checked the logcat, it is showing Permission denied. Am I missing something? What's else needs to be done? Thanks in Advance -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: android e book
Maybe you won't need any of this. But, first, questions: - The data you want is only in that HTML page? If so, how is it formated? - Or is it in a database? If this is the case, can't you access directly the db? Anyway, you can access it with xml, or directly the database. And it isn't so hard to do that with xml. There are a lot of examples over the internet about that. I, personaly, had never used xml until now (I'm creating a small app for the blog of a nonprofit organization I created). Still, I was able to find an example and change it to get the featured image of each post and so on. All you have to do is look the source code of the page (you can see it with your bronser) and try to find a pattern in it. ;-) Best regards. Em 26/11/2012 15:11, Salih Gündüz gunduz.sa...@gmail.com escreveu: webview is a good solution thanks. But the web page is not good formatted for mobile devices.It is a government page so I can not reach the database but I and to develope my own user interface. On Mon, Nov 26, 2012 at 7:03 PM, Michael Banzon mich...@banzon.dk wrote: You must include a caching layer in your app. Everything you need to do this can be found in the SDK manual on WebViews: http://developer.android.com/guide/webapps/webview.html On Mon, Nov 26, 2012 at 5:31 PM, Salih Gündüz gunduz.sa...@gmail.comwrote: İt can be used. but I want to store the data in phone so they can read when they dont have internet.this is my problem :) 26 Kasım 2012 Pazartesi 18:28:11 UTC+2 tarihinde bob yazdı: Sounds like you will want to use a WebView. On Monday, November 26, 2012 10:09:30 AM UTC-6, Salih Gündüz wrote: I want to develope an e book for android. My data is in internet but not a json or a xml only html page.(http://www.mevzuat.** adalet.gov.tr/html/388.htmlhttp://www.mevzuat.adalet.gov.tr/html/388.html). the data changes often. so data must be update often and must be saved on phone so people can read without internet.How can I parse data from html? can I convert the page json?can you suggest me some ways or methods? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Michael Banzon http://michaelbanzon.com/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] AlarmManager destroying an AppWidget
I add a configure/settings Activity in my AppWidget and started gotting some problems. At first, I didn't knew what is the cause, so I commented some parts of the code to figure it out. So what I've found is that the AlarmManager code is causing it. I already tried changing simulator's version, cleared the project and everything. I'm dealing with this problem for almost 3 days... Here are a screen shot showing it. Note that there are 2 widgets in the home screen, completely different, but both are the same! I mean... Both are my AppWidget, they should look as the lower one, but with 2 TextViews... The 2 ImageButtons are there, but they don't always show. :/ http://www.flickr.com/photos/76149280@N08/8169290591/in/photostream? So, my question is: what do I have to do to make it work? Do I have to create a service, do I have to change same code, even use another thing instead of AlarmManager or what? P.S.: I already asked on Stack Overflow ( http://stackoverflow.com/questions/13322168/alarmmanager-destroying-an-appwidget-android-sdk ), but noting... Here go the codes. * AppProviderInfo (small_widget_provider_info.xml) ?xml version=1.0 encoding=utf-8? appwidget-provider xmlns:android=http://schemas.android.com/apk/res/android; android:initialLayout=@layout/widget_layout_small android:minHeight=40dp android:minWidth=250dp android:updatePeriodMillis=8640 android:configure=com.br.mcsoft.quotes.activity.SettingsActivity /appwidget-provider * AppProvider (WidgetProviderSmall.java) package com.br.mcsoft.quotes.provider; import com.br.mcsoft.quotes.R; import com.br.mcsoft.quotes.Adapters.DBAdapter; import com.br.mcsoft.quotes.activity.QuoteActivity; import com.br.mcsoft.quotes.model.Quote; import android.app.AlarmManager; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.database.SQLException; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.widget.RemoteViews; public class WidgetProviderSmall extends AppWidgetProvider { private static final String TAG = WidgetProviderSmall; public static final String URI_SCHEME = widget_provider_small; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // super.onUpdate(context, appWidgetManager, appWidgetIds); System.out.println(Updatando...); final int n = appWidgetIds.length; for (int i = 0; i n; i++) { System.out.println(Entrou no loop...); // Cria o RemoteViews RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_layout_small); // Atualiza os dados... try { DBAdapter db; db = new DBAdapter(context); db.open(); Quote q = db.getRandomQuote(); db.close(); // Guarda o ID da citação... Editor configEditor = context.getSharedPreferences( QuoteWidgetSmall, 0).edit(); configEditor .putInt(String.format(QuoteId-%d, appWidgetIds[i]), q.getId()); configEditor.commit(); System.out.println(Id: + appWidgetIds[i]); System.out.println(Quote Id: + q.getId()); // Verifica o tamanho e trunca o texto da citação... String textQuote = \ + q.getQuote() + \; if (textQuote.length() 110 + 10) { textQuote = textQuote.substring(0, 110) + ...\ [...]; } System.out.println(Quote: + q.getQuote()); System.out.println(Author: + q.getAuthor().getName()); // Seta os campos... // rv.setTextViewText(R.id.txtWdgQuote, \ + q.getQuote() + // \); rv.setTextViewText(R.id.txtWdgQuote, textQuote); rv.setTextViewText(R.id.txtWdgAuthor, — + q.getAuthor().getName()); System.out.println(Setou os valores...); } catch (SQLException e) { Log.e(TAG, e.getMessage(), e); } // Adiciona o listener do evento do botão Next... Intent active = new Intent(context, WidgetProviderSmall.class); active.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE); // onUpdate recebe um array de ints, então passa como array. active.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] { appWidgetIds[i] }); Uri data = Uri.withAppendedPath( Uri.parse(URI_SCHEME +