Android :: SurfaceHolder.unlockCanvasAndPost() Does Not Cause Redraw

Sep 29, 2010

I'm implementing a fairly standard app with the Android sdk that involves drawing using the SurfaceView, SurfaceHolder, Callback setup.

In my main thread (UI thread) I have no drawing or handling of the SurfaceHolder (or the canvas you retrieve with it).

In a separate thread I have the following:

CODE:...............

This code is being executed, throws no exceptions, and has no negative side effects that I can find; however, the unlockCanvasAndPost() call never causes onDraw() to be called.

In other words, unlockCanvasAndPost() does not cause a redraw of the SurfaceView.

Any ideas what could cause this symptom? I have plenty of java experience, a fair amount of android experience, and a lot of debugging experience and cannot track this one down.

Android :: SurfaceHolder.unlockCanvasAndPost() does not cause redraw


Android :: Black Screen Problem With Graphics Update Using UnlockCanvasAndPost()

Apr 14, 2009

I am working on a game for Android. I'm following the general program layout of Lunar Lander, where a SurfaceView has a worker thread that runs the main game loop. That loop updates the physics and redraws the screen by creating and drawing to a canvas.

From the thread class:

CODE:.........

I believe surfaceHolder.unlockCanvasAndPost(canvas); is supposed to release the canvas and force the screen to redraw correct? That's not what I'm seeing. I'm getting strange behavior where the final draw works, but each previous draw only shows a black screen.

For a better example: I draw a small character sprite at the left side of the screen. Then, for each successive frame of 100 frames I translate the image one to the right. So I expect to see the sprite slide to the right as the program runs. Instead, the screen is black the whole time until the end, when the sprite appears already on the right side of the screen. It's as if the very last call to unlockCanvasAndPost() is applied to the screen, but the others are hidden or not drawn. I've verified that they are, in deed, being executed.

View 10 Replies View Related

Android :: Camera Preview To A SurfaceHolder On Galaxy S

Jul 19, 2010

I have an app which uses the Camera, sending the preview to a SurfaceHolder. Everything works fine on the HTC Desire that I have been developing on, but when I run it on a Samsung Galaxy S the image from the preview is rotated 90 degrees.

The code attempts to match the best Size returned from the parameters.getSupportedPreviewSizes(), with the width and height of the Surface (as passed into SurfaceChanged as width and height).

(the image is also rotated on the Galaxy when an image is taken from the app). Has anyone else had problems with the preview on the Galaxy? Or better yet got around the problems?

View 1 Replies View Related

Android :: SurfaceHolder Changed - Stops Video Playback

Sep 17, 2010

I am developing the application which displays Video on the SurfaceHolder. When i run my video it plays well. But if i switch my application using "Home key", & go to some other application. Now if i come back by long Home key press to my application, my video does not get displayed but audio continues.

This happens because, onPause() is called for Activity when Application is switched. Thus the "SurfaceHolder" is destroyed, & next time no video is displayed.

View 2 Replies View Related

Android :: ExpandableListView Won't Redraw

Jul 29, 2009

I have an expandable list view with a static array for the group data and an SQLite database for the child data. It is implemented with the BaseExpandableListAdapter and works great, except, when I edit the database to delete or add children to the list I do not see the changes onscreen. It looks like I can use the registerDataSetObserver method to notify the adapter and expandable list of a data change. What I have to do in the callback to make Android redraw the list after data changes is what I need to know. Can I do it? Documentation on this part of the SDK is a bit sparse and expandable list view example code is not a good match. Can anyone offer advice on how to use a DataSetObserver? It feels like I have to switch over to a Cursor type adapter.

View 2 Replies View Related

Android :: Force A MapView To Redraw?

Mar 10, 2010

I've found that after changing the overlays on a MapView, the changes aren't seen until the user moves the Map, causing a redraw. Is there a way to force this redraw?

View 1 Replies View Related

Android :: Getting View To Redraw When Parameters Change

Sep 20, 2010

I want to get a set of Views to redraw after I change some drawing parameters. I'm calling invalidate() and forceLayout() on the parent of the Views but nothing happens. If I rotate the screen then the Views redraw correctly using the new parameters, as you would expect. What else do I need to do to get the Views to redraw?

View 3 Replies View Related

