[android-developers] Re: Move the cursor to the end of EditText
Hi glassfool, insted of using set text, try append(text) - this will also move the cursor position. On 22 Feb., 14:48, glassfool maliangp...@gmail.com wrote: After the following two lines are executed, the text is shown on the left side of theEditText, and thecursoris also on the left edge. While I wanna show the text on the right side of theEditText, and move thecursorto the end of the text. Anyone can help out? EditTextmInputArea = (EditText)findViewById(R.id.InputArea); mInputArea.setText(mStringBuilder.toString()); Thank you. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Positioning/Layout of the Input Method / Soft Keyboard
Hi everyone, For an Android 1.5 device I need to implement a new Soft Input (Soft Keyboard) that is not located at either side of the Screen but rather at a corner. I have the layout ready but I can’t get the InputMethodManager to locate my input Method View to be displayed before the Activity without resizing it and positioning it at the corner. What I have done: - I implemented my own Soft Keyboard using the Soft Keyboard Sample from the Android 1.5 SDK. The View used to display the keyboard now holds my own layout. - My SoftKeyboard class (derived from InputMethod) sets the layout to WRAP_CONTENT for width and height. onEvaluateFullscreenMode() always returns false since I don’t want / need id. The problem is, that my Soft Keyboard is now located within the center of the Screen rather than at one corner and the Actvity scrolls down when I reach the height of my Soft Keyboard although it would be displayed correctly besides it. I hope I made myself clear because, unfortunately, I can’t post any codes or screenshots here for confidentiality reasons. Thank you all for your help, it is greatly appreciated. Kai aka Aracos -- 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 draw a particular part of a view
Hi, Another approach would be to cache the visible area and only update/ replace the area you want to change from within a different method. Some example code stubs. Call the drawMe method whenever you want to replace the Image at the given location. You can also provide a Rect to position the Bitmap within the buffer and call incalidte(dirtyRect) to improve performance. Please let me know how it worked out for you. Bitmap mBuffer; Canvas mCanvas; public TestView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); mBuffer = Bitmap.createBitmap(w,h,Config.ARGB_); mCanvas = new Canvas(mBuffer); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (mBuffer!=null) canvas.drawBitmap(mBuffer, 0,0,null); } public void drawMe(int dx, int dy, Bitmap bm) { if (mCanvas!=null) mCanvas.drawBitmap(bm,dx,dy,null); invalidate(); } On 4 Mrz., 10:16, jamesc jame...@gmail.com wrote: Looking at your code, you're drawing the bitmap at the top-left of the canvas (i.e. canvas.drawBitmap(bitmap, 0, 0 ...). Presumably, you're precalculating where the bitmap needs to be drawn (it's top-left coordinate) and using those values in the drawBitmap() call? The onDraw method will only draw what you tell it to. So, what I presume is happening is that you're asking it to first render this: 1 0 0 0 0 0 0 0 0 which it does, then you ask it to render the bitmap at (I'm assuming that each '1' is a single bitmap): 0 0 0 0 1 0 0 0 0 The problem is, is that you've not told it about the first bitmap (at the top-left corner), so it doesn't bother drawing that and just renders the bitmap in the middle. Thus, to fix this, you need to be able to keep a track of all the bitmaps that you want to draw, and where they're to be drawn. On Mar 4, 8:09 am, CMF manf...@gmail.com wrote: Let consider this is my tile view (which is a bitmap): 0 0 0 0 0 0 0 0 0 First, I have change the view to 1 0 0 0 0 0 0 0 0 Second, I would like to change the middle one, and I expect the result is 1 0 0 0 1 0 0 0 0 However, the view give the result: 0 0 0 0 1 0 0 0 0 Is there any method that I can draw the particular part but now the whole view? Here is my onDraw() @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Bitmap bitmap = getImage(R.drawable.tileboard); bitmap.setDensity(canvas.getDensity()); canvas.drawBitmap(bitmap, 0, 0, new Paint());//drawtilebackground } -- 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] WebView remove entry from History
Hi all, I would like to know if there is a way to remove a specific entry – currently the url displayed – from the WebView history. I need this to do the following – maybe you know a workaround. I have a content provider that shows some HTML text within a webview. The Text can contain some links that may or may not lead to another entry provided by my provider. If the load of a link fails codeWebViewClient.onReceivedError/code I would like to load a different URL and remove the failed url from the history stack. This is nesseccary for the back navigation, I would not want the failing URL to show up again. Any Ideas? Best Regards Aracos -- 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: littele sqlite help
Hi Jags, I am not sure if this is quite what you need but you could try this. 1.Do not use the DateTime Data Type within SQLite, since in my experience this tends to be very slow. Store the System Time codeSystem.currentTimeMillis()/code instead. 2.Use the Calendar to define the Date you want and the date after that 3.as the selection (WHERE statement) within your query, try something like date = day.getTimeInMillis AND date tomorrow.getTimeInMillis This will only work if you need the specific date of a month and not for every 14th . Hope this helps Regards Aracos On Dec 14, 2:28 pm, Jags jag...@gmail.com wrote: Apologies, if it is not the right forum. But I think as I came across this query problem while working on android, I thought I would gt some help on this I have a field datetime data type. i need something like select * from mytable where strftime('%d', mydate) = 14; i need all the records whose day of the date in mydate is 14 this should work according to sqlite3 docs, but it is not working. Any help is appreciated http://www.sqlite.org/lang_datefunc.html regards -- 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: Back Navigation to defined Activity
Hi Marco Nelissen, thanks for the quick response. The code I posted before is implemented within a base Activity within my test project. The other Activities are derived from this one. The only difference is, they set a different title. The problem was, that the other activities remain on the stack and when I use the back navigation, they are displayed instead of closing the application. The strangest thing happened this morning – as I tested it again to confirm this post, it worked. :-) Don't ask me why but it did. So, thanks again but the problem solved itself. Best regards, Aracos --~--~-~--~~~---~--~~ 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] Back Navigation to defined Activity
HI @all, I would like to have a Menu – Button, called Home, that goes back to my root activity and removes all activities from the stack. Therefore, if I press the back button afterwords, the application would close. I tried calling the Activity with the intent flag 'FLAG_ACTIVITY_CLEAR_TOP' but it does not seem to work. // --- // Options Menu /** * * The method codeonCreateOptionsMenu/code * * @param menu * @return * @overrides @see android.app.Activity#onCreateOptionsMenu (android.view.Menu) */ @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(0,1,1,A); menu.add(0,2,2,B); menu.add(0,3,3,C); menu.add(0,4,4,HOME); return super.onCreateOptionsMenu(menu); } /** * * The method codeonOptionsItemSelected/code * * @param item * @return * @overrides @see *android.app.Activity#onOptionsItemSelected (android.view.MenuItem *) */ @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case 1: startActivity(new Intent(this, TestActivityA.class)); break; case 2: startActivity(new Intent(this, TestActivityB.class)); break; case 3: startActivity(new Intent(this, TestActivityC.class)); break; case 4: Intent i = new Intent(this, TestActivityA.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); break; } return super.onOptionsItemSelected(item); } // Options Menu // --- --~--~-~--~~~---~--~~ 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] Back navigation for database stored web pages
Greetings all, I have a problem with the Back navigation within my web-view. Here is what I would like to have: On the device there is a database containing some web-pages. The User is able to search the content of the database and view the stored pages. Those pages contain some links. If the user clicks on one of those links the click is intercepted. If the reference set within this link is also part of the database, the stored content is displayed, otherwise a remote URL is loaded. This works great so far, but the problem I have is, that when I want to do a back navigation, always the address for my remote location is displayed and the method for searching the local database is not shown. The data from my content provider is displayed with the method: code public void showContent(ByteArrayOutputStream content, String title) { if (activity!=null) activity.setTitle(URLDecoder.decode(title)); // loadData(content.toString(), MIME_TYPE, DEFAULT_ENCODING); loadDataWithBaseURL(BASE_URL + title, content.toString(), MIME_TYPE, DEFAULT_ENCODING, REMOTE_URL + title); } /code I implemented my own WebViewClient and overloaded the method ' shouldOverrideUrlLoading' to intercepted the loading of the requested URL. There I parse the URL and – call 'showContent' of my WebView to displayByteArrayOutputStream stored within my database, otherwise I load the the URL directly by calling 'loadUrl' of the WebView. On back navigation, the method shouldOverrideUrlLoading is not called or the URL is formated differently so I could not read the correct data from the database. If needed, I can provide a test-application that shows what I mean, but I hope this will suffice. Thanks for your help beforehand, Aracos --~--~-~--~~~---~--~~ 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: TabActivity - OnClickListener not working
Thanks for your Response. am I reading this right, I have to rewrite the complete TabWidget just to get the event when clicking on the currently active element or is there a way to get the adapter responsible for the tabs and add the code you posted? Or am I getting it all wrong and should use a different approch for my purposes? So, here is what I need. I have a List view containing different elements. I want to display that list within different Tabs display the same list sorted by defined Values. This works so far. The user can switch between the different views by selecting the Tab. If the current displayed tab is clicked, the sort order (ascending/ descending) of the current view is changed. --~--~-~--~~~---~--~~ 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: TextView Highlight/Select Issue
Try disabling the clickable and longClickable properties of your textView - this should disable the dimming effect you described. android:clickable=false android:longClickable=false if you still want your links clickable, enable this by adding the property android:linksClickable=true On 29 Mai, 14:37, mscwd01 mscw...@gmail.com wrote: Please, this is getting so frustrating now. I have tried setting theTextViewhighlight colour to transparent but that doesn't work. If I set the ListView selector to draw on top, it covers the ImageView I have on the row but thetextViewremains on top. If I apply a normal style to theTextViewit doesn't highlight when tapped but as soon as I apply a selector drawable to it, it causes thos highlight on tap issue. This is my last plea for help ;) On May 29, 1:14 am, mscwd01 mscw...@gmail.com wrote: It seems the problem only occurs when the selector drawable is applied to theTextView. Can anyone explain why this would allow theTextView to be selected/highlighted when tapped? On May 28, 11:00 am,mscwd01mscw...@gmail.com wrote: Hey, I have a ListView where each row is a layout inflated from an xml file. Within each layout I have aTextViewwhich is defined by the following: TextView style=@style/MenuItem android:paddingLeft=10sp android:textColor=@drawable/menu_item / The style attribute sets the font size and style, the textColor attribute is a selector drawable which changes theTextViewfont colour depending on whether it is currently selected or not. This is defined by the following: selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_selected=true android:color=#FF / item android:state_pressed=true android:color=#FF / item android:color=#00 / /selector However, when I use this selector drawable to set the font colour it results in a weird issue where theTextViewgets highlighted when the row is tapped, or tapped and dragged. See this screenshot for a better idea: http://i39.tinypic.com/v4q90n.jpg Is there anyway I can disable theTextViewso it cannot be highlighted when tapped? 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] TabActivity - OnClickListener not working
Greetings all, I have a Tabbed View that displays a list in different tabs. When I click on the currently active tab (not the displayed view) I want to do something. Currently - the OnClickListener is NOT called. the OnTabChanged Listener however seems is working fine. Am I registering on the wrong View? // Example Code - public class TestDroidViewTab extends TabActivity implements TabContentFactory , OnTabChangeListener, OnClickListener { private static final String LOG_KEY = TEST; ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final TabHost tabHost = getTabHost(); TabHost.TabSpec ts = tabHost.newTabSpec(ID_1); ts.setIndicator(1); ts.setContent(this); tabHost.addTab(ts); ts = tabHost.newTabSpec(ID_2); ts.setIndicator(2); ts.setContent(this); tabHost.addTab(ts); ts = tabHost.newTabSpec(ID_3); ts.setIndicator(3); ts.setContent(this); tabHost.addTab(ts); tabHost.setOnClickListener(this); tabHost.setOnTabChangedListener(this); } public void onClick(View v) { // Never Displayed within the LOG output Log.d(LOG_KEY, OnClick); } public void onTabChanged(String tabId) { // displayed when changing tabs Log.d(LOG_KEY, OnTabChanged); } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---