[android-developers] Re: Edittext Cursor and Highlight Problem
Ahh I see what you meant, but no I am trying to do something different. I want the cursor to be none existent. I'm trying to display (read-only) a page of text in which they are free to select and copy text from thus that is why I don't want the cursor to be visible at all. On Sep 14, 10:51 pm, TreKing treking...@gmail.com wrote: On Mon, Sep 13, 2010 at 9:44 PM, SurtaX garylo@gmail.com wrote: Could you tell me what modifications have you made to it? None. I see the same behavior when using the built-in messaging app. Because by default the cursor is definitely there to allow people to know where they are editing. By cursor I am referring to the | which blinks/ flashes. Yes, it's there when you first opt to select text and have not highlighted anything. Once you start selecting text, it goes away. Is this the problem? --- -- 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: Edittext Cursor and Highlight Problem
Does anyone have any solutions to this at all? On Sep 2, 12:56 am, SurtaX garylo@gmail.com wrote: I am trying to implement a textview which has select text/copy and paste functionality. I tried to do this by making an Edittext with the following properties. I currently have the following Edittext: EditText style=?android:attr/textViewStyle android:editable=false android:background=@null android:textColor=@null android:id=@+id/textbox/ I want users to be able to highlight the text with long click -- select text. This works fine with the above code and the highlights of selected text come out fine. However I do not want the cursor to always be flashing. I successfully get rid of the cursor by using: textBox.setCursorVisible(false); However with this change whenever a user long clicks and hits select text, the highlighted text no longer has any color over it. I have tried to change the color of the highligthed text to textBox.setHighlightColor(android.graphics.Color.RED); But this does not seem to have any effect. Any suggestions will be greatly appreciated! -- 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: Edittext Cursor and Highlight Problem
Thanks for responding. Could you tell me what modifications have you made to it? Because by default the cursor is definitely there to allow people to know where they are editing. By cursor I am referring to the | which blinks/ flashes. I am also on Nexus 2.2 so I dont think that will be the difference. On Sep 13, 11:42 pm, TreKing treking...@gmail.com wrote: On Wed, Sep 1, 2010 at 9:56 AM, SurtaX garylo@gmail.com wrote: I am trying to implement a textview which has select text/copy and paste functionality. Why? I just tried playing an EditText I use in my app that's basically as default as can get and I can select text, copy, and paste without any blinking cursor during the process. So as far as I can tell, this default behavior and I'm not sure what you're trying to accomplish. This on Nexus One with 2.2, don't know if it's changed. - 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] Edittext Cursor and Highlight Problem
I am trying to implement a textview which has select text/copy and paste functionality. I tried to do this by making an Edittext with the following properties. I currently have the following Edittext: EditText style=?android:attr/textViewStyle android:editable=false android:background=@null android:textColor=@null android:id=@+id/textbox/ I want users to be able to highlight the text with long click -- select text. This works fine with the above code and the highlights of selected text come out fine. However I do not want the cursor to always be flashing. I successfully get rid of the cursor by using: textBox.setCursorVisible(false); However with this change whenever a user long clicks and hits select text, the highlighted text no longer has any color over it. I have tried to change the color of the highligthed text to textBox.setHighlightColor(android.graphics.Color.RED); But this does not seem to have any effect. Any suggestions will be greatly appreciated! -- 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] Search Suggestions/Autocomplete OnClick Behavior
I've implemented a search suggestion which works fine. I've used the onSearchRequested() method to make it work as well as the following XML: searchable xmlns:android=http://schemas.android.com/apk/res/ android android:label=@string/search_label android:hint=@string/search_hint android:includeInGlobalSearch=true android:searchSuggestAuthority=authority android:searchMode=queryRewriteFromData android:searchSuggestIntentAction=android.intent.action.SEARCH /searchable However I cannot seem to dictate the behavior of the onClick function. When a suggestion is clicked, it fires off the intent immediately. Is there a way for it to instead of firing off the intent immediately, simply copy and paste the suggestion as part of the search string? Eg. when typing in J,o,h the suggestion John comes up. When I click John can it copy that text into the search bar instead of immediately processing the search with John? I'm assuming theres a simple configuration which I cant seem to find. I dont want to go extensively into catching the fired of intent and re- processing 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] Simple Audio MediaController for Audio
Hi guys, I've been unable to successfully hookup a MediaController to an audio MediaPlayer. I've successfully created a MediaPlayer to play audio. And i've also programatically instantiated a MediaController. MediaPlayer mp = myclass.getMediaPlayer(); //My custom class that returns the current media player MediaController mc = new MediaController(this); mc.setAnchorView(button); mc.setEnabled(true); mc.show(2000); //does not crash if i comment this out I have 2 big problems: 1. The above code crashes unless I comment out the show. In which case the controller does not appear. I have debugged mp and mc and the button are all not null values, but I still get the following in logcat: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.android.test.activity.testActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2496) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2512) at android.app.ActivityThread.access$2200(ActivityThread.java:119) at android.app.ActivityThread$H.handleMessage(ActivityThread.java: 1863) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4363) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:860) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at android.widget.MediaController.disableUnsupportedButtons(MediaController.java: 258) at android.widget.MediaController.show(MediaController.java:288) at com.test.android.test.activity.testActivity.onCreate(testActivity.java: 105) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2459) ... 11 more 2. The other problem is that I cannot see a way to hookup the MediaController to Mediaplayer as setMediaPlayer does not take MediaPlayer as the paramater. A simple example of a MediaController working with mp3's would be all that I need! Thanks alot for your time. -- 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] Gallery View with Text: Styling
I currently have a Gallery Widget very similar to Gallery2.java in the API examples. It is a gallery widget populated by a simple adaptor of text. What I am trying to do is make the selected (the item at the center of the gallery widget) text and background a certain color and the other visible items a different color. It should be a simple task, but I am unable to find a tutorial or the place in which to insert these options. Code which will modify the existing Gallery2.java to display the center item as Red for example whereas the other items remain the gray color would be very helpful. Many 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] Searchable Dictionary Example - Update Search Bar
Hi for those who are familiar with the search bar this would be a quick answer (hopefully). If you look @ the searchable dictionary example (http://developer.android.com/guide/samples/ SearchableDictionary/index.html) it uses a content provider to populate suggestions. That works great however when I use the navigation keys to focus on certain suggestions this does not update my current search string. And also how is it possible that instead of launching the search straight away, when a person clicks on a suggestion it only replaces the current search query. An example may help better understand the question. Press Search Use keyboard to enter the letter 'a' in the search box The suggestions apple altogether apricot are shown I use the down navigation key to get to apricot, however the text in the search box is still just a, I want it to become apricot And also when I press apricot on the suggestion I dont want it to launch the intent but rather just replace the text in search box to the text selected, and only actually launch the intent when the user clicks the search button/enter key. I'm sure its just a value I need to set somewhere but I cant seem to find it in the documentation. Thanks, Gary --~--~-~--~~~---~--~~ 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] MediaScannerConnection cant connect!
I am trying to use MediaScannerConnection to update content provider of a newly downloaded MP3. However no matter what I do it does not seem to be able to connect. I have even put this chunk of code into onCreate and hardcoded to path of an existing file but still no dice. MediaScannerConnection scanner = new MediaScannerConnection(this, null); scanner.connect(); while(!scanner.isConnected()){ try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } scanner.scanFile(/sdcard/path/file.mp3, audio/*); scanner.disconnect(); It never exits the loop. If i do not put the loop in, it just force closes and complains that it is not yet connected. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Textview - Select All/Select Text/Copy/Paste
Hi could someone post a small code snippet on how to have a read only text view (ie. editable = false), which has the context menu of the standard Select All/Select Text/Copy/Cut/Paste. I have tried using the EditText and setting editable = false. However I do not want to see the blinking cursor. I then set cursor visible to false but then it does not show which areas are currently be highlighted when using Select Text. I do not mind using editText. I just need something like how the browser works, the text display is read-only. And supports copy and paste with visible which text is highlighted. Cheers --~--~-~--~~~---~--~~ 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: Scrollview and GestureDetector
I figured out how to do it for any1 interested @Override public boolean dispatchTouchEvent(MotionEvent ev){ super.dispatchTouchEvent(ev); return gestureScanner.onTouchEvent(ev); } On Jun 14, 2:43 pm, SurtaX garylo@gmail.com wrote: bump On Jun 13, 8:18 pm, SurtaX garylo@gmail.com wrote: I'm making sort of a book app. I have the text displayed as a textview in a scrollview: XML: ScrollView android:id=@+id/chatview android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent TextView android:id=@+id/webview android:layout_width=wrap_content android:layout_height=fill_parent android:layout_weight=1 android:textSize = 16sp / /ScrollView I then have Java: private GestureDetector gestureScanner; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); gestureScanner = new GestureDetector(this); } And implemented the required following to catch a left fling or right fling. And Java: �...@override public boolean onTouchEvent(MotionEvent me) { return gestureScanner.onTouchEvent(me); } public boolean onDown(MotionEvent e) { return true; } public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if(velocityX = 1500){ nextChapter(); } if(velocityX = -1500){ previousChapter(); } return true; } public void onLongPress(MotionEvent e) { } public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return true; } public void onShowPress(MotionEvent e) { } public boolean onSingleTapUp(MotionEvent e) { return true; } This works fine if the text inside the textview is small (ie. there is no scroll bar as it all fits within the view). But as soon as the text requires scrolling, the gesture is no longer picked up by the detector. onFling is never called. I have read that it is because scrollview handles its own gestueres? If so what is the easiest way to maintain the ability to scroll up and down the text, and also be able to detect flinging left or right and invoking nextChapter() and previousChapter() respectively? THanks alot for your time. Cheers, SurtaX --~--~-~--~~~---~--~~ 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] Scrollview and GestureDetector
I'm making sort of a book app. I have the text displayed as a textview in a scrollview: XML: ScrollView android:id=@+id/chatview android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent TextView android:id=@+id/webview android:layout_width=wrap_content android:layout_height=fill_parent android:layout_weight=1 android:textSize = 16sp / /ScrollView I then have Java: private GestureDetector gestureScanner; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); gestureScanner = new GestureDetector(this); } And implemented the required following to catch a left fling or right fling. And Java: @Override public boolean onTouchEvent(MotionEvent me) { return gestureScanner.onTouchEvent(me); } public boolean onDown(MotionEvent e) { return true; } public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if(velocityX = 1500){ nextChapter(); } if(velocityX = -1500){ previousChapter(); } return true; } public void onLongPress(MotionEvent e) { } public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return true; } public void onShowPress(MotionEvent e) { } public boolean onSingleTapUp(MotionEvent e) { return true; } This works fine if the text inside the textview is small (ie. there is no scroll bar as it all fits within the view). But as soon as the text requires scrolling, the gesture is no longer picked up by the detector. onFling is never called. I have read that it is because scrollview handles its own gestueres? If so what is the easiest way to maintain the ability to scroll up and down the text, and also be able to detect flinging left or right and invoking nextChapter() and previousChapter() respectively? THanks alot for your time. Cheers, SurtaX --~--~-~--~~~---~--~~ 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: Scrollview and GestureDetector
bump On Jun 13, 8:18 pm, SurtaX garylo@gmail.com wrote: I'm making sort of a book app. I have the text displayed as a textview in a scrollview: XML: ScrollView android:id=@+id/chatview android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent TextView android:id=@+id/webview android:layout_width=wrap_content android:layout_height=fill_parent android:layout_weight=1 android:textSize = 16sp / /ScrollView I then have Java: private GestureDetector gestureScanner; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); gestureScanner = new GestureDetector(this); } And implemented the required following to catch a left fling or right fling. And Java: �...@override public boolean onTouchEvent(MotionEvent me) { return gestureScanner.onTouchEvent(me); } public boolean onDown(MotionEvent e) { return true; } public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if(velocityX = 1500){ nextChapter(); } if(velocityX = -1500){ previousChapter(); } return true; } public void onLongPress(MotionEvent e) { } public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return true; } public void onShowPress(MotionEvent e) { } public boolean onSingleTapUp(MotionEvent e) { return true; } This works fine if the text inside the textview is small (ie. there is no scroll bar as it all fits within the view). But as soon as the text requires scrolling, the gesture is no longer picked up by the detector. onFling is never called. I have read that it is because scrollview handles its own gestueres? If so what is the easiest way to maintain the ability to scroll up and down the text, and also be able to detect flinging left or right and invoking nextChapter() and previousChapter() respectively? THanks alot for your time. Cheers, SurtaX --~--~-~--~~~---~--~~ 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: Strange MP3 Problem - Streaming MediaPlayer
bump On Jun 3, 10:10 pm, SurtaX garylo@gmail.com wrote: Hi I've had no trouble with playing other pieces of mp3 from a url. But for some reason when clicking this from a webview (browser) or connecting with MediaPlayer does not work. It is just a mp3 file -http://stream.esvmedia.org/mp3-play/hw/46003016.mp3 Try going to that file from your phone it be stuck at a infite Connecting to stremam.esvmedia.org loading screen. And if you try to do it through a MediaPlayer it will die on .prepare(). However if you go to that link in any desktop browser it will work fine. It does not appear to be java/flash related. --~--~-~--~~~---~--~~ 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: Strange MP3 Problem - Streaming MediaPlayer
I wonder if that may be related, perhaps thats not a direct link to the file and is somewhat redirected to a file which contains special characters? On Jun 4, 7:23 pm, iDeveloper ideveloper...@gmail.com wrote: I am also facing this problem, but the mp3 I reference has a special character in the name. I am reading the URL from an XML and I don;t have any idea how to stop the special character from being converted to garbage when reading from it. On 04-Jun-09, at 2:05 PM, SurtaX wrote: bump On Jun 3, 10:10 pm, SurtaX garylo@gmail.com wrote: Hi I've had no trouble with playing other pieces of mp3 from a url. But for some reason when clicking this from a webview (browser) or connecting with MediaPlayer does not work. It is just a mp3 file -http://stream.esvmedia.org/mp3-play/hw/46003016.mp3 Try going to that file from your phone it be stuck at a infite Connecting to stremam.esvmedia.org loading screen. And if you try to do it through a MediaPlayer it will die on .prepare(). However if you go to that link in any desktop browser it will work fine. It does not appear to be java/flash related. --~--~-~--~~~---~--~~ 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: Input for App Widgets? Search Widget?
So from your reply i gather you're implying theres no way to do it underthe current appwidget apis available to us? On May 27, 2:21 pm, Jean-Baptiste Queru j...@android.com wrote: If I remember correctly, the search widget is part of the home app, it's not implemented with the app widget APIs. JBQ On Tue, May 26, 2009 at 9:18 PM, SurtaX garylo@gmail.com wrote: Hi I have noticed that alot of the basic input controls are not implemented for app widgets (Ie. EditText). I'm wondering how then does the search widget have the text input bar? Could someone please give me a snippet of the layout to achieve the same effect? text input and autocomplete? -- Jean-Baptiste M. JBQ Queru Android Engineer, Google. Questions sent directly to me that have no reason for being private will likely get ignored or forwarded to a public forum with no further warning. --~--~-~--~~~---~--~~ 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] Input for App Widgets? Search Widget?
Hi I have noticed that alot of the basic input controls are not implemented for app widgets (Ie. EditText). I'm wondering how then does the search widget have the text input bar? Could someone please give me a snippet of the layout to achieve the same effect? text input and autocomplete? --~--~-~--~~~---~--~~ 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] Sample Notepadv3 Orientation Bug
Looking at the sample Notepadv3 Solution project. (In Portrait Mode) When you press menu -- Add Note -- Change orientation to landscape, will produce Sorry! The application com.android.demo.notepad3(process com.android.demo.notepad3) has stopped unexpectedly. Please try again. Any ideas why it is doing this? And propose a 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 -~--~~~~--~~--~--~---