Android :: Redraw Linearlayout After Clicking On Button?

Nov 22, 2010

I have a linearlayout that is filled with texviews dynamically when i click on a button , but the content of linearlayout doesn't appear, how can i redraw it?

View 2 Replies View Related

Android :: How To Redraw Only A Part Of My Custom View

Aug 14, 2009

I have a custom view, that overrides the onDraw() method. For better performance I want to redraw only a small part of Canvas in onDraw().

View 4 Replies View Related

Android : Get A Custom View To Redraw Partially?

Jun 1, 2010

I have a custom view that fills my entire screen. (A piano keyboard) When a user touches the key, it causes invalidate() to be called and the whole keyboard gets redrawn to show the new state with a touched key.

Currently the view is very simple, but I plan to add a bit more nice graphics. Since the whole keyboard is dynamically rendered this would make redrawing the entire keyboard more expensive.

So I thought, let's look into partial redrawing. Now I call invalidate(Rect dirty) with the correct dirty region. I set my onDraw(Canvas canvas) method to only draw the keys in the dirty region if I do indeed want a partial redraw. This results in those keys being drawn, but the rest of the keyboard is totally black/not drawn at all.

Am I wrong in expecting that calling invalidate(Rect dirty) would "cache" the current canvas, and only "allows" drawing in the dirty region?

