[android-developers] Re: VerifyError on Custom View
Same error in my project... Did you find a solution in 3 years? :-p On Monday, June 1, 2009 4:49:16 PM UTC-4, Zach Hobbs wrote: > > I have setup remote crash reports for unhandled java exceptions. I am > getting lots of users who are crashing right on startup, and I'm > seeing VerifyErrors that look like they are thrown right on startup. > > I have tested this app extensively on 1.1 and 1.5 on many different > devices, but some phone just have this problem everytime, > unfortunately I haven't been able to get my hands on one that it > crashes on to see what else is happening in LogCat. > > Anyways, the exception looks like this: > > java.lang.VerifyError: com.tunewiki.lyricplayer.android.views.TopBar >at java.lang.Class.getDeclaredConstructors(Native Method) >at java.lang.Class.getConstructor(Class.java:401) >at android.view.LayoutInflater.createView(LayoutInflater.java: > 470) >at android.view.LayoutInflater.createViewFromTag > (LayoutInflater.java:560) >at android.view.LayoutInflater.rInflate(LayoutInflater.java: > 613) >at android.view.LayoutInflater.inflate(LayoutInflater.java:403) >at android.view.LayoutInflater.inflate(LayoutInflater.java:316) >at android.view.LayoutInflater.inflate(LayoutInflater.java:272) >at com.android.internal.policy.impl.PhoneWindow.setContentView > (PhoneWindow.java:227) >at android.app.Activity.setContentView(Activity.java:1569) >at > com.tunewiki.lyricplayer.android.library.MainLibraryActivity.onCreate > (MainLibraryActivity.java:21) >at android.app.Instrumentation.callActivityOnCreate > (Instrumentation.java:1122) >at android.app.ActivityThread.performLaunchActivity > (ActivityThread.java:2103) >at android.app.ActivityThread.startActivityNow > (ActivityThread.java:1988) >at android.app.LocalActivityManager.moveToState > (LocalActivityManager.java:122) >at android.app.LocalActivityManager.startActivity > (LocalActivityManager.java:335) >at > com.tunewiki.lyricplayer.android.tabs.TabHostActivity.setCurrentTab > (TabHostActivity.java:359) >at com.tunewiki.lyricplayer.android.MainActivity.setCurrentTab > (MainActivity.java:687) >at > com.tunewiki.lyricplayer.android.tabs.TabHostActivity.setCurrentTab > (TabHostActivity.java:259) >at > com.tunewiki.lyricplayer.android.tabs.TabHostActivity.setDefaultTab > (TabHostActivity.java:67) >at com.tunewiki.lyricplayer.android.MainActivity.onCreate > (MainActivity.java:268) >at android.app.Instrumentation.callActivityOnCreate > (Instrumentation.java:1122) >at android.app.ActivityThread.performLaunchActivity > (ActivityThread.java:2103) >at android.app.ActivityThread.handleLaunchActivity > (ActivityThread.java:2156) >at android.app.ActivityThread.access$1800(ActivityThread.java: > 112) >at android.app.ActivityThread$H.handleMessage > (ActivityThread.java:1580) >at android.os.Handler.dispatchMessage(Handler.java:88) >at android.os.Looper.loop(Looper.java:123) >at android.app.ActivityThread.main(ActivityThread.java:3742) >at java.lang.reflect.Method.invokeNative(Native Method) >at java.lang.reflect.Method.invoke(Method.java:515) >at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run > (ZygoteInit.java:739) >at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) >at dalvik.system.NativeStart.main(Native Method) > > TopBar extends RelativeLayout. > > Thanks, > Zach > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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 attach actionbar on dialog?
Did you find an answer? I have the same question... On Wednesday, September 21, 2011 9:11:28 PM UTC+2, Igor Oliveira wrote: > > Hello, I would like to know how to implement a screen like the > EditEventActivity from Android Calendar on Android 3.1. > > See picture below: > > http://imageshack.us/photo/my-images/269/sc20110921105601.jpg/ > > I've created a dialog and I'm trying to put a actionbar on the dialog via > onCreateOptionsMenu(), but the action bar doesn't appear. > > I'm using android:targetSdkVersion="12"/> and the Theme.Holo.Light.Dialog on the > dialog. > > When I call getActionBar() I always get null. > > From documentation: > "ActionBar getActionBar() > Retrieve the ActionBar attached to this dialog, if present." > > So how can I attach a dialog on a dialog? Can you help me? > > Thanks in advance. > > -- > Igor Oliveira > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Sending mails
Hi, I can send mails with mail.java class. It works fine when I send it to a gmail account. It goes in spam when i send it to a live.fr account (why not ..) but it is never received when i send it on my xsoftware.fr account. The xsoftware.fr mail adresses are managed by google apps Is there anything special to do to be sure that mails are really sent ?? Is there any other knomn problems with mail service provider ?? Thanks for your help (and sorry for my poor english, i'm french) -- Cordially, Christophe Charron -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] push notifications in arabic
hey i used this link ( http://www.ipragmatech.com/power-mobile-app-android-push-notification-c2dm.html) and downloaded the files at the end of the article. you have a client-side project and a server-side (coded in Java) and its really a great tutorial. you can also check the link below: http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html good luck :) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] push notifications in arabic
hi im developing an application for a newspaper in arabic and ive implemented push notifications for breaking news, the push works great but i have a problem with the arabic text being sent with the push... when the client receives the message the arabic letters are replaced with question marks ( ) . any ideas about what encoding i should use ? thanks a lot -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] probelm with EditText inside
I've got a view which include another one with the "include" component (see http://android-developers.blogspot.com/2009/02/android-layout-tricks-2-reusing-layouts.html ) There is some EditText inside the included view. There is 2 problems with these EditText : - I have to tap them 2 times in order to have the keyboard to appear - if I long press one of the EditText the app freeze and crash (only on my phone - Samsung galaxy S, not on the emulator) It does not happen if the Edittext are NOT in a tag ... Do you have any ideas on this problem ?? regards, Christophe -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: CountDownTimer too slow ???
thx for the reply Nick, I'm using eclipse but I run the app using the normal mode, not the debug mode. On Jul 25, 9:19 pm, Nick Risaro wrote: > When you run your app in eclipse (or with debuggable="true") it runs in > debug mode, this allows eclipse to hook the debugger to your app, this can > slow down your app performance because of the overhead. > > On Mon, Jul 25, 2011 at 2:35 PM, Christophe < > > > > > > > > christophe.lebesner...@gmail.com> wrote: > > What is "debug symbol" anyways ?? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: CountDownTimer too slow ???
hello Nikolay, I have updated my code, following your suggestion : public List times = new ArrayList(); CountDownTimer countDown = new CountDownTimer(Integer.MAX_VALUE, 1000) { @Override public void onTick(long millisUntilFinished) { times.add(System.currentTimeMillis()); } }; and after a while I display the time between two call to "onTick" with a loop over my list : for (int i = 1; i < times.size(); i++) { System.out.println(times.get(i) - times.get(i - 1)); } And I have something like this : 07-25 18:18:37.281: INFO/System.out(408): 1034 07-25 18:18:37.281: INFO/System.out(408): 1031 07-25 18:18:37.281: INFO/System.out(408): 1017 07-25 18:18:37.281: INFO/System.out(408): 1018 07-25 18:18:37.291: INFO/System.out(408): 1011 07-25 18:18:37.291: INFO/System.out(408): 1019 ... I'm not expecting the precision of an atomic clock, but the error margin here is huge ! On Jul 25, 8:06 pm, Nikolay Elenkov wrote: > On Jul 26, 2011 3:00 AM, "Christophe" > wrote: > > > > > "Log can be expensive" => I have tried to run the same code with a > > good old "System.out.println" and the problem is still there. > > That goes to the same log buffer, so no change is to be expected. Make a > list of Long and push currentTimeMillis on each call. Then dump the list to > log and see what this gives you. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: CountDownTimer too slow ???
"Log can be expensive" => I have tried to run the same code with a good old "System.out.println" and the problem is still there. On Jul 25, 7:35 pm, Christophe wrote: > thanks for your response Nick. > > The only code in "onTick" is the call to "Log.i()". I don't think it > take more than a second to execute :) > What is "debug symbol" anyways ?? > > On Jul 24, 10:43 pm, Nick Risaro wrote: > > > > > > > > > The calls to *onTick* are synchronized, maybe your code is taking more than > > a second to execute. Log can be expensive, and with debug symbols enabled > > your code will run a little bit slower than in real life. > > > Or maybe the end of times is close!! :P > > > On Sun, Jul 24, 2011 at 2:30 PM, Christophe < > > > christophe.lebesner...@gmail.com> wrote: > > > Run the following code in the emulator and start a chronometer at the > > > same time : > > > > // log some text each second : > > > CountDownTimer countDown = new CountDownTimer(Integer.MAX_VALUE, 1000) > > > { > > > private int i = 0; > > > @Override > > > public void onTick(long millisUntilFinished) { > > > Log.i("", "###" + i); > > > i++; > > > } > > > @Override > > > public void onFinish() {} > > > }; > > > > countDown.start(); > > > > Then wait a few minutes. > > > For example I stop when my chronometer was at 7min44s. The value in > > > the log was 448seconds => 7min28s. > > > > WTF ?!??? > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to android-developers@googlegroups.com > > > To unsubscribe from this group, 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: CountDownTimer too slow ???
thanks for your response Nick. The only code in "onTick" is the call to "Log.i()". I don't think it take more than a second to execute :) What is "debug symbol" anyways ?? On Jul 24, 10:43 pm, Nick Risaro wrote: > The calls to *onTick* are synchronized, maybe your code is taking more than > a second to execute. Log can be expensive, and with debug symbols enabled > your code will run a little bit slower than in real life. > > Or maybe the end of times is close!! :P > > On Sun, Jul 24, 2011 at 2:30 PM, Christophe < > > > > > > > > christophe.lebesner...@gmail.com> wrote: > > Run the following code in the emulator and start a chronometer at the > > same time : > > > // log some text each second : > > CountDownTimer countDown = new CountDownTimer(Integer.MAX_VALUE, 1000) > > { > > private int i = 0; > > @Override > > public void onTick(long millisUntilFinished) { > > Log.i("", "###" + i); > > i++; > > } > > @Override > > public void onFinish() {} > > }; > > > countDown.start(); > > > Then wait a few minutes. > > For example I stop when my chronometer was at 7min44s. The value in > > the log was 448seconds => 7min28s. > > > WTF ?!??? > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, 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] CountDownTimer too slow ???
Run the following code in the emulator and start a chronometer at the same time : // log some text each second : CountDownTimer countDown = new CountDownTimer(Integer.MAX_VALUE, 1000) { private int i = 0; @Override public void onTick(long millisUntilFinished) { Log.i("", "###" + i); i++; } @Override public void onFinish() {} }; countDown.start(); Then wait a few minutes. For example I stop when my chronometer was at 7min44s. The value in the log was 448seconds => 7min28s. WTF ?!??? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: change the google account associated to my developer account
perfect ! thx On Apr 13, 8:50 pm, TreKing wrote: > On Wed, Apr 13, 2011 at 12:59 PM, Christophe < > > christophe.lebesner...@gmail.com> wrote: > > how can I change the google account which is associated with my developer > > account on the android market ? > > http://www.google.com/support/androidmarket/bin/answer.py?hl=en&answe... > > --- > -- > 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] change the google account associated to my developer account
hello, how can I change the google account which is associated with my developer account on the android market ? When I registered my account I have used my personal google account, which was not a bright idea because some alternate market display my real name associated with the google account instead of the developer name from the profile (https://market.android.com/publish/editProfile) (I did not publish my app under these "alternate" markets, apparently they just take the app from the official android market and republish 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: static variable set to null
hello Kostya, yes I think I going to use a lazy initialization, and retrieve the data from the database if it's null. It's a bit more work but it should works :) On Apr 12, 11:24 am, Kostya Vasilyev wrote: > Static variables aren't set to null. The process gets killed and > reinitialized again when/if the user comes back. > > If you use a static to only pass data between activities, then don't > reference it past that. Have the receiving activity store the data somewhere > more persistent: a database, a data file, shared prefs, or a save it > onSaveInstanceState. > > If you want the static obejct to act as some sort of persistent data manager > that your activities can rely on, have it save the data somewhere, and use > lazy initialization to bring the data in from that persistent memory as > needed. > > If the data size is small, you might indeed be better off passing it between > activities as part of the intent, as extras (basic types of Parcelable). > > -- Kostya > > 2011/4/12 Christophe > > > > > > > > > that's probably the case. They should mention in the documentation > > that static variable can be set to null at anytime, since they > > explicitely state that static variable can be use to pass data between > > activities ... (http://developer.android.com/resources/faq/ > > framework.html#3) > > > What the best way to keep data then ? May be a singleton ? I'm afraid > > the instance will be set to null too :( > > > On Apr 12, 10:04 am, appel wrote: > > > If you don't set them to null somewhere it is most likely because your > > > application process has been killed and restarted. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, 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: static variable set to null
hello Ashish, since the data in the static variable is mandatory when I load the activity, the null check will not be enough. And I can't use Shared preference because the data is a complex Object. On Apr 12, 11:09 am, Ashish Raut wrote: > Hi, > You can use static variable but you have check null before use > > *if(obj != null) > > Or > you can use Shared preference for sharing data to all activities: > > http://developer.android.com/guide/topics/data/data-storage.html#pref > > *Regards, > AshishR > > Use > > On Tue, Apr 12, 2011 at 2:26 PM, Christophe < > > > > > > > > christophe.lebesner...@gmail.com> wrote: > > that's probably the case. They should mention in the documentation > > that static variable can be set to null at anytime, since they > > explicitely state that static variable can be use to pass data between > > activities ... (http://developer.android.com/resources/faq/ > > framework.html#3) > > > What the best way to keep data then ? May be a singleton ? I'm afraid > > the instance will be set to null too :( > > > On Apr 12, 10:04 am, appel wrote: > > > If you don't set them to null somewhere it is most likely because your > > > application process has been killed and restarted. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, 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: static variable set to null
that's probably the case. They should mention in the documentation that static variable can be set to null at anytime, since they explicitely state that static variable can be use to pass data between activities ... (http://developer.android.com/resources/faq/ framework.html#3) What the best way to keep data then ? May be a singleton ? I'm afraid the instance will be set to null too :( On Apr 12, 10:04 am, appel wrote: > If you don't set them to null somewhere it is most likely because your > application process has been killed and restarted. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] static variable set to null
hello everybody, I use a static variable to share data across all the activities of my apps. The problems is that sometimes this variable is set to null, which cause the others activities to crash (nullPointersException) ... does somebody have an idea of what could set the static variables to null ? regards, Christophe -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: TableRow not on top of each others
finally found the problem : I had 2 table row with the same id ... On Dec 9, 10:16 am, Christophe wrote: > hello Bret, > > I have try to put it in a vertical LinearLayout but the result is the > same ... > > On Dec 8, 7:06 pm, Bret Foreman wrote: > > > Try putting your TableLayout inside a LinearLayout with vertical > > orientation. > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: TableRow not on top of each others
hello Bret, I have try to put it in a vertical LinearLayout but the result is the same ... On Dec 8, 7:06 pm, Bret Foreman wrote: > Try putting your TableLayout inside a LinearLayout with vertical > orientation. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] TableRow not on top of each others
ok, this is really strange. I've got a TableLayout with 6 tableRow (defien in xml). I then add (in Java) a button to the first row and another to the second row. I expect the 2 row to be on top of each other, but they are actually next to each other (like columns) ... my Layout : The java code : TableRow p1 = (TableRow) this.findViewById(R.id.TableRow01); TableRow p2 = (TableRow) this.findViewById(R.id.TableRow02); p1.addView(new Button(this)); p2.addView(new Button(this)); I have probably done something stupid and I'm sure there is a simple fix :) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: 512x512 high res icon required?
well, that's great, but it would be better to know what we are suppose to put in these pictures (icon & "feature") and where it is going to be used BEFORE making it mandatory. On Nov 18, 2:48 pm, Warren wrote: > There wasn't much notice, but there was an email that came from > Android Market Support that gave a maintenance window and a list of > changes to the market. I was also lucky enough to have designed my > icon at 1024x1024, which I then downsize for antialiasing. As for my > other apps, I guess I'll have to redo them. Slightly annoying, sure. > But then, they are doing this to help us market our apps, so I can't > complain too much ;) > > Warren > > On Nov 18, 4:35 am, Daniel Drozdzewski > wrote: > > > On Thu, Nov 18, 2010 at 9:16 AM, MrChaz wrote: > > > You forgot to mention the required 1024 'feature' image as well, > > > whatever the hell that is! > > > The featured 1024 is in case your app gets featured, obviously... > > you are right, I am guessing. > > The whole thing must be a quiet (half of the internet is talking about > > it) move to enable existing apps for Google TV. > > > Polishing things is a worthy cause - just look how focused and > > successful Apple is with such strategy. > > > Daniel > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: cannot click on suggestion of AutoCompleteTextView
It work if I use a TextView instead of my custo layout (see my first post). Don't ask me why. So I cheated and set the picture of the contact as the background of the text view. The newView method now look like this : @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { float density = context.getResources().getDisplayMetrics().density; TextView name = new TextView(context); name.setText(cursor.getString(1)); name.setTag(cursor.getLong(0)); name.setGravity(Gravity.CENTER_VERTICAL); name.setTextColor(Color.BLACK); name.setTextSize(19); name.setHeight((int) (54 * density)); Uri contactPhotoUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, cursor.getLong(0)); InputStream image_stream = Contacts.openContactPhotoInputStream(mContent, contactPhotoUri); Drawable avatar; if (image_stream != null) { Bitmap b = BitmapFactory.decodeStream(image_stream); avatar = new BitmapDrawable(b); } else { avatar = context.getResources().getDrawable(R.drawable.contact_picture); } avatar.setBounds(0, 0, (int) (54 * density), (int) (54 * density)); name.setCompoundDrawablePadding((int) (3 * density)); name.setCompoundDrawables(avatar, null, null, null); return name; } Also the code in bindView is not needed (don't know why there is 2 methods newView and bindView ...) @Override public void bindView(View view, Context context, Cursor cursor) { // already done in newView } So if you want a autocompletetextView which autocomplete on the name of the contacts and disply their photo you can use this : Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, ContactListAdapter.PEOPLE_PROJECTION, null, null, ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"); ContactListAdapter adapter = new ContactListAdapter(this, cursor); AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.AutoCompleteTextView); textView.setAdapter(adapter); On Nov 18, 11:29 am, Christophe wrote: > bump > > for information, here is the adapter i use for the > AutocompleteTextView : > > import java.io.InputStream; > import android.content.ContentResolver; > import android.content.ContentUris; > import android.content.Context; > import android.database.Cursor; > import android.graphics.BitmapFactory; > import android.net.Uri; > import android.provider.ContactsContract; > import android.provider.ContactsContract.Contacts; > import android.view.LayoutInflater; > import android.view.View; > import android.view.ViewGroup; > import android.widget.CursorAdapter; > import android.widget.Filterable; > import android.widget.ImageView; > import android.widget.TextView; > > public class ContactListAdapter extends CursorAdapter implements > Filterable { > > public static final String[] PEOPLE_PROJECTION = new String[] { > ContactsContract.Contacts._ID, > ContactsContract.Contacts.DISPLAY_NAME > }; > > private ContentResolver mContent; > > public ContactListAdapter(Context context, Cursor c) { > super(context, c); > mContent = context.getContentResolver(); > } > > @Override > public View newView(Context context, Cursor cursor, ViewGroup > parent) { > View v = > LayoutInflater.from(context).inflate(R.layout.player_item_autocomplete, > null); > TextView name = (TextView) v.findViewById(R.id.playerName); > name.setText(cursor.getString(1)); > > Uri contactPhotoUri = > ContentUris.withAppendedId(Contacts.CONTENT_URI, cursor.getLong(0)); > InputStream image_stream = > Contacts.openContactPhotoInputStream(mContent, contactPhotoUri); > if (image_stream != null) { > ImageView badge = (ImageView) > v.findViewById(R.id.playerPhoto); > > badge.setImageBitmap(BitmapFactory.decodeStream(image_stream)); > } > > return v; > } > > @Override > public void bindView(View view, Context context, Cursor cursor) { > TextView name = (TextView) view.findViewById(R.id.playerName); > name.setText(cursor.getString(1)); > > Uri contactPhotoUri = > ContentUris.withAppendedId(Contacts.CONTENT_URI, cursor.getLong(0)); > InputStream image_stream = > Contacts.openContactPhotoInputStream(mContent, contactPhotoUri); > if (image_stream != null) { > ImageView badge = (ImageView) > view.findViewById(R.id.playerPhoto); > > badge.setImageBitmap(BitmapFactory.decodeStream(image_stream)); >
[android-developers] Re: cannot click on suggestion of AutoCompleteTextView
bump for information, here is the adapter i use for the AutocompleteTextView : import java.io.InputStream; import android.content.ContentResolver; import android.content.ContentUris; import android.content.Context; import android.database.Cursor; import android.graphics.BitmapFactory; import android.net.Uri; import android.provider.ContactsContract; import android.provider.ContactsContract.Contacts; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CursorAdapter; import android.widget.Filterable; import android.widget.ImageView; import android.widget.TextView; public class ContactListAdapter extends CursorAdapter implements Filterable { public static final String[] PEOPLE_PROJECTION = new String[] { ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME }; private ContentResolver mContent; public ContactListAdapter(Context context, Cursor c) { super(context, c); mContent = context.getContentResolver(); } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View v = LayoutInflater.from(context).inflate(R.layout.player_item_autocomplete, null); TextView name = (TextView) v.findViewById(R.id.playerName); name.setText(cursor.getString(1)); Uri contactPhotoUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, cursor.getLong(0)); InputStream image_stream = Contacts.openContactPhotoInputStream(mContent, contactPhotoUri); if (image_stream != null) { ImageView badge = (ImageView) v.findViewById(R.id.playerPhoto); badge.setImageBitmap(BitmapFactory.decodeStream(image_stream)); } return v; } @Override public void bindView(View view, Context context, Cursor cursor) { TextView name = (TextView) view.findViewById(R.id.playerName); name.setText(cursor.getString(1)); Uri contactPhotoUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, cursor.getLong(0)); InputStream image_stream = Contacts.openContactPhotoInputStream(mContent, contactPhotoUri); if (image_stream != null) { ImageView badge = (ImageView) view.findViewById(R.id.playerPhoto); badge.setImageBitmap(BitmapFactory.decodeStream(image_stream)); } } @Override public String convertToString(Cursor cursor) { return cursor.getString(1); } @Override public Cursor runQueryOnBackgroundThread(CharSequence constraint) { if (getFilterQueryProvider() != null) { return getFilterQueryProvider().runQuery(constraint); } StringBuilder buffer = null; String[] args = null; if (constraint != null) { buffer = new StringBuilder(); buffer.append("UPPER("); buffer.append(ContactsContract.Contacts.DISPLAY_NAME); buffer.append(") GLOB ?"); args = new String[] { constraint.toString().toUpperCase() + "*" }; } return mContent.query(ContactsContract.Contacts.CONTENT_URI, ContactListAdapter.PEOPLE_PROJECTION, buffer == null ? null : buffer.toString(), args, ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"); } } On Nov 17, 5:36 pm, Christophe wrote: > Hello, > > I have an AutoCompleteTextView with suggest the name of the people in > the contact list. I display a custom view with the photo and the name > of the contact in the suggestion. It works perfectly, except nothing > happen when I click on one of the suggested item ... > > The view that I use : > > http://schemas.android.com/apk/res/ > android" > android:layout_height="wrap_content" > android:minHeight="58dip" > android:layout_width="fill_parent" > android:orientation="horizontal" > android:gravity="center_vertical" > android:focusable="true" > > android:background="@android:drawable/list_selector_background" > android:clickable="true"> > > android:layout_marginLeft="2dip" > android:layout_marginRight="14dip" > android:layout_width="54dip" > android:id="@+id/playerPhoto" > android:src="@drawable/contact_picture"> > > > android:textAppearance="?android:attr/textAppearanceMedium" > android:maxLines="1" > android:ellipsize="end" >
[android-developers] cannot click on suggestion of AutoCompleteTextView
Hello, I have an AutoCompleteTextView with suggest the name of the people in the contact list. I display a custom view with the photo and the name of the contact in the suggestion. It works perfectly, except nothing happen when I click on one of the suggested item ... The view that I use : http://schemas.android.com/apk/res/ android" android:layout_height="wrap_content" android:minHeight="58dip" android:layout_width="fill_parent" android:orientation="horizontal" android:gravity="center_vertical" android:focusable="true" android:background="@android:drawable/list_selector_background" android:clickable="true"> ideas ? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: high density emulator use drawable-mdpi folder instead of drawable-hdpi
it works now with The value for the "supports-screens" tag are "true" by default (http:// developer.android.com/guide/practices/screens_support.html#attrs) so I guess it's not mandatory tu use it in the manifest. thx you ! On Oct 19, 5:50 pm, Daniel Drozdzewski wrote: > On Tue, Oct 19, 2010 at 4:46 PM, Christophe > > wrote: > > hello, > > > I am running my application in the emulator using a high density skin > > (like WVGA800). > > However the ressources in my application are loaded from the drawable- > > mdpi folder instead of drawable-hdpi ... > > > what else should I do so that android use the correct folder ? > > Make sure you have the following in the manifest: > > > > AND > > android:smallScreens="true" > android:normalScreens="true" > android:largeScreens="true" > android:anyDensity="true" /> > > -- > Daniel Drozdzewski -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Tab Icons
http://www.glyfx.com/products/free_android2.html this is the only icon pack I know with tab variation icon ... unfortunaly there is not a lot of free "android style" icon available on the internet :( On Oct 19, 1:44 pm, Pikoh wrote: > Hi all, > > just a simple question..anyone knows of any icon packs for android > tabhost? Let's say I'm not good at drawing.. :) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] high density emulator use drawable-mdpi folder instead of drawable-hdpi
hello, I am running my application in the emulator using a high density skin (like WVGA800). However the ressources in my application are loaded from the drawable- mdpi folder instead of drawable-hdpi ... what else should I do so that android use the correct folder ? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: gridview
hi, the "hello GridView" example will may be help you : http://developer.android.com/guide/tutorials/views/hello-gridview.html On Sep 20, 8:40 am, "FAISON N.P" wrote: > hi, i am new in android.Now i need create a gridview with 50 columns > for my application.Then i did this gridview created with 5000 px > width and in the horizontal view.its now working .But the problem is > its loads about 5 row of data first time about(250) images in > gridview.when scroling it reuse the above rows. > but actually i need to load only the images in screen.but it not > working,anyone know please help[ me. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] tiling nine patch (instead of stretching)
hello, is it possible to draw a 9-patch that tile its border instead of stretching it ? regards, Christophe -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: problems with Typeface
> Call Typeface.create((String)null, Typeface.ITALIC); yes, this works. I should have thought of this by myself >_< > Please delete "getApplicationContext()" and just use "this" I did this, but the problem is still here. Also same problem if I use "(String)null" instead of "Typeface.SANS_SERIF" (I guess sans serif was the default). thanks for your help. On Sep 16, 4:01 pm, Mark Murphy wrote: > On Thu, Sep 16, 2010 at 9:33 AM, Christophe > > wrote: > > and this is how I use the typeface : > > > TextView title = new TextView(this.getApplicationContext()); > > title.setText("some text"); > > title.setTypeface(Typeface.create(Typeface.SANS_SERIF, > > Typeface.BOLD_ITALIC)); > > Please delete "getApplicationContext()" and just use "this". > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: problems with Typeface
and this is how I use the typeface : TextView title = new TextView(this.getApplicationContext()); title.setText("some text"); title.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD_ITALIC)); On Sep 16, 3:29 pm, Christophe wrote: > hello everybody, > > I've got 2 problems with the Typeface.create(...) method : > > - the javadoc for this methods say : "Create a typeface object given a > family name, and option style information. If null is passed for the > name, then the default font will be chosen". However if I use for > example : Typeface.create(null, Typeface.ITALIC), it does not compile, > with the following error : "The method create(String, int) is > ambiguous for the type Typeface". This is because there is 2 different > methods : create(String, int) and create(Typeface, int). I guess there > is a problem with the API here :( > > - italic does not work with sans serif. For example if I use > Typeface.create(Typeface.SANS_SERIF, Typeface.ITALIC), the text will > not be in italic. Bold works fine. Serif works fine with both bold and > italic. > > regards, > Christophe -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] problems with Typeface
hello everybody, I've got 2 problems with the Typeface.create(...) method : - the javadoc for this methods say : "Create a typeface object given a family name, and option style information. If null is passed for the name, then the default font will be chosen". However if I use for example : Typeface.create(null, Typeface.ITALIC), it does not compile, with the following error : "The method create(String, int) is ambiguous for the type Typeface". This is because there is 2 different methods : create(String, int) and create(Typeface, int). I guess there is a problem with the API here :( - italic does not work with sans serif. For example if I use Typeface.create(Typeface.SANS_SERIF, Typeface.ITALIC), the text will not be in italic. Bold works fine. Serif works fine with both bold and italic. regards, Christophe -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: able to select 2 RadioButton in a RadioGroup ??!??!
> There seems to be a problem, if you try to set the checked option, > before adding it to the RadioGroup. If you set it after adding it, > that works fine... Yes ! It works fine now ! A bug in android ? :) thanks for you help On Sep 15, 4:44 pm, Kumar Bibek wrote: > @Treking, > > You will have to create new Radiobuttons each time, else, you will not > be able to add it to the RadioGroup. It will say, the child already > has a parent. So, if you want to display multiple radio buttons like > this, then, you have to create new ones, i.e, you cannot reuse that. > > There seems to be a problem, if you try to set the checked option, > before adding it to the RadioGroup. If you set it after adding it, > that works fine... > > Here's the code. > > RadioGroup rg = (RadioGroup) findViewById(R.id.RadioGroup01); > for (int i = 0; i < 6; i++) { > rg.addView(getRadioButton(i)); > } > > ((RadioButton)rg.getChildAt(0)).setChecked(true); > > private RadioButton getRadioButton(int index) { > RadioButton rb = new RadioButton(this); > rb.setText("Radio " + index); > return rb; > } > > -Kumar Bibekhttp://techdroid.kbeanie.com > > On Sep 15, 6:42 pm, TreKing wrote: > > > On Wed, Sep 15, 2010 at 8:35 AM, Christophe < > > > christophe.lebesner...@gmail.com> wrote: > > > > 1 - Your getRadioButton function returns a new RadioButton. > > > > since I want 10 different radio buttons in my group, I can reuse the > > > same radio button ?!? > > > The code you posted adds 10 RBs to a group. Then your get function returns a > > new one that's not associated with anything. How do you expect that to work? > > You're basically saying, "when getting a Radio Button, instead of getting > > one I already created, make a new one and if was trying to get the first > > one, set it to checked. Also, don't associate it with a group so its checked > > state won't effect others." > > > > > 2 - You're using getApplicationContext(). > > > > I have try with just "this" instead of "getApplicationContext()", but the > > > problem is still there > > > This won't fix your problem (see #1), but you should avoid > > getApplicationContext(). It will cause you problems elsewhere. > > > Should I use something else ? > > > Your most local Context ... usually "this". > > > On Wed, Sep 15, 2010 at 8:38 AM, Kumar Bibek wrote: > > > 1. New Radio button: I dont see a problem with that. > > > He already created 10 and the "new" ones don't get added to the group. > > > - > > 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] Re: able to select 2 RadioButton in a RadioGroup ??!??!
> The code you posted adds 10 RBs to a group. Then your get function returns a > new one that's not associated with anything. hu ? the only radio button I add are the one returned from the function : group.addView(getRadioButton(i)); it is equivalent to the following code (which doesn't work either) : for (int i = 0; i < 10; i++) { RadioButton v = new RadioButton(this); if (i == 3) { v.setChecked(true); } group.addView(v); } On Sep 15, 3:42 pm, TreKing wrote: > On Wed, Sep 15, 2010 at 8:35 AM, Christophe < > > christophe.lebesner...@gmail.com> wrote: > > > 1 - Your getRadioButton function returns a new RadioButton. > > > since I want 10 different radio buttons in my group, I can reuse the > > same radio button ?!? > > The code you posted adds 10 RBs to a group. Then your get function returns a > new one that's not associated with anything. How do you expect that to work? > You're basically saying, "when getting a Radio Button, instead of getting > one I already created, make a new one and if was trying to get the first > one, set it to checked. Also, don't associate it with a group so its checked > state won't effect others." > > > > 2 - You're using getApplicationContext(). > > > I have try with just "this" instead of "getApplicationContext()", but the > > problem is still there > > This won't fix your problem (see #1), but you should avoid > getApplicationContext(). It will cause you problems elsewhere. > > Should I use something else ? > > Your most local Context ... usually "this". > > On Wed, Sep 15, 2010 at 8:38 AM, Kumar Bibek wrote: > > 1. New Radio button: I dont see a problem with that. > > He already created 10 and the "new" ones don't get added to the group. > > - > 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] Re: able to select 2 RadioButton in a RadioGroup ??!??!
hello treKing, > 1 - Your getRadioButton function returns a new RadioButton. since I want 10 different radio buttons in my group, I can reuse the same radio button ?!? > 2 - You're using getApplicationContext(). I have try with just "this" instead of "getApplicationContext()", but the problem is still there Should I use something else ? thanks for you help On Sep 15, 3:28 pm, TreKing wrote: > On Wed, Sep 15, 2010 at 8:10 AM, Christophe < > > christophe.lebesner...@gmail.com> wrote: > > Is there something wrong with my code ? > > 1 - Your getRadioButton function returns a new RadioButton. > 2 - You're using getApplicationContext(). > > - > 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] able to select 2 RadioButton in a RadioGroup ??!??!
hello, I have a simple RadioGroup in one of my view, with several RadioButton : RadioGroup group = new RadioGroup(this.getApplicationContext()); this.setContentView(group); for (int i = 0; i < 10; i++) { group.addView(getRadioButton(i)); } private RadioButton getRadioButton(final int position) { RadioButton v = new RadioButton(this.getApplicationContext()); if (position == 0) { v.setChecked(true); } return v; } It display 10 radio buttons, and one of them is checked (the first one). But if I click on another radio button, the first one stay selected ... Is there something wrong with my code ? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] label on the left for RadioButton
hello, by default the label of a RadioButton in on the right of the checkMarck. Is there a way to put the text on the left ? regard, christophe -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: bug with notifyDataSetChanged() in ArrayAdapter ?
Shink, thank you for your answer. the add() and insert() work as expected. However it is a lot easier for me to manipulate directly my ArrayList (it is more flexible and the ArrayAdapter API lack some methods). I think I will keep my current code with the overrided getCount() method so I don't have to add to code to keep the ArrayAdapter in sync with my ArrayList. On Jun 17, 1:53 pm, skink wrote: > On Jun 17, 9:37 am, Christophe > wrote: > > > myArrayList is a simple ArrayList : > > > ArrayList myArrayList = new ArrayList(); > > > which I give to my adapter in my ListActivity : > > > adapter = new StepItemAdapter(this, myArrayList); > > this.setListAdapter(adapter); > > if your StepItemAdapter extends ArrayAdapter you dont need myArrayList > > > > > Later I add item to my list and try to refresh the view : > > > myArrayList.add(position, new Step()); > > adapter.notifyDataSetChanged(); > > just use adapter.add() and/or adapter.insert() > > pskink -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: bug with notifyDataSetChanged() in ArrayAdapter ?
myArrayList is a simple ArrayList : ArrayList myArrayList = new ArrayList(); which I give to my adapter in my ListActivity : adapter = new StepItemAdapter(this, myArrayList); this.setListAdapter(adapter); Later I add item to my list and try to refresh the view : myArrayList.add(position, new Step()); adapter.notifyDataSetChanged(); On Jun 17, 12:42 pm, skink wrote: > On Jun 16, 11:07 am, Christophe > wrote: > > > > > hello everyone, > > > I have a strange problem with one of my ListActivity. I have overrided > > the default ArrayAdapter in order to customize my list. I have then > > filled the adapter with an ArrayList. > > > If I insert an element on the list and then call > > notifyDataSetChanged() on the adapter everything works fine. > > > But if I insert an element at the END of the list and then call > > notifyDataSetChanged(), the new element doesn't appear ... > > > And finally if I override getCount() on my adapter like this : > > > @Override > > public int getCount() { > > return myArrayList.size(); > > > } > > what's myArrayList and how do you append items to your ArrayAdapter? > > pskink -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: bug with notifyDataSetChanged() in ArrayAdapter ?
by "overriding the default ArrayAdapter" I mean overriding the getView(), getViewTypeCount() and getItemViewType() methods. This is the recommended way of changing the ways the items are displayed according to the javadoc, so I guess it should not cause problem : "To use something other than TextViews for the array display, for instance, ImageViews, or to have some of data besides toString() results fill the views, override getView(int, View, ViewGroup) to return the type of view you want." Anyways, I have tried to remove all my overrided methods and the problem is still there ... On Jun 17, 10:42 am, Kumar Bibek wrote: > > > > I have a strange problem with one of my ListActivity. I have overrided > > > > the default ArrayAdapter in order to customize my list. I have then > > > > filled the adapter with an ArrayList. > > This is a custom array adapter. > > Thanks and Regards, > Kumar Bibekhttp://tech-droid.blogspot.com > > On Jun 17, 1:27 pm, Christophe > wrote: > > > the only example I have found for ArrayAdapter in the API example > > doesn't show how to add element in the array : > > >http://developer.android.com/resources/samples/ApiDemos/src/com/examp... > > > and getCount() is not overrided in this example ... > > > On Jun 16, 9:39 pm, Kumar Bibek wrote: > > > > You have to override the getCount method. Please go through the > > > examples to check how the Adapters work. > > > > Thanks and Regards, > > > Kumar Bibekhttp://tech-droid.blogspot.com > > > > On Jun 16, 6:07 pm, Christophe > > > wrote: > > > > > hello everyone, > > > > > I have a strange problem with one of my ListActivity. I have overrided > > > > the default ArrayAdapter in order to customize my list. I have then > > > > filled the adapter with an ArrayList. > > > > > If I insert an element on the list and then call > > > > notifyDataSetChanged() on the adapter everything works fine. > > > > > But if I insert an element at the END of the list and then call > > > > notifyDataSetChanged(), the new element doesn't appear ... > > > > > And finally if I override getCount() on my adapter like this : > > > > > @Override > > > > public int getCount() { > > > > return myArrayList.size(); > > > > > } > > > > > then everything works fine. > > > > Is this a bug or am I doing something wrong ? > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: bug with notifyDataSetChanged() in ArrayAdapter ?
the only example I have found for ArrayAdapter in the API example doesn't show how to add element in the array : http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List1.html and getCount() is not overrided in this example ... On Jun 16, 9:39 pm, Kumar Bibek wrote: > You have to override the getCount method. Please go through the > examples to check how the Adapters work. > > Thanks and Regards, > Kumar Bibekhttp://tech-droid.blogspot.com > > On Jun 16, 6:07 pm, Christophe > wrote: > > > hello everyone, > > > I have a strange problem with one of my ListActivity. I have overrided > > the default ArrayAdapter in order to customize my list. I have then > > filled the adapter with an ArrayList. > > > If I insert an element on the list and then call > > notifyDataSetChanged() on the adapter everything works fine. > > > But if I insert an element at the END of the list and then call > > notifyDataSetChanged(), the new element doesn't appear ... > > > And finally if I override getCount() on my adapter like this : > > > @Override > > public int getCount() { > > return myArrayList.size(); > > > } > > > then everything works fine. > > Is this a bug or am I doing something wrong ? > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] bug with notifyDataSetChanged() in ArrayAdapter ?
hello everyone, I have a strange problem with one of my ListActivity. I have overrided the default ArrayAdapter in order to customize my list. I have then filled the adapter with an ArrayList. If I insert an element on the list and then call notifyDataSetChanged() on the adapter everything works fine. But if I insert an element at the END of the list and then call notifyDataSetChanged(), the new element doesn't appear ... And finally if I override getCount() on my adapter like this : @Override public int getCount() { return myArrayList.size(); } then everything works fine. Is this a bug or am I doing something wrong ? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: nullPointerException with custom ArrayAdapter
I didn't know this methods exists :) This is exactly what I needed, with that I should'nt have to re- inflate the layout each time getView is called. thx On May 31, 11:07 pm, Mark Murphy wrote: > Christophe wrote: > > I have different layout on my list (R.layout.step_list_item, > > R.layout.step_list_item2 ...) for each type of item in my list. > > Are you overriding getViewTypeCount() and getItemViewType() in your adapter? > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android App Developer Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: nullPointerException with custom ArrayAdapter
ok, I finally have understand what is going on : I have different layout on my list (R.layout.step_list_item, R.layout.step_list_item2 ...) for each type of item in my list. When I insert a new item, android try to re-use the layout which was previously in the list at the same position. And it use the wrong one because the type of the item has changed ... So I remove the "if (convertView == null)" test and re-inflate my layout each time and everything works fine now. morale : Premature optimization is the root of all evil. So now I've got a new question : isn't there a better way to do this ? It really seem awfully complicated just to have a list with different kind of items. On May 31, 10:36 pm, Christophe wrote: > hello Brad, thanks for your reply. > > Isn't the call to super.getView(...) suppose to do this ?? I already > told the adapter which layout to use (see the constructor of my > adpater on my first post), so it should know which one to inflate. > > Anyways I tried something similar to what you suggested : > > if (convertView == null) { > convertView = > LayoutInflater.from(getApplicationContext()).inflate(R.layout.step_list_item, > null); > > } > > but I've got a similar nullPointerException when I call > "findViewById" : > > EditText ed = (EditText) > convertView.findViewById(R.id.list_item_sb); // return null > ed.setText("test"); // will crash > > Again, it works fine when the list is shown for the first time but it > crash when I use "adapter.notifyDataSetChanged()" ... > So "R.id.list_item_sb" is found in my layout the first time but not > the second time ??? > > This is getting confusing :( > > On May 31, 10:07 pm, Brad Gies wrote: > > > You need something like this in the getView to create the view if it > > hasn't been created already.: > > > if (convertView == null) > > { > > LayoutInflater inflater = > > Groups.this.getLayoutInflater(); > > convertView = inflater.inflate(R.layout.groupitem, > > null); > > } > > > On 31/05/2010 12:58 PM, Christophe wrote: > > > > hello, > > > > I have written a custom ArrayAdapter for a ListActivity : > > > > private class StepItemAdapter extends ArrayAdapter { > > > public StepItemAdapter(Context context, List objects) { > > > super(context, R.layout.step_list_item, > > > R.id.list_item_sb, > > > objects); > > > } > > > > �...@override > > > public View getView(final int pos, View convertView, ViewGroup > > > parent) { > > > View v = super.getView(pos, convertView, parent); // > > > will crash > > > here > > > > // etc ... > > > } > > > } > > > > On the "onCreate" method of the activity I tell the activity to use > > > this adapter with a list of object I get from somewhere else > > > ("t.getSteps()") : > > > > adapter = new StepItemAdapter(this, t.getSteps()); > > > this.setListAdapter(adapter); > > > > Everything works fine and the activity is displayed. But if I add a > > > new object to the list and tell the adapter to refresh the view I've > > > got an error : > > > > t.getSteps().add(3, new Step()); > > > adapter.notifyDataSetChanged(); > > > > The "getView" method of my adapter is called, which is ok since the > > > list view need to be updated, but I've got an exception on the call to > > > "super.getView(pos, convertView, parent)". > > > > The stack trace : > > > > java.lang.NullPointerException > > > at > > > android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java: > > > 355) > > > at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323) > > > at pkr.tm.activities.EditTemplateActivity > > > $StepItemAdapter.getView(EditTemplateActivity.java:145) > > > at > > > android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java: > > > 220) > > > at android.widget.AbsListView.obtainView(AbsListView.java:1294) > > > at android.widget.ListView.makeAndAddView(ListView.java:1727) > > > at android.widget.ListView.fillDown(ListView.java:652) > > > at android.widget.ListView.fillSpecific(ListView.java:1284) > > > at android.widget.ListView.layoutChildren(ListView.java:1558) > &g
[android-developers] Re: nullPointerException with custom ArrayAdapter
hello Brad, thanks for your reply. Isn't the call to super.getView(...) suppose to do this ?? I already told the adapter which layout to use (see the constructor of my adpater on my first post), so it should know which one to inflate. Anyways I tried something similar to what you suggested : if (convertView == null) { convertView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.step_list_item, null); } but I've got a similar nullPointerException when I call "findViewById" : EditText ed = (EditText) convertView.findViewById(R.id.list_item_sb); // return null ed.setText("test"); // will crash Again, it works fine when the list is shown for the first time but it crash when I use "adapter.notifyDataSetChanged()" ... So "R.id.list_item_sb" is found in my layout the first time but not the second time ??? This is getting confusing :( On May 31, 10:07 pm, Brad Gies wrote: > You need something like this in the getView to create the view if it > hasn't been created already.: > > if (convertView == null) > { > LayoutInflater inflater = > Groups.this.getLayoutInflater(); > convertView = inflater.inflate(R.layout.groupitem, > null); > } > > On 31/05/2010 12:58 PM, Christophe wrote: > > > > > hello, > > > I have written a custom ArrayAdapter for a ListActivity : > > > private class StepItemAdapter extends ArrayAdapter { > > public StepItemAdapter(Context context, List objects) { > > super(context, R.layout.step_list_item, > > R.id.list_item_sb, > > objects); > > } > > > �...@override > > public View getView(final int pos, View convertView, ViewGroup > > parent) { > > View v = super.getView(pos, convertView, parent); // > > will crash > > here > > > // etc ... > > } > > } > > > On the "onCreate" method of the activity I tell the activity to use > > this adapter with a list of object I get from somewhere else > > ("t.getSteps()") : > > > adapter = new StepItemAdapter(this, t.getSteps()); > > this.setListAdapter(adapter); > > > Everything works fine and the activity is displayed. But if I add a > > new object to the list and tell the adapter to refresh the view I've > > got an error : > > > t.getSteps().add(3, new Step()); > > adapter.notifyDataSetChanged(); > > > The "getView" method of my adapter is called, which is ok since the > > list view need to be updated, but I've got an exception on the call to > > "super.getView(pos, convertView, parent)". > > > The stack trace : > > > java.lang.NullPointerException > > at > > android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java: > > 355) > > at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323) > > at pkr.tm.activities.EditTemplateActivity > > $StepItemAdapter.getView(EditTemplateActivity.java:145) > > at > > android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java: > > 220) > > at android.widget.AbsListView.obtainView(AbsListView.java:1294) > > at android.widget.ListView.makeAndAddView(ListView.java:1727) > > at android.widget.ListView.fillDown(ListView.java:652) > > at android.widget.ListView.fillSpecific(ListView.java:1284) > > at android.widget.ListView.layoutChildren(ListView.java:1558) > > at android.widget.AbsListView.onLayout(AbsListView.java:1147) > > ... > > > Do you guy have any ideas of what is going on ?? > > -- > Sincerely, > > Brad Gies > --- > Bistro Bot - Bistro > Blurbhttp://www.bgies.comhttp://www.bistroblurb.comhttp://www.bistrobot.com > --- > > Never doubt that a small group of thoughtful, committed people can > change the world. Indeed. It is the only thing that ever has - Margaret Mead -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] nullPointerException with custom ArrayAdapter
hello, I have written a custom ArrayAdapter for a ListActivity : private class StepItemAdapter extends ArrayAdapter { public StepItemAdapter(Context context, List objects) { super(context, R.layout.step_list_item, R.id.list_item_sb, objects); } @Override public View getView(final int pos, View convertView, ViewGroup parent) { View v = super.getView(pos, convertView, parent); // will crash here // etc ... } } On the "onCreate" method of the activity I tell the activity to use this adapter with a list of object I get from somewhere else ("t.getSteps()") : adapter = new StepItemAdapter(this, t.getSteps()); this.setListAdapter(adapter); Everything works fine and the activity is displayed. But if I add a new object to the list and tell the adapter to refresh the view I've got an error : t.getSteps().add(3, new Step()); adapter.notifyDataSetChanged(); The "getView" method of my adapter is called, which is ok since the list view need to be updated, but I've got an exception on the call to "super.getView(pos, convertView, parent)". The stack trace : java.lang.NullPointerException at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java: 355) at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323) at pkr.tm.activities.EditTemplateActivity $StepItemAdapter.getView(EditTemplateActivity.java:145) at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java: 220) at android.widget.AbsListView.obtainView(AbsListView.java:1294) at android.widget.ListView.makeAndAddView(ListView.java:1727) at android.widget.ListView.fillDown(ListView.java:652) at android.widget.ListView.fillSpecific(ListView.java:1284) at android.widget.ListView.layoutChildren(ListView.java:1558) at android.widget.AbsListView.onLayout(AbsListView.java:1147) ... Do you guy have any ideas of what is going on ?? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] cuztomized ListView
hello, I'm trying to reproduce the list view that can be seen in the browser when you hit the menu key then "windows" (see this screenshot : http://picasaweb.google.fr/lh/photo/o7uzrwYGcZizwrKlAkRspONA9k7APX93itjEb0IPq5c?feat=directlink). The 2 features I want is the "new" button at the top and the "delete" button on the right. - problem #1 : I have managed to put a button on the top of my list using the "addHeaderView" method. But it look like, well, a button instead of looking like a list item ... - problem #2 : how can I put button on the right of the list items like the "delete" buttons ? - subsidiary problem : why the hell can't i use the keyboard in the emulator ? Chinese character keep appearing :( Do you have any ideas of how this particular screen is implemented in the android browser ? It would be very useful to me :) regards, Christophe -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: getting CPU usage and memory usage of a particular process
Hi As far as I know there is no api to get cpu usage in android. I suggest you to lookup that by invoking linux 'top' command based on the pid process number. Be aware on memory charge then launch external cmd within apps. BR Chris On 23 déc 2009, 07:20, Raghu Kiran wrote: > Hi All, > > I need to retrieve the CPU usage and memory usage of a particular running > process in android. > > 1. Can i retrieve the above mentioned information in android. > 2. If yes how to do that. > 3. If not what is the alternative for this. > > Thanking you... > > BR, > Raghu Kiran A -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Firewall for android
Hi, I'm going to develop a firewall app on android, and I wouldn't fork any linux scripts to setup Iptables on kernel level. Is there a way through availble Andoid API to block/unblock access network on process level? I mean by controlling I/O network communication within sandbox VM ? Kind Rgrds Chris -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Inter-process communication with a Service and Notifications issue
Hi Dianne, Thanks for this enlightening info. I finally used the android:launchMode="singleTask" option in my manifest and that solves my problem. I will look into to the documentation of the LocalService the next days. Christophe On Mon, Dec 14, 2009 at 5:06 AM, Dianne Hackborn wrote: > You can set android:launchMode to singleTop to avoid having multiple > instances of the activity created on top of each other. However, you > probably want to sit down and think about how this notification should > interact with the application in all of its states -- both while the user is > in it, and when they are elsewhere. This is probably one of most > challenging areas of Android app design, and still has some issues with even > some of the standard apps. > Anyway, there are two main approaches I would recommend taking: > (1) If your app consists of a single main activity that the user naturally > wants to return to, then have the notification intent launch that with the > standard intent (MAIN action, LAUNCHER category), with > FLAG_ACTIVITY_CLEAR_TOP so that the user will return to this instead of > whatever other activity was on top of it. The Gmail application is mostly a > good example of this, where the notification brings you to the main inbox > activity, regardless of whether you were last viewing a message. > (2) Otherwise, have the notification launch a special activity that tells > the user the full information associated with it, with facilities to launch > in to the actual application in whatever state is appropriate. This special > activity, once the user selects something in its UI, will launch the desired > regular app activity with FLAG_ACTIVITY_NEW_TASK, allowing it to be placed > on top of the app in whatever state it currently is in, or use other flags > or such to control how the user enters the current app state. The Calendar > application is a good example of this -- note how selecting its notification > brings you to a summary of all of the unhandled notifications, allowing you > to tap on one to view it in the app. > One of the goals of this is that you really want to design things so that > when the user selects your notification, they can press BACK to return to > whatever they were previously doing -- NOT to have that go back through your > app's old history stack however they last left it. > Btw, one more thing, I notice in your app manifest that you are not using > multiple processes, so you are not really doing "IPC" with the service. > This is good. In fact you don't actually need that .aidl interface at all > -- you can use the method shown in the LocalService sample code to simplify > your app a fair amount in this area: > http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/app/LocalServiceController.html > http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/app/LocalService.html > > http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/app/index.html > On Sun, Dec 13, 2009 at 8:40 AM, Christophe Vandeplas > wrote: >> >> Hello, >> >> >> I'm having an issue with inter-process communication with a Service >> and Notifications >> >> >> The structure of my application is as follow: >> - ListActivity (TunnelDroid), once the user presses a listitem it will >> start a Service. >> The ListActivity is binded to the service for intra-process communication >> >> - Service (TunnelManagerService): running in the background. This >> service will add a (permanent) Notification in the statusbar. >> Using a Handler I sometimes need to communicate with the ListActivity >> (to show GUI Dialogs) >> >> - Notification: Once this notification is clicked it should open the >> ListActivity. >> >> >> To add the action when the user touches the notification I use the >> following code: >> >> notificationIntent.setClassName("net.sourceforge.tunneldroid","net.sourceforge.tunneldroid.TunnelDroid"); >> Then I use the intent to create the notification. >> >> Unfortunately a new Intent is opened. When I press the back button the >> original ListActivity is shown. >> So I have two instances of my same class/list. >> >> >> How could I make sure the original ListActivity is opened when the >> user touches the Notification? >> >> It's OK for me if the original ListActivity was previously destroyed, >> but I cannot have two instances. >> The problem is that the Handler in the Service has a reference to the >> ListActivity (PARENT_ACTIVITY), so if another instance is created I >> have invalid refer