[android-developers] problem with spanish characters in android app
I have issue with spanish characters in java string. I have a content RSS feed and when i try to transform it to java object using InputStreamReader, I get outputs like cómo which should be cómo. This is happening with other spanish characters like á = á é = é í = à ó = ó ú = ú and more.. How can I convert these characters to proper spanish characters? Here is how my InputStreamReader looks like: Reader reader = new BufferedReader(new InputStreamReader(is, UTF-8), 1024); I tried doing my own method like this: public static String fixSpanish(String s) { s = s.replaceAll(á, á); s = s.replaceAll(é, é); s = s.replaceAll(Ã, í); s = s.replaceAll(ó, ó); s = s.replaceAll(ú, ú); Log.d(TAG, s); return s; } But, this didn't work. None of search combinations are ever found. Any ideas? Thanks in advance -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Problem with using back button when on home activity
Thank you. Will try this. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Problem with using back button when on home activity
I am sure this is easy, but can't find solution for this. My app structure is something like this: HomeActivity subActivity subSubActivity subSubSubActivity On each activity (except home) in top left corner I have Home Icon which creates new Intent and starts home activity with StartActivity. What's happening: 1) I am on home 2) Lunch subActivity 3) Lunch subSubAcitivity 4) Press Home button 5) On home 6) Press Back Key 7) I am on subSubActivity (I would like to exit app here) Is it possible to delete history when on home activity? I tried to fix it with executing finish() before starting Home Activity (in step 4), but in that case Back button will take me to subActivity (which was running before). So, basically I want Back button to work on all activities as intended except on Home activity? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to implemennt OnZoomListener on MapView
I would like to have onZoomListener on my MapView. The code below is what I have done. It registers if zoom buttons are tapped. Since all new phones now supports pinch to zoom, this is useless. Does anybody have idea how to do real onZoomListener? Thanks. OnZoomListener listener = new OnZoomListener() { @Override public void onVisibilityChanged(boolean arg0) { // TODO Auto-generated method stub } @Override public void onZoom(boolean arg0) { Log.d(TAG, ZOOM CHANGED); // TODO Auto-generated method stub } }; ZoomButtonsController zoomButton = mapView.getZoomButtonsController(); zoomButton.setOnZoomListener(listener); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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 implemennt OnZoomListener on MapView
I had to subclass MapView and override dispatchDraw Here is the code: int oldZoomLevel=-1; @Override public void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (getZoomLevel() != oldZoomLevel) { Log.d(TAG, ZOOOMED); oldZoomLevel = getZoomLevel(); } } This blog helped me a lot: http://pa.rezendi.com/2010/03/responding-to-zooms-and-pans-in.html Above works great. Is there maybe simpler solution? I tried to implement onTouchListener on MapView directly but touch event would be detected only once if onTouchListener would return false. If it would return true, touch would be detected every time, but map zooming and panning wouldn't work. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Problem with large number of markers on google map
I am working on an Android app that already exists on iPhone. In the app, there is a Map activity that has (I counted) around 800 markers in four groups marked by drawable in four different colors. Each group can be turned on or off. Information about markers I have inside List. I create a mapOverlay for each group, then I attach that overlay to the map. I strongly believe that coding part I did properly. But I will attach my code anyway... The thing is, my Nexus One can't handle map with all those markers. It takes around 15 seconds just to draw 500 markers. Then when all drawn, map is not quite smooth. It is sort of hard to zoom and navigate around. It can be done, but experience is bad and I would like to see if something can be done there. I know if I avoid String Double conversion, I could save some time, but I doubt that would be significant. iPhone seems doesn't have problems showing all these markers. It takes roughly about 1-2 seconds to show all of them and zooming and panning is not that bad. Slow down is noticeable but still acceptable. I personally think it is no good to draw all those markers, but app is designed by somebody else and I am not supposed to make any drastic changes. I am not sure what to do here. It seems I will have to come up with different functionality, maybe use GPS location, if known, and draw only markers within some radius, or, if location not known, use center of the screen(map) and draw markers around that. I will have to have reasonable explanation for my bosses in case I make these changes. I appreciate if anybody has any idas. And the code: ListOverlay mapOverlays = mapView.getOverlays(); Drawable drawable = this.getResources().getDrawable(R.drawable.pin_blue); drawable = this.getResources().getDrawable(R.drawable.pin_blue); ArrList = appState.GetSleepArrList(); ItemizedOverlay itemizedoverlay = new ItemizedOverlay(drawable, this); ... ... for (int m = 0; m ArrList.size(); m++) { tName = ArrList.get(m).get(name).toString(); tId = ArrList.get(m).get(id).toString(); tLat = ArrList.get(m).get(lat).toString();; tLng = ArrList.get(m).get(lng).toString();; try { lat = Double.parseDouble(tLat); lng = Double.parseDouble(tLng); p1 = new GeoPoint( (int) (lat * 1E6), (int) (lng * 1E6)); OverlayItem overlayitem = new OverlayItem(p1, tName, tId); itemizedoverlay.addOverlay(overlayitem); } catch (NumberFormatException e) { Log.d(TAG, NumberFormatException + e); } } mapOverlays.add(itemizedoverlay); mapView.postInvalidate(); public class ItemizedOverlay extends ItemizedOverlayOverlayItem { private ArrayListOverlayItem mOverlays = new ArrayListOverlayItem(); private Context mContext; public HelloItemizedOverlay(Drawable defaultMarker, Context context) { super(boundCenterBottom(defaultMarker)); mContext = context; } public void addOverlay(OverlayItem overlay) { mOverlays.add(overlay); populate(); } @Override protected OverlayItem createItem(int i) { return mOverlays.get(i); } @Override public int size() { return mOverlays.size(); } @Override protected boolean onTap(int index) { final OverlayItem item = mOverlays.get(index); ... EACH MARKER WILL HAVE ONCLICK EVENT THAT WILL PRODUCE CLICABLE ... BALOON WITH MARKER'S NAME. return true; } } -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Problem with large number of markers on google map
You are right about populate() calls. I've picked up implementation of ItemizedOverlay from some online example and didn't question its validity. Now, when I pay attention, It makes sense what you said. The posted code is run only when user touch an option to do so. Thanks a lot TreKing... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: HeaderView in ListView causing ClassCastException
Kostya, I tried to do as you suggested. and non of it worked. 1) Don't want to add my header view into list's parent. It simply doesn't achieve what I want to do. I would like to add it to the parent that holds list view items. I have parent available in adapter's GetView method. When I tried to do that got error message telling me that addView is not allowed operation. 2) I tried to keep refererence to original adapter object and use that one when doing notifyDataSetChanged(); and I ended up with the same ClassCastException error. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: HeaderView in ListView causing ClassCastException
Thanks, I tried this. I got ClassCastException when adapter.notifyDataSetChanged() was executed. Thanks anyway. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] How to set top margin off the first item inside listview?
I would like to add Top Margin on the first item in the ListView. Is that possible? Or, how can I reference first list item in the List View? I tried lv = (ListView)getListView(); View myRowItem = lv.getChildAt(0); This probably doesn't work because at the moment I executed it, list items didn't exist yet. I assume I should try above code in something like onPostRender event. Is there something like that in Java Android? I was also trying to play with LayoutParameters in my adapter's GetView method. This seemed the solution at first, but I couldn't find a way to change topMargin of item at position 0. My app would crash every time. Also tried to add header view. Which is fine until you start changing your adapter. I made couple posts here (http://groups.google.com/group/ android-developers/browse_thread/thread/e4f45402a1b584c7/ d065364fa368a23f?show_docid=d065364fa368a23f) about that issue, but on the end, I concluded that it is not right way to go. And, the reason I am trying to do this, it's pure design issue. I want list when scrolled to use the whole working area, but when shown first time, I would like to have some space between top edge and first item. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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 set top margin off the first item inside listview?
Can you please explain how to add topMargin to listView item at position 0? For example, I can add topPadding on first item using parameter position. Test if position is equal 0, add padding, if not, remove padding. (I sort of not like this, but it seems it is the only way) The thing is, I cannot do the same for Margin. I have to access LayoutParameters in order to play with margin, and I simply don't know how to do that. Whatever I tried caused my app to crash. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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 set top margin off the first item inside listview?
Well, adding paddingTop on the listView is not what I want. I would like margin only on the first item in the list and list to use whole area when scrolled. From design point of view, there is valid reason (I think so) why I want to do this. On the other hand, it shouldn't be that hard to set that top margin. I can't use header view because app crashes when I filter the adapter and when adapter.notifyDataSetChanged() is issued. On Dec 14, 12:10 pm, Kostya Vasilyev kmans...@gmail.com wrote: You can specify android:paddingTop on the ListView. This might not do the right thing if you have a header view. In that case, set android:paddingBottom on the header view. -- Kostya 14.12.2010 20:27, bobetko пишет: I would like to add Top Margin on the first item in the ListView. Is that possible? Or, how can I reference first list item in the List View? I tried lv = (ListView)getListView(); View myRowItem = lv.getChildAt(0); This probably doesn't work because at the moment I executed it, list items didn't exist yet. I assume I should try above code in something like onPostRender event. Is there something like that in Java Android? I was also trying to play with LayoutParameters in my adapter's GetView method. This seemed the solution at first, but I couldn't find a way to change topMargin of item at position 0. My app would crash every time. Also tried to add header view. Which is fine until you start changing your adapter. I made couple posts here (http://groups.google.com/group/ android-developers/browse_thread/thread/e4f45402a1b584c7/ d065364fa368a23f?show_docid=d065364fa368a23f) about that issue, but on the end, I concluded that it is not right way to go. And, the reason I am trying to do this, it's pure design issue. I want list when scrolled to use the whole working area, but when shown first time, I would like to have some space between top edge and first item. -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to set top margin off the first item inside listview?
Here is my GetView method. public View getView(int position, View convertView, ViewGroup parent) { LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.topMargin = 20; ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.property_row, null); holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById(R.id.txtRowTitle); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if (position == 0) convertView.setLayoutParams(lp); else //need to remove margin holder.text.setText(ArrListFiltered.get(position).get(name).toString()); return convertView; } I also tried folowing with no success: 1) LayoutParams lp = (LayoutParams) parent.getLayoutParams(); 2) RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); 3) ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Last night I posted question in this group and it is gone???
Is it gone or actually it never appeared because it was not approved. Is there some moderation process behind the scene? If it is, I would love to be let known that my question is thrown into junk. This is really annoying. It happened to me before. I actually thought I was drunk or so, so maybe I didn't even send it, but as I was writing subject for this message, my list night subject popped out in the suggestion dropdown. I tried to search this subject line and it is nowhere to find. This was my subject line: onSaveInstanceState problem while making oAuth request Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Last night I posted question in this group and it is gone???
Thanks. You are right. I can find it if I search Google for onSaveInstanceState problem while making oAuth request. But if I search this group, I can't. Also, if I search group for all posts done by me it's not showing again. Weird... But thanks. On Dec 12, 9:41 am, Kostya Vasilyev kmans...@gmail.com wrote: I can see it, as well as TreKing's reply. I am using Thunderbird to read this group over email (POP3). It's also in the android-developers group archive if you do a Google web search: http://www.google.com/search?q=onSaveInstanceState+problem+while+maki... However, Goolge Groups doesn't find the message: http://groups.google.com/group/android-developers -- Kostya 12.12.2010 18:13, bobetko пишет: Is it gone or actually it never appeared because it was not approved. Is there some moderation process behind the scene? If it is, I would love to be let known that my question is thrown into junk. This is really annoying. It happened to me before. I actually thought I was drunk or so, so maybe I didn't even send it, but as I was writing subject for this message, my list night subject popped out in the suggestion dropdown. I tried to search this subject line and it is nowhere to find. This was my subject line: onSaveInstanceState problem while making oAuth request Thanks. -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: onSaveInstanceState problem while making oAuth request
I thought about that. But, then another question come to my mind. Why wouldn't I always use SharedPreferences to save my activity state? For example: I passed groupID and itemID values into activity. In onCreate, I save both values to SharedPreferences. Latter, when activity is restarted (for any reason: rotation, pause, was destroyed, etc.), I check Intent first, if nothing is passed, I load values from SharedPreferences. This way I woulnd't have to use onSaveInstanceState ever. Is this OK to do? 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] Re: onSaveInstanceState problem while making oAuth request
Thanks Dianne, I've look at logs and my app is crashing because my RowID value is null. RowID is record ID that is needed to query sqlite database. I could post here all my code, but I doubt it would be very useful... I'll try explaining better with some code snippets: This is what I execute when user push Authorize button: consumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); provider = new DefaultOAuthProvider(http://twitter.com/oauth/ request_token, http://twitter.com/oauth/access_token;, http://twitter.com/oauth/authorize;); String authUrl = provider.retrieveRequestToken(consumer, CALLBACK_URL); mWebView.loadUrl(authUrl); User is presented with login and password fields and there is also Allow button. When user pushes this Allow button, Twitter sends Intent (with token and secret) back to my activity. I process this Intent in onResume method. OnResume runs first, then onCreate. At this point my RowID is lost. Nowhere in this process onSaveInstanceState was called because of simple reason, activity is not paused, exited, screen is not rotated, etc... So, how do I save and retrieve my RowID? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: onSaveInstanceState problem while making oAuth request
Sorry. Yes. You are right. onCreate runs first, then onResume next. (I am still learning about Android activity cycle :-) Here is my onResume method that handle this data that comes from Twitter. See lines 5 and 6. If 6 is true I am extracting token and secret and saving them to SharedPreferences. This code runs fine, just that RowID variable gets lost in the process. onCreate that runs before this one (onResume), has no idea about RowID. @Override protected void onResume() { super.onResume(); Log.d(TAG, mRowID onResume : + mRowId); Uri uri = this.getIntent().getData(); if (uri != null uri.toString().startsWith(CALLBACK_URL)) { SessionPilot appState = ((SessionPilot)getApplicationContext()); consumer = appState.getConsumer(); provider = appState.getProvider(); String verifier = uri.getQueryParameter(oauth.signpost.OAuth.OAUTH_VERIFIER); try { provider.retrieveAccessToken(consumer, verifier); Utils.StoreStringToPrefs(twitterToken, consumer.getToken(), PREF_FILE_NAME ,this); Utils.StoreStringToPrefs(twitterSecret, consumer.getTokenSecret(), PREF_FILE_NAME ,this); } catch (Exception e) { Log.e(APP, e.getMessage()); } } } -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] onSaveInstanceState problem while making oAuth request
In my app at some point I am making oAuth request to authorize user with Twitter. App opens WebView in which user enter his credentials. Upon user pressing Allow button, twitter sends Intent (which contains token and secret) back to my app so user can start when he/ she left of. The problem is my Activity has RowID (very important to know which record is currently active) that get lost RowID is parameter that my activity receives through Intent in onCreate event. I've checked, onSaveIstanceState is not executed, so when my Activity gets control back, my RowID doesn't exist. When my Activity receives Intent from Twitter, it is handled in onResme event. I assume, here I should somehow obtain my RowID What would be good way to remember my RowID and to be able to pull it back? In my manifest I had to enter following for my Activity in order to be able to get control back: intent-filter action android:name=android.intent.action.VIEW / category android:name=android.intent.category.DEFAULT / category android:name=android.intent.category.BROWSABLE / data android:scheme=myapp android:host=oauth / /intent-filter Any Suggestions. Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] HeaderView in ListView causing ClassCastException
I have added a view to the header of my ListView by following way: ListView lv = (ListView)getListView(); View TopSearch = (View) View.inflate(this, R.layout.search, null); lv.addHeaderView(TopSearch, null, false); And everything is fine until I make changes to data adapter and then try to execute: adapter.notifyDataSetChanged(); This always crashes my application giving me following error: java.lang.ClassCastException: android.widget.HeaderViewListAdapter If I don't add header view to my list view, then everything works fine with no errors Any suggestions? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: HeaderView in ListView causing ClassCastException
Here it is: 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): FATAL EXCEPTION: main 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): java.lang.ClassCastException: android.widget.HeaderViewListAdapter 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at com.sanantonio.cvb.PropertyList$1.onTextChanged(PropertyList.java:130) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.widget.TextView.sendOnTextChanged(TextView.java:6131) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.widget.TextView.handleTextChanged(TextView.java:6172) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java: 6316) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.text.SpannableStringBuilder.sendTextChange(SpannableStringBuilder.java: 889) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java: 502) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java: 409) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java: 28) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java: 583) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java: 384) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java: 292) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at com.android.internal.view.IInputConnectionWrapper $MyHandler.handleMessage(IInputConnectionWrapper.java:73) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.os.Handler.dispatchMessage(Handler.java:99) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.os.Looper.loop(Looper.java:123) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at android.app.ActivityThread.main(ActivityThread.java:4627) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at java.lang.reflect.Method.invokeNative(Native Method) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at java.lang.reflect.Method.invoke(Method.java:521) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:858) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 12-10 11:35:28.111: ERROR/AndroidRuntime(25364): at dalvik.system.NativeStart.main(Native Method) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: HeaderView in ListView causing ClassCastException
I set it in activity's OnCreate method with myAdapter = new myBaseAdapter(this); lv.setAdapter(myAdapter); and myAdapter is declared as private myBaseAdapter myAdapter; and visible in all activity methods. Then (maybe important) I have text watcher, which onTextChanged execute: final BaseAdapter adapter = (BaseAdapter) lv.getAdapter(); ((Filterable) adapter).getFilter().filter(s); // s is a search string myBaseAdapter implements Filterable which execute notifyDataSetChanged() when new filter is applied. As I said before, the code doesn't produce any error if I comment 2 lines where I add header view. Thanks, On Dec 10, 11:42 am, TreKing treking...@gmail.com wrote: On Fri, Dec 10, 2010 at 10:37 AM, bobetko bobe...@gmail.com wrote: Any suggestions? When do you set your adapter? --- -- 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: HeaderView in ListView causing ClassCastException
line 130 is this: ((Filterable) adapter).getFilter().filter(s); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: HeaderView in ListView causing ClassCastException
I call setHeaderView in onCreate, before I set myAdapter. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: HeaderView in ListView causing ClassCastException
Yes. myAdapter implements Fliterable -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: HeaderView in ListView causing ClassCastException
Thank you very much Kostya. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] OnKeyListener not working on virtual keyboard
I don't understand why this peace of code is not working. OnlyDelete and Return keys are detected. Listener doesn't fire for any other key. My device is Nexus One. I tried to override activity's OnKeyDown method and that's even worse. The only detected button was hardware back button. I am seeing around a suggestion to use TextWatcher and onTextChanged, while that might work in some cases, it's not a real work around. For example, if textbox is empty, you won't detect if user press Delete key. So any ideas? Here is my code: TextView txtInput = (TextView)findViewById(R.id.txtInput); txtInput.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { makeToast(keyCode + key pressed); return true; } }); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: TCP problem - hangs when reading server's response
The server app was written for iPhone witch maybe handle some things differently. As a message terminator server app author used OK sequence (I will ask him why), so I definitely couldn't use readLine(). It turned out there was more then one problem. In line 4, I had to replace all characters with amp; but that alone was not the solution. It seems that PrintWriter adds something to OutputStream, probably \n character or something similar. Server didn't like that and my actions were ignored. I tried PrintStream instead of PrintWriter and that worked perfectly. So, now I am good. Thanks all. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Expandable ListView (how to collapse, expand groups and remove groups)
Yes, my ELV is backed by BaseExpandableListAdapter. I had this code in my app: ListView lv; lv = getExpandableListView(); This worked, but I was not able to see all available methods for myExpandableListView. 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] TCP problem - hangs when reading server's response
I am trying to write client for Android which is supposed to communicate with PC server application on local network. Server app is written by my friend in C#. Currently there is an iPhone app that is using this server application with no problems. I have very simple code for TCP client: 1. Socket s = new Socket(server, port); 2. OutputStream out = s.getOutputStream(); 3. PrintWriter output = new PrintWriter(out); 4. output.println(ACTION=NextVALUE=0); 5. BufferedReader input = new BufferedReader(new InputStreamReader(s.getInputStream())); 6. String st = input.readLine(); I went through many TCP implementation examples, and they are all similar. Pretty much like my code above. My app freezes on line 6 when I try to read response from the server. It doesn't cause any errors (no exceptions), nothing shows in debugger, just timeout error after awhile. Server is supposed to return string OK after executing my action in line 4. I don't understand why this code hangs. Input is not NULL (I've checked it). I would expect some exception to be thrown or simply empty string to be returned. So? What am I missing? Could it be problem with some special characters that server app is sending and android can't handle that? Do I need any special permission in my manifest? I am positive that I have correct IP address and correct port number. I can see that on server application running on my PC. Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: TCP problem - hangs when reading server's response
And one more thing, Encoding.UTF8 is used. Not sure if that might be important. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: TCP problem - hangs when reading server's response
I tried: input.read(); I also tried to read Reader the same way: Reader in = new InputStreamReader(s.getInputStream()); in.read(); Out of desperation I tried to recompile to 2.2 (now is 2.1). -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Expandable ListView (how to collapse, expand groups and remove groups)
In my app I have nice ExpandableListView. I would like sometime, depending of situation, to expand some or all groups. I would also like to be able to remove/hide groups, expand all and basically have (visually) ExpandableListView without groups. I looked at all available methods for ExpandableListView and couldn't find any that would do what I want to do. Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to set layout_gravity of RelativeLayout programmatically?
I have ScrollView with RelativeLayout as a child of ScrollView. I am trying through JAVA code to set Layout_Gravity to CENTER so my RelativeLayout is centered (horizontally and vertically) in the middle of ScrollView (that covers whole screen). This works fine in XML and produces desired result, but when I try to do this programmatically, it seems there is no way to set Layout_Gravity of RelativeLayout. I tried using LayoutParams, but couldn't find anything there that would help me to center RelativeLayout in the middle. So, am I missing something or this simply can't be done? RelativeLayout.setGravity() is setting positioning for children, in case that somebody wants to mention this one. AddRule is dealing with children, so this doesn't work as well. 2nd part of the question... The reason I am using ScrollView is because on my XML layout, I use ViewFlipper. ScrollViews are children of ViewFlipper, actually pages that will be flipped. Using ScrollView seems little bit weird, but I couldn't find any other alternative. The ScrollView is the only control on which I could attach onFling event. I tried attaching onFling directly to Layout, but that didn't produce anything, onFling didn't fire. Any suggestions? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Multiple calls to SimpleCursorAdapater#bindView
I will reply to myself on this one... I learned that if I set my list's layout_height to WRAP_CONTENT, the problem is no more. Wonder why? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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 set layout_gravity of RelativeLayout programmatically?
I tried another approach. I defined my RelativeLayout in XML exactly the way I liked it. Then I used inflater and dynamically added my RelativeLayout to ScrollView It didn't work. It simply ignored all my XML settings. For example, it fully filled the parent (ScrollView) even though I explicitly specified to WRAP_CONTENT in my XML file. All this seems to me very very 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: Introducing Aproov - A new and better app store for Android and mobile app developers
I wouldn't bet my life on this, but I think in Android case, carriers are those who take 30%, not Google. So, that's why I think Google doesn't care about all these new Android Markets. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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 set layout_gravity of RelativeLayout programmatically?
Not sure I understand. My RelativeLayout is enclosed in ScrollView and ScrollView doesn't have gravity property. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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 set layout_gravity of RelativeLayout programmatically?
Thank You Kostya, I did as you said and it works. Here is what I have done: RelativeLayout myRelativeLayout = new RelativeLayout(this); myRelativeLayout.setGravity(Gravity.CENTER_HORIZONTAL); ScrollView.LayoutParams myRelativeLayoutParams = new ScrollView.LayoutParams( ScrollView.LayoutParams.FILL_PARENT, ScrollView.LayoutParams.FILL_PARENT); myRelativeLayoutParams.gravity = Gravity.CENTER; myRelativeLayout.setLayoutParams(myRelativeLayoutParams); ScrollView sv = new ScrollView(this); sv.addView(myRelativeLayout); So, this way I managed to do what I wanted. I just don't understand why I had to reference LayoutParams of ScrollView instead of RelativeView. Can somebody please explain. Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Multiple calls to SimpleCursorAdapater#bindView
I am using setViewValue method of ShowViewBinder to access image inside row of listView. The idea is to load image from internet and display it inside row of listView. To load image, I am starting new image loader thread, but what I discovered when debugging this code, for each row I am actually starting 3 or 4 threads. I don't understand why. The code in if (columnIndex == ...) is executing more than once. What I am doing wrong. Should I take another approach? Thanks. My code goes something like this: class ShowViewBinder implements SimpleCursorAdapter.ViewBinder { //@Override public boolean setViewValue(View view, Cursor cursor, int columnIndex) { Thread t; if (columnIndex == cursor.getColumnIndex(DbAdapter.KEY_SPEAKER_IMAGE)) { final ImageView iv = (ImageView) view; final String filePath = cursor.getString(cursor.getColumnIndexOrThrow(DbAdapter.KEY_SPEAKER_IMAGE)); //makeToast(filePath); t = new Thread() { public void run() { //viewImage(); common.getRemoteImage(filePath, handler, iv); Log.d(Speaker List - Loading Image, filePath); } }; t.start(); return true; } . etc -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] How to attach custom map on MapView? Can MapView be used when phone is offline?
I am trying to place my custom map (overlay) over Google map. For example, my MapView will be positioned to look at some building. I want to load custom image(s) that will show building's floor plan. Want to be able to pan and zoom, and place markers (for example, Room 1, Room 2, etc...), in other words, I would like to be able to use Google Map API methods. The best would be if Google map images are not loaded at all, since that will (I believe) slow down user's experience. Also, the user may be inside the building, and connection may be slow or non-existing. Is this possible? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to attach custom map on MapView? Can MapView be used when phone is offline?
I was hoping to use MapView in my application. It seems I will have to come up with something else. Thanks for quick reply. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] problem creating custom dialog...
I am using example for creating custom dialogs on dev.android.com. See code below. The problem is that second line is crashing application (fore close) ## Context mContext = getApplicationContext(); I can make dialog to work if I replace line with ## Context mContext = this; My questions: 1) I have read somewhere that I shouldn't be using this, that I should be using getApplicationContext because context can be lost when changing orientation or so... Should I? Not really even sure if I understand what the context is... 2) in another example there is line MyActivity.this.finish(); (it is located in onclick listener for YES button in AlertDialog) Android doesn't know what is MyActivity. What am I doing wrong? Thanks, Sorry, absolute beginner. protected Dialog onCreateDialog(int id) { Context mContext = getApplicationContext(); Dialog dialog = new Dialog(mContext); dialog.setContentView(R.layout.custom_dialog); dialog.setTitle(Custom Dialog); TextView text = (TextView) dialog.findViewById(R.id.text); text.setText(Hello, this is a custom dialog!); ImageView image = (ImageView) dialog.findViewById(R.id.image); image.setImageResource(R.drawable.android); } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---