Is there any way I can achieve what I want? (A way to "cache" the canvas and only redraw the dirty area?"

View 1 Replies View Related

Android :: Getting A RadioGroup To Redraw With Correct Button Checked

Oct 7, 2010

I have a RadioGroup view inside a LinearLayout. The radio buttons are added from dataList. If I call the code below from inside onCreate, the correct button is checked. However the dataList can get updated from time to time and after that happens I call this code again, without destroying the Activity. After that, the view is redrawn but no button is checked. I suspect the RadioGroup checked-button bookkeeping is getting confused by the removeAllViews call. Any ideas what might be going wrong?

View 6 Replies View Related

Android :: Animation Does Not Work Probably Screen Redraw Error

Apr 15, 2010

I have created a custom component in my program by extending a ViewGroup. This component listens to touch events and are supposed to start animations when the user has move their finger past some certain points.I'm able to start animations while the user is touching the screen. But I'm not able to start animations if the user doesn't move their finger. It's probably that the phone thinks it doesn't have to update the screen if the user isn't moving their finger.I added some logs and according to them the animation starts and ends but it doesn't draw on the screen. I have the same problems when starting an animation with a timer.I use AlphaAnimations and Translate Animations on ImageViews. I have tried to use invalidate() both on the component and the ImageView but it doesn't help.Anyone who has an idea how to solve this?

View 1 Replies View Related

Android :: How Does ImageView Just Redraw Part Of Its Content When Invalidate(Rect) Is Called?

Nov 8, 2009

I am new to Android development, just reading docs and trying the APIs. I am quit confused how ImageView managed to draw just a part of its content after an invalidate(Rect) invocation.

I've checked ImageView.java, found no other drawing method except onDraw(Canvas), but onDraw(Canvas) only cut the drawable only if it is beyound the view's visible boundary. I also read the implementation of View.invalidate(Rect), I think the key of this function is calling to mParent.invalidateChild(this, r);

However, I think the parent view doesn't know how to draw the child in the given Rect, it finally has to call some method of it child to paint out. Has anybody investigated this part of codes? Would you please give me some guide?

View 2 Replies View Related

Android :: Changing 9 Patch Background On List Item In Runtime Doesn't Always Redraw

Jun 1, 2009

I have a ListView containing a few different type of items, all having their own background image and font color. In my first implementation I implemented each type of item as its own layout with the background image etc defined in XML (and implemented Adapter.getView() so that it only reuses convertView if it's of the correct type). This works fine but the performance is not that great while scrolling since I'm inflating quite a few Views due to convertView mismatches, so instead I tried using the same layout for all items (to benefit fully from convertView reuse) and changing the background image and font size in runtime. I even keep the three background Drawables I need as members to save time decoding them from a resource for each item, and call View.setBackgroundDrawable() from Adapter.getView(). The problem is, sometimes the 9-patch is not correctly wrapped around the content of the list item when using this approach. While scrolling it usually looks correct but when the scrolling stops, or sometimes when I just tap anywhere on the list, the background 9-patch of some large items starts flickering and is either cropped or resized to its original PNG size rather than stretched to wrap the content.

First of all, I suspect this is a bug? Any ideas why this happens? Could it be that the View is not always measured to reflect the changed content when the 9-patch is applied? I have tried adding an extra call to View.invalidate() but it doesn't solve the problem. Second, does this approach sound reasonable at all, or how should I go about to optimize this scenario?

View 4 Replies View Related

Android :: Why Setting TextView.Ellipsize As Marquee Cause Its Sibling View In Linearlayout Redraw

Feb 3, 2010

We are using TextView's Ellipsize function to scrolling text in it and there many other controls in our window. We noticed CPU would go up to 50% if text started scrolling. After digging deeper, we found all controls in our layout kept drawing when texts scrolling. We wonder why? And how to avoid all controls redrawing?

View 8 Replies View Related

HTC Incredible :: Text Wrap / Redraw Buggy After Froyo

Sep 4, 2010

Has anyone else noticed that after updating to Froyo, that text wrapping/redrawing is not working properly while web-browsing?For example, if you go to a text heavy website, like Reddit, and I zoom in (either by double-tap or pinch), the text will redraw, but it will be slightly larger than the screen's width. To read the text, I am required to scroll a bit to the right, then back to the left, and so on.I never had this problem prior to the Froyo update. Can anyone else confirm that they are having this problem? before I get bombed on, I should say that I am very happy with Froyo in other regards. I have not had any battery drain issues or any lag anywhere. I did not do a factory reset.

View 2 Replies View Related

Motorola Droid :: Extreme Launcher Pro Redraw Lag To Homescreen

Aug 4, 2010

I was usind ADW for a while and liked it. I like LP better because of the scrollable bar bit when I hit the home key or back up to home, about 50+% of the time it takes ten seconds to redraw. I do ude widgets but it should not be this bad. In settings I tried keeping LP in memory, I set high mem useage and many of the other options and its the same. I even uninstalled wiped cache pulled battery and its the same. Is there a setting config I should be using, or not?

View 2 Replies View Related

OnDraw - Invalidate - Make It Redraw Only Newly Drawn Lines

Jun 23, 2012

I have a simple draw application on Canvas. User should be able to draw with a chosen color. On MotionEvent.ACTION_UP, invalidate() is called. Now it redraws previously drawn lines with the current color ( Redrawing the entire drawing with the current color). I do not want to change the color of previously drawn lines. I am not sure what is missing. Can I make it redraw only newly drawn lines?

View 4 Replies View Related

Android :: Android How To Send Data From Server To Android With No Request From Android?

Oct 19, 2010

today i meet the problem.i need technic can control the android machine from server.then i want send data from server to android with no request from android.

View 2 Replies View Related

Android :: Android 1.6 - Android - View - WindowManager$BadTokenException - Unable To Add Window - Token Null Is Not For An Application

Apr 14, 2010

I'm trying to open a dialog window, but every time I try to open it it throws this exception:

CODE:.................

I'm creating it by calling showDialog with the display's id. The onCreateDialog handler logs fine and I can step through it without an issue, but I've attached it since it seems like I'm missing something:

CODE:............

Is there something missing from this? Some questions have talked about having this problem when creating a dialog from onCreate, which happen because the activity isn't created yet, but this is coming from a call from a menu object, and the appContext variable seems like it is correctly populated in the debugger.

View 3 Replies View Related

Android :: Android WebView Not Loading A JavaScript File But Android Browser Loads It Fine

Jun 3, 2010

I'm writing an application which connects to a back office site. The backoffice site contains a whole slew of JavaScript functions, at least 100 times the average site. Unfortunately it does not load them, and causes much of the functionality to not work properly. So I am running a test. I put a page out on my server which loads the FireBugLite javascript text. Its a lot of javascript and perfect to test and see if the Android WebView will load it. The WebView loads nothing, but the browser loads the Firebug Icon. What on earth would make the difference, why can it run in the browser and not in my WebView? Any suggestions.
More background information, in order to get the stinking backoffice application available on a Droid (or any other platform except windows) I needed to trick the bakcoffice application to believe what's accessing the website is Internet Explorer. I do this by modifying the WebView User Agent.Also for this application I've slimmed my landing page, so I could give you the source to offer me aid. package ksc.myKMB;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebSettings;
import android.webkit.WebViewClient;
import android.widget.Toast;
public class myKMB extends Activity {
I already have JavaScript on the web browser on, the problem is the web view is acting to different from the web browser.

View 1 Replies View Related

Android :: Resolve The Error - Com.android Internal R Cannot Be Resolved - Using Android File MultiAutoCompleteTextView.java

Aug 15, 2010

I want to implement my own Tokenizer base on the file
"MultiAutoCompleteTextView.java",

but I encounter an error "com.android.internal.R cannot be resolved" when I try to

import "MultiAutoCompleteTextView.java" to my project.

code:.................

I haven't research any solutions to resolve this problem.How to correct "com.android.internal.R.attr.autoCompleteTextViewStyle" my own attr?

View 1 Replies View Related

Android :: Does Android Eclair Code Base Support Plugins In Android Browser?

Jan 11, 2010

1- Does Android Browser (Éclair code base) support the "plug-in" or not?

2- Why "Google Gears" support is removed from the clair code base?

I searched the forum and came to know that earlier version of the Android does not support it at all? Here is the link for that, but this query asked in Dec'2008.

View 2 Replies View Related

Android :: Android How To Edit Specific Record From Database In Android Programming

Jan 5, 2010

At first,I have a database created by using Ruby on rails.I just already implement insert function(HTTPPost) in my Android Application and it's work.But I don't know how to retrieve specific record from my databases and insert it back to specific record in Android (Like edit function in RoR)This is my insert code :
private void insertComment() {DefaultHttpClient client = new DefaultHttpClient();HttpPost post = new HttpPost("http://10.10.3.87:3000/comments");
// Configure the form parameters
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("comment[content]", t_comment.getText().toString();
nvps.add(new BasicNameValuePair("comment[id_account]", "1"));
nvps.add(new BasicNameValuePair("comment[id_place]", Integer.toString(position)I really try many ways out but it doesn't work and it takes very long time to fight with this piece of code. Actually, I really don't know how to specify RowID to HTTPPost.

View 2 Replies View Related

Android :: Android.. How To Upload Data From Android Phone To Remote Database?

Sep 17, 2010

I am doing some android development, and now I need to send some android application generated data onto a remote server (a database)?How can I do that? can I use direct JDBC connection and sql?

View 1 Replies View Related

Android :: Sending Info From Android Phone To An Computer IP With Android Emulator

Oct 9, 2010

So i am making a android app, and i want it to be so if i call lets say 911 it sends my GPS coordinents to a certain IP, i know everything but how i make it so if i call 911 it sends the info and how i can make it send the info to the IP via 3g,

View 3 Replies View Related

Android :: Android Market Hiding Apps With Bluetooth Permissions From Android 1.5 And 1.6

Jul 10, 2010

I released updates of my apps yesterday and they are being hidden from android 1.5 and 1.6 phones.

This is due to a Market bug which hides apps with bluetooth permissions from android 1.5 and 1.6.

Come on Google fix the market. We spend countless hours making are apps work on ALL android versions and now you do this...

This issue has been raised since June, but has only affected me since i made an update to the market yesterday.

View 1 Replies View Related

Android :: Mock And Performance Tests Available In Android For Testing Android Application

Dec 23, 2009

What exactly are mock tests... I need to know the mock and performance tests available in android for testing android apps..what is the best tool for testing android apps and how..

View 1 Replies View Related

Android :: Android - Add Menu Item To Android's Built-in Apps

Aug 17, 2009

I'd like to add a menu option to the Android camera app. Is this possible to do using the current SDK? I know I need to add an intent-filter tag in my activity. But I don't know what I should put in the mime type. I want to be able to process the live camera previews if the user selects the menu option. So what do I put into the type tag of the intent-filter? Also I suppose I won't be using ALTERNATIVE or SELECTED-ALTERNATIVE for the category as I want to deal with the whole intent?

View 3 Replies View Related

Android :: Does The Android Market Check Installed Android's Version ?

Jan 21, 2010

I was wondering if the market checks if the application can be installed on the device. For example, if I have an Android 1.6 and if I try to install an application with :"<uses-sdk android:minSdkVersion="7" />" on its manifest. What will happend ?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved