[android-developers] Re: Nexus 2.1 one sale, WHERE is the SDK!
Whole idea of having google superphone and write some main parts of OS as closed source bits for that device is flawed from beginning. On other hand, if your code works on 2.01, then it should work on nexus (except that hw related things). I am missing some big notice on developers page month before, saying : There will be phone with major market penetration, which uses 2.01; fix your apps guys And..android was never a real opensource system. Google is kind to let us access parts main parts of OS, that's 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: Playing youtube videos on Android
eh..forgot part of response: there is parameter on end of url which forces format, like: http://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile?format=6 You can see details @ http://gdata.youtube.com/demo/index.html On 24 lis, 18:07, Nicholas Key nicholaskeythole...@gmail.com wrote: Hi all, I want to learn how to streamyoutubevideo in high quality mode (similar to those videos you watch from your android phones on theYouTubeapp) .I have been scouring the net to find code examples and tutorials about streamingyoutubevideos in high quality but those are not the ones I wanted. The examples that I found are about streaming 3gp video format and I don't want those because they are choppy and seem pixelated. Any ideas how to develop an app similar to the one asYouTubeapp? I know some of you may say, YouTubeapp is already doing what you want to do, why bother writing something similar. I want to learn how it works :) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] mediastore thumbnails
Hello, I want to display gallery of videos with thumbnails in my app. Is this what MediaStore.Video.Thumbnails.getThumbnail() do? I didn't found way to use it. Other properties of video files are easily accessible (MediaStore.Video.Media.DISPLAY_NAME for example), but there is probably different logic behind that thumbnail class. Anyone know how to fill adapter like it is in Hello views samples? I tried something like Bitmap bm = MediaStore.Video.Thumbnails.getThumbnail (getContentResolver(), position, 1, null); iv.setImageBitmap(bm); but it don't work... Any little help welcomed. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Playing youtube videos on Android
There is a ! JAVA !!! example on youtube dev page. I am not sure why there are examples in all other existing languages, except our dalvik java, but if you combine this with basic media example from sdk, you will be green as supergreen. On 24 lis, 18:07, Nicholas Key nicholaskeythole...@gmail.com wrote: Hi all, I want to learn how to streamyoutubevideo in high quality mode (similar to those videos you watch from your android phones on theYouTubeapp) .I have been scouring the net to find code examples and tutorials about streamingyoutubevideos in high quality but those are not the ones I wanted. The examples that I found are about streaming 3gp video format and I don't want those because they are choppy and seem pixelated. Any ideas how to develop an app similar to the one asYouTubeapp? I know some of you may say, YouTubeapp is already doing what you want to do, why bother writing something similar. I want to learn how it works :) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Countries for selling priced applications in Android Market
Mark, yes, it make sense to sell app you already made. But look at https://slideme.org/application/speed-forge-3d, this is probably best 3d racing game on android and it sold 512 copies. On 14 říj, 19:41, Mark Murphy mmur...@commonsware.com wrote: karthikr wrote: I have developed a few applications and am waiting for releasing them. Why wait? Android Market is not the only distribution channel. By waiting, all you do is lose the opportunity to gain feedback from early adopters that you can use to improve your application by the time the Android Market is available in your jurisdiction. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Need Android talent? Ask on HADO!http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ListView, how do I change the orange highlight color?
You don't have to, I was at work and didn't have specific link to document, which is http://commonsware.com/Android/excerpt.pdf Hope it helps, it helped me lot. On Oct 15, 3:35 pm, Mikael Bertlin mikael.bert...@gmail.com wrote: Hi Thanks for the reply, but: 1. Thats not the answer I was looking for :-P 2. I'd really like to figure this out without buying a book On Oct 15, 9:06 am, vorcigernix vorciger...@gmail.com wrote: 1) Do not change default colors :) As user, I am used to some color scheming, and all I need to know is that I am hovering or selecting something. It is not an aesthetic race..on appstore I saw application in which I was searching for ok button for 2 minutes. It wasn't there..author decided it is better to have peel page control. 2) If you really need to: there is great article about customizing listviews athttp://commonsware.com/ On 14 říj, 23:51, Mikael Bertlin mikael.bert...@gmail.com wrote: How do I change the original orange highlight color to something else? That is, the color I get when I click in a ListView. I've tried to set the android:textColorHighlight of the ListView and/or the TextView for the rows, nothing work. I've manage to remove it by setting android:listSelector=# of my ListView but I just want to change the color, but it seems impossible. How do I do that? Thanks /Micke- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] profiles manager
Hello, One of features od my old n95 I am missing on my new hero is simple management of ringtones and their volumes. I found Locale, which is good, but I think I could use really simpler application just for that. I wrote widget to simple change ringtone and volume from one to another, but this is really unusable, because: I need to change profile mostly with locked phone. Press button + slide screen + press widget is really boring way to do this. This is where it gets interesting. I searched this forums and it looks like we are still not able to make lock screen widget, which will good way to go. So, is it possible to capture any hardware button? I found discussion about home button, and I have to agree that overriding home will ruin user experience. But something like trackball press in sleep mode? Or volume buttons? Imho, if this is possible, user should be warned in red that application shoud do something like that. If not..ok, I understand why :) Regards Adam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Android Software Engineer - 15.000 PLN / m-c
I doubt this is a recruitment forum, If it is..I finally understand why some of my questions are still open :-D On 14 říj, 08:54, Tomasz Mazur nog...@gmail.com wrote: Naszym klientem jest firma o światowej renomie w zakresie dostarczania aplikacji mobilnych. Dwa główne obszary działalności naszego klienta, to: rozwój aplikacji mobilnych dla wielu platform mobilnych oraz usług zapewniających wysoką jakość standardowych komponentów oprogramowania na urządzenia mobilne. Nasz klient tworzy innowacyjne aplikacje mobilne rich-media; aplikacje klienckie Social Networking; produkty i usługi Visual Voicemail; rozwiązania Mobile Marketing oraz Mobile TV Video. Partnerami naszego klienta, są wiodący operatorzy telefonii komórkowej oraz producenci urządzeń mobilnych z całego świata. Android Software Engineer Miejsce pracy: Kolonia Nr ref.: ASE/Kolonia Warunki projektu: Wynagrodzenie: 15.000 PLN / m-c Czas trwania: 9 - 12 m-cy - z opcją przedłużenia (po zakończeniu kontraktu firma oferuje udział w innych równie ciekawych projektach) Rozpoczęcie: Rekrutacja ciągła Miejsce: Kolonia Tryb pracy: Pełny etat Forma współpracy / rozliczenie: Faktura VAT / umowa o dzieło / umowa zlecenie. Oczekiwania firmy: - Wykształcenie wyższe informatyczne lub pokrewne - Przynajmniej 3 letnie doświadczenie developerskie (C++ / C / Java) - Przynajmniej roczne doświadczenie developerskie pod Android - Bardzo dobra znajomość języka angielskiego Nasz klient zapewnia: - Praca przy bardzo ciekawym projekcie - Wynagrodzenie 15.000 PLN / M-c - Zakwaterowanie w mieszkaniu firmowym - Dzienne diety - Zwrot kosztów podróży Polska = Kolonia Osoby zainteresowane naszą ofertą prosimy o przesłanie CV.doc w języku angielskim, z klauzulą o zgodzie na przetwarzanie danych osobowych, na adres: praca[na]rekrutacyjny.pl W temacie aplikacji prosimy o wpisanie nazwy stanowiska lub numeru referencyjnego oferty. Prosimy o załączenie następującej klauzuli: Wyrażam zgodę na przetwarzanie moich danych osobowych zawartych w mojej ofercie pracy dla potrzeb niezbędnych do realizacji procesu rekrutacji (zgodnie z Ustawą o Ochronie Danych Osobowych z dn. 29.08.1997 Dz. U. Nr 133 poz. 883) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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 paid apps for free ??
I think major source of these applications are torrents. But I have to second what String said, if you really want to sell you apps, you have to use AndAppStore and SlideME just because there are around 50% of users which can't buy your software from google marketplace even if they want. I think it is correct to blame google for poor marketplace, on other hand I really appriciate that you don't have to use google marketplace at all. On 14 říj, 13:48, WoodManEXP woodman...@gmail.com wrote: I keep reading posts about Chinese and other web sites that are offering the paid, copy protected apps for free. If this is indeed the case and there is not a reasonable remedy it definitely takes the wind out of our sails for investing further in creating applications for the Android platform. Some say that Google bears no responsibility in this situation, but I think they do need to step up in some fashion. After all Google has positioned the Marketplace as sole distribution point for the apps and take 30% for their services. But if what the Marketplace does is funnel copy protected apps into the free distribution channels then what is the point? Can anyone from Google respond to this situation? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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 paid apps for free ??
Yes, it was estimate. It is actually 35-40% if this chart is to be believed: http://metrics.admob.com/wp-content/uploads/2009/07/admob-mobile-metrics-june-09.pdf Anyway... On Oct 14, 7:16 pm, Dianne Hackborn hack...@android.com wrote: On Wed, Oct 14, 2009 at 6:19 AM, vorcigernix vorciger...@gmail.com wrote: there are around 50% of users which can't buy your software from google marketplace even if they want. I'd be very interested in hearing where you get -that- number from. -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] activesync contacts uri
Hello, there is well documented provider for standard phone contacts (android.provider.Contacts.People). Is there anyone who knows how to access activesync contacts from HTC? I am creating application which need access to all providers. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Countries for selling priced applications in Android Market
I didn't know (and did't expected to be honest) that Google is slower then Microsoft and Apple in this. Only good in this is that you need market only for paid apps, most android users are techies anyway and they are absolutely able to install package on their own. On other hand, I'll never develop paid app for android, until market works here (in Czech, but whole world will do). Android have other big disadvantages - market penetration is first, this one sink it for me (as a developer, I love my Hero :) ) On Aug 24, 7:58 am, Michael Leung michaelchi...@gmail.com wrote: Hi, That is near the end of Q3 now. Does anyone know whether there will be a new list of Countries for selling priced applications in Android Market? -- Regards, Michael Leunghttp://www.itblogs.infohttp://www.michaelleung.info --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: updating UI from runnable
Btw..for others on dark, there are two great tutorials about sthat kind of application. One is from Mark http://commonsware.com/Android/excerpt.pdf and one I found toady at http://www.softwarepassion.com/?p=189 . Second one do mostly what I tried with my poor java in my code. On Oct 4, 5:34 pm, vorcigernix vorciger...@gmail.com wrote: Thanks, now it is working :) On Oct 4, 2:27 pm, Mark Murphy mmur...@commonsware.com wrote: I am getting error at stext.setText(sdf.format(cal.getTime()).toString()+ chyba); where it ends on null pointer exception. I tried to add: setContentView(R.layout.main); which required to add a listview named android:list. Now...it works same way as before, it ends on same null pointer exception :) Your setContentView() call needs to precede your findViewById() call to get at your R.id.statustext widget. -- Mark Murphy (a Commons Guy)http://commonsware.com Android App Developer Books:http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: updating UI from runnable
Well, this is it gets interesting. This part of code is almost completely from list14.java from sdk, and it is working. I am disconnecting connection to server to simulate network error, which should appear in textview (to let my user know that last update try was at time, but unsuccessful). I am getting error at stext.setText(sdf.format(cal.getTime()).toString()+ chyba); where it ends on null pointer exception. I tried to add: setContentView(R.layout.main); which required to add a listview named android:list. Now...it works same way as before, it ends on same null pointer exception :) On Oct 3, 11:00 pm, Streets Of Boston flyingdutc...@gmail.com wrote: It's quite a bit of code, but one thing's missing that you have to do: In your onCreate, you're not calling setContentView(...). You have to do this to show at least something :-) On Oct 3, 4:39 pm, vorcigernix vorciger...@gmail.com wrote: Hello, I didn't found clear answer for why my code does not work. I assume it is because I am trying to update textview from runnable. Anybody know some workaround? Code isn't clean off course, I am happy to get that working so far as I am totally new in java. public class MainScreenActivity extends ListActivity { private Handler mHandler; private String url = http://sql08.globus.cz/turnovers/ turnoversuma.ashx; static JSONArray valArray2; public static final String DATE_FORMAT_NOW = HH:mm:ss; TextView stext; private static class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; private Bitmap mIcon1; private Bitmap mIcon2; public EfficientAdapter(Context context) { try{ // Cache the LayoutInflate to avoid asking for a new one each time. mInflater = LayoutInflater.from(context); // Icons bound to the rows. mIcon1 = BitmapFactory.decodeResource(context.getResources (), R.drawable.green); mIcon2 = BitmapFactory.decodeResource(context.getResources (), R.drawable.yellow); } catch (Exception e) { Log.e(ERROR, ERROR IN CODE:+e.toString()); } } /** * The number of items in the list is determined by the number of speeches * in our array. * * @see android.widget.ListAdapter#getCount() */ public int getCount() { try { return valArray2.length(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return 0; } } /** * Since the data comes from an array, just returning the index is * sufficent to get at the data. If we were using a more complex data * structure, we would return whatever object represents one row in the * list. * * @see android.widget.ListAdapter#getItem(int) */ public JSONArray getItem(int position) { JSONArray retobj = null; try { retobj = valArray2.getJSONArray(position); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return retobj; } /** * Use the array index as a unique id. * * @see android.widget.ListAdapter#getItemId(int) */ public long getItemId(int position) { return position; } /** * Make a view to hold each row. * * @see android.widget.ListAdapter#getView(int, android.view.View, * android.view.ViewGroup) */ public View getView(int position, View convertView, ViewGroup parent) { // A ViewHolder keeps references to children views to avoid unneccessary calls // to findViewById() on each row. ViewHolder holder; // When convertView is not null, we can reuse it directly, there is no need // to reinflate it. We only inflate a new View when the convertView supplied // by ListView is null. holder = new ViewHolder(); try { if (convertView == null) { convertView = mInflater.inflate(R.layout.list_item_icon_text, null); // Creates a ViewHolder and store references to the two children views
[android-developers] Re: updating UI from runnable
Thanks, now it is working :) On Oct 4, 2:27 pm, Mark Murphy mmur...@commonsware.com wrote: I am getting error at stext.setText(sdf.format(cal.getTime()).toString()+ chyba); where it ends on null pointer exception. I tried to add: setContentView(R.layout.main); which required to add a listview named android:list. Now...it works same way as before, it ends on same null pointer exception :) Your setContentView() call needs to precede your findViewById() call to get at your R.id.statustext widget. -- Mark Murphy (a Commons Guy)http://commonsware.com Android App Developer Books:http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: jsonarray as listview source
Thank you..finally found some way to go, perhaps not best one, but working :) On Oct 1, 3:09 am, Streets Of Boston flyingdutc...@gmail.com wrote: I think you can't use the '[ ]' operator on the JSONArray (if valArray2 is a JSONArray). [ ] only works in regular arrays. Look at the JSONArray class and see what method is implemented in that class to return an JSON element at position 'x'. And you have to make sure that the value provided to the 'setText' method is a CharSequence (e.g. a String). If you're not familiar with Java, i strongly suggest you do become familiar with it :-). On Sep 30, 3:50 pm, vorcigernix vorciger...@gmail.com wrote: Thanks. This moved my understanding of whole BaseAdapter (which is not data adapter at all). Now I am frozen on some casting unknown to me (probably). I created code: public View getView(int position, View convertView, ViewGroup parent) { // A ViewHolder keeps references to children views to avoid unneccessary calls // to findViewById() on each row. ViewHolder holder; // When convertView is not null, we can reuse it directly, there is no need // to reinflate it. We only inflate a new View when the convertView supplied // by ListView is null. if (convertView == null) { convertView = mInflater.inflate (R.layout.list_item_icon_text, null); // Creates a ViewHolder and store references to the two children views // we want to bind data to. holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById (R.id.text); holder.text2 = (TextView) convertView.findViewById (R.id.text2); holder.icon = (ImageView) convertView.findViewById (R.id.icon); convertView.setTag(holder); } else { // Get the ViewHolder back to get fast access to the TextView // and the ImageView. holder = (ViewHolder) convertView.getTag(); } // Bind the data efficiently with the holder. holder.text.setText(valArray2[position]); holder.text2.setText(valArray2[position]); holder.icon.setImageBitmap((position 1) == 1 ? mIcon1 : mIcon2); ... Which is basically list14 example from SDK. But, holder.text.setText (valArray2[position]); returns error that Array is expected and mine is JSONArray. How to cast my JSONArray to expected format? On Sep 30, 6:37 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Implement your subclass of BaseAdapter (e.g. JSONArrayAdapter). Implement/override the getCount(), getItem(int position), etc. to make your BaseAdapter a proper list-adapter around your jsonarray. Implement the getView method; it provides the 'position' and 'contentView' parameters. - Use position and getItem(position) to obtain anjson-element from your jsonarray. - re-use contentView or create a brand-new one if it is null: - Assign text/images to the contentView (or its child-view) based on thejson-element you got. Then assign an instance of your JSONArrayAdapter to your list- or grid- view. And viola. It should work :) Take a look at the 'API Demo' in the Android SDK for examples. On Sep 29, 3:45 pm, vorcigernix vorciger...@gmail.com wrote: Ok, I don't get a BaseAdapter logic, I assume because I am not used to java. I found tons of examples on net (mostly for drawing pictures etc) but it make no sense to me. For example, list4 from sdk do something similar, but...where are they binding data? I see where data is set to custom class, but what actually returns data from BaseAdapter? GetView? Thanks for any clarification Adam On Sep 28, 8:15 pm, Mark Muphy mmur...@commonsware.com wrote: vorcigernix wrote: Hello, I made my application from various examples and sources, so now I have filled jsonarray and preparedlistview(with custom rows formatting). Now I need to replace ListAdapter myAdapter =(new ArrayAdapterString (this,R.layout.rowlayout, R.id.TextView01, values)); with myjsonarray based adapter. All I found is some technique to iterate through alljsonrecords and construct string array. It sound like perverse to me, is it really necessary? Create your own adapter class from BaseAdapter, and you can traverse yourJSONhowever you want. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Need Android talent? Ask on HADO!http://wiki.andmob.org/hado-Hidequotedtext - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received
[android-developers] updating UI from runnable
Hello, I didn't found clear answer for why my code does not work. I assume it is because I am trying to update textview from runnable. Anybody know some workaround? Code isn't clean off course, I am happy to get that working so far as I am totally new in java. public class MainScreenActivity extends ListActivity { private Handler mHandler; private String url = http://sql08.globus.cz/turnovers/ turnoversuma.ashx; static JSONArray valArray2; public static final String DATE_FORMAT_NOW = HH:mm:ss; TextView stext; private static class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; private Bitmap mIcon1; private Bitmap mIcon2; public EfficientAdapter(Context context) { try{ // Cache the LayoutInflate to avoid asking for a new one each time. mInflater = LayoutInflater.from(context); // Icons bound to the rows. mIcon1 = BitmapFactory.decodeResource(context.getResources (), R.drawable.green); mIcon2 = BitmapFactory.decodeResource(context.getResources (), R.drawable.yellow); } catch (Exception e) { Log.e(ERROR, ERROR IN CODE:+e.toString()); } } /** * The number of items in the list is determined by the number of speeches * in our array. * * @see android.widget.ListAdapter#getCount() */ public int getCount() { try { return valArray2.length(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return 0; } } /** * Since the data comes from an array, just returning the index is * sufficent to get at the data. If we were using a more complex data * structure, we would return whatever object represents one row in the * list. * * @see android.widget.ListAdapter#getItem(int) */ public JSONArray getItem(int position) { JSONArray retobj = null; try { retobj = valArray2.getJSONArray(position); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return retobj; } /** * Use the array index as a unique id. * * @see android.widget.ListAdapter#getItemId(int) */ public long getItemId(int position) { return position; } /** * Make a view to hold each row. * * @see android.widget.ListAdapter#getView(int, android.view.View, * android.view.ViewGroup) */ public View getView(int position, View convertView, ViewGroup parent) { // A ViewHolder keeps references to children views to avoid unneccessary calls // to findViewById() on each row. ViewHolder holder; // When convertView is not null, we can reuse it directly, there is no need // to reinflate it. We only inflate a new View when the convertView supplied // by ListView is null. holder = new ViewHolder(); try { if (convertView == null) { convertView = mInflater.inflate(R.layout.list_item_icon_text, null); // Creates a ViewHolder and store references to the two children views // we want to bind data to. holder.text = (TextView) convertView.findViewById(R.id.text); holder.text2 = (TextView) convertView.findViewById (R.id.text2); holder.icon = (ImageView) convertView.findViewById(R.id.icon); convertView.setTag(holder); } else { // Get the ViewHolder back to get fast access to the TextView // and the ImageView. holder = (ViewHolder) convertView.getTag(); } } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // Bind the data efficiently with the holder. try { String rowString = [ + valArray2.getString(position) + ]; JSONArray rowArr = new
[android-developers] Re: jsonarray as listview source
Thanks. This moved my understanding of whole BaseAdapter (which is not data adapter at all). Now I am frozen on some casting unknown to me (probably). I created code: public View getView(int position, View convertView, ViewGroup parent) { // A ViewHolder keeps references to children views to avoid unneccessary calls // to findViewById() on each row. ViewHolder holder; // When convertView is not null, we can reuse it directly, there is no need // to reinflate it. We only inflate a new View when the convertView supplied // by ListView is null. if (convertView == null) { convertView = mInflater.inflate (R.layout.list_item_icon_text, null); // Creates a ViewHolder and store references to the two children views // we want to bind data to. holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById (R.id.text); holder.text2 = (TextView) convertView.findViewById (R.id.text2); holder.icon = (ImageView) convertView.findViewById (R.id.icon); convertView.setTag(holder); } else { // Get the ViewHolder back to get fast access to the TextView // and the ImageView. holder = (ViewHolder) convertView.getTag(); } // Bind the data efficiently with the holder. holder.text.setText(valArray2[position]); holder.text2.setText(valArray2[position]); holder.icon.setImageBitmap((position 1) == 1 ? mIcon1 : mIcon2); ... Which is basically list14 example from SDK. But, holder.text.setText (valArray2[position]); returns error that Array is expected and mine is JSONArray. How to cast my JSONArray to expected format? On Sep 30, 6:37 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Implement your subclass of BaseAdapter (e.g. JSONArrayAdapter). Implement/override the getCount(), getItem(int position), etc. to make your BaseAdapter a proper list-adapter around your jsonarray. Implement the getView method; it provides the 'position' and 'contentView' parameters. - Use position and getItem(position) to obtain anjson-element from your jsonarray. - re-use contentView or create a brand-new one if it is null: - Assign text/images to the contentView (or its child-view) based on thejson-element you got. Then assign an instance of your JSONArrayAdapter to your list- or grid- view. And viola. It should work :) Take a look at the 'API Demo' in the Android SDK for examples. On Sep 29, 3:45 pm, vorcigernix vorciger...@gmail.com wrote: Ok, I don't get a BaseAdapter logic, I assume because I am not used to java. I found tons of examples on net (mostly for drawing pictures etc) but it make no sense to me. For example, list4 from sdk do something similar, but...where are they binding data? I see where data is set to custom class, but what actually returns data from BaseAdapter? GetView? Thanks for any clarification Adam On Sep 28, 8:15 pm, Mark Muphy mmur...@commonsware.com wrote: vorcigernix wrote: Hello, I made my application from various examples and sources, so now I have filled jsonarray and preparedlistview(with custom rows formatting). Now I need to replace ListAdapter myAdapter =(new ArrayAdapterString (this,R.layout.rowlayout, R.id.TextView01, values)); with myjsonarray based adapter. All I found is some technique to iterate through alljsonrecords and construct string array. It sound like perverse to me, is it really necessary? Create your own adapter class from BaseAdapter, and you can traverse yourJSONhowever you want. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Need Android talent? Ask on HADO!http://wiki.andmob.org/hado-Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: jsonarray as listview source
Ok, I don't get a BaseAdapter logic, I assume because I am not used to java. I found tons of examples on net (mostly for drawing pictures etc) but it make no sense to me. For example, list4 from sdk do something similar, but...where are they binding data? I see where data is set to custom class, but what actually returns data from BaseAdapter? GetView? Thanks for any clarification Adam On Sep 28, 8:15 pm, Mark Muphy mmur...@commonsware.com wrote: vorcigernix wrote: Hello, I made my application from various examples and sources, so now I have filled jsonarray and prepared listview (with custom rows formatting). Now I need to replace ListAdapter myAdapter =(new ArrayAdapterString (this,R.layout.rowlayout, R.id.TextView01, values)); with my json array based adapter. All I found is some technique to iterate through all json records and construct string array. It sound like perverse to me, is it really necessary? Create your own adapter class from BaseAdapter, and you can traverse your JSON however you want. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Need Android talent? Ask on HADO!http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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 do I resize my application to a smaller one placing it on top left?
Sounds like crazy idea to me. On Sep 29, 6:41 am, Karthik P karthi...@gmail.com wrote: Is there any way for me to resize an app to make it smaller and placing it top left? I understand that there is a theme - Dialog its possible to make the window size smaller but is it possible for me to dictate the x, y, dx, and dy where the dialog has to be placed? Karthik --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] jsonarray as listview source
Hello, I made my application from various examples and sources, so now I have filled jsonarray and prepared listview (with custom rows formatting). Now I need to replace ListAdapter myAdapter =(new ArrayAdapterString (this,R.layout.rowlayout, R.id.TextView01, values)); with my json array based adapter. All I found is some technique to iterate through all json records and construct string array. It sound like perverse to me, is it really necessary? Thanks for any help Adam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---