Android :: Use SurfaceView Properly , Nothing Is Drawn

May 31, 2009

I had it working with a normal View but that is to slow. I was told to use SurfaceView but can't figure out how to use OnKey with it and if I should use onDraw or draw? And how do I pass stuff to draw? does it happen automatically? code...

Android :: Use SurfaceView properly , nothing is drawn


Android :: SurfaceView Vs Custom View / SurfaceView Is Slower

Aug 20, 2010

One using a Surfaceview, and the other using a custom view. According to the android SDK development guide, using a surface view is better because you can spawn a separate thread to handle graphics. Th SDK development guide claims that using a custom view with invalidate calls is only good for slower animations, less intense graphics.However, in my simple app, I can clearly see that using a custom view with calls to invalidate seems to render faster.What do you guys know/think about this?My touchEvent code is exactly the same, and my drawing code is exactly the same. The only difference is that one is all in the UI thread, and the other is using a tread to handle the drawing.

View 1 Replies View Related

Android :: Overlays Drawn On The Map

Jul 17, 2010

What I am trying to do - I am continuously getting a stream of lat/lng positions, I want to move a overlay item dynamically on the map based on the lat/lng in the stream. I am displaying the location of moving object dynamically on the map

I am putting my whole code in a while(true) loop and trying to read the stream every 5 seconds and refresh the overlays on the map. But overlay items are not shown until the function (either oncreate, or any onclickeventhandler etc) is completed. For example, test code, I am adding a single test overlay item when ever the user clicks on a button. If I put a wait(2000000) "after" I add overlays and invalidate the map, the overlay is not displayed until the time has elapsed and the function is completed.

View 5 Replies View Related

Android :: OpenGl Drawn Something?

May 10, 2010

glReadPixels is too slow, so I need another way. Without testing object by object, Is there any other way?

View 7 Replies View Related

Android :: Does A RemoteView Get Drawn On Screen?

Apr 28, 2009

From the javadoc of RemoteView, it said " * A class that describes a view hierarchy that can be displayed in another process."

But unlike View class, RemoteView does not have a 'draw(Canvas canvas)' method. Can you please tell me which method of RemoteView causing its layout to be drawn on screen?

View 2 Replies View Related

Android :: Able To Get Current OverlayItem Being Drawn

Jul 8, 2010

I want to be able to get some reference to the curent object being drawn. code...

Above is my draw method and I want to extend the draw method to write the title underneath each item for example. This would require the .getTitle() method from the OverlayItem. Possibly some tracking of objects outside of this method but not sure where to put it....

View 1 Replies View Related

Android :: Implement Dynamically Drawn Content?

Feb 2, 2010

Based on the limitations of RemoteViews, it looks to me that the appropriate way to get it actually drawn on the screen is to use an ImageView in the actual layout, then when it is updating, create a ShapeDrawable or two and draw them onto a newly created Bitmap. Then, set that Bitmap as the source of the ImageView. There is Something about that process that I'm just not grokking, though. The following is the code I tried to use to update the widget. I get nothing drawn on the screen at all. The ImageView has a placeholder image just set by its src property. When I don't run the code to update it to my drawing, the placeholder image stays in place. So, I know this code is doing something, just obviously not the right thing.

RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);
Bitmap bitmap = Bitmap.createBitmap(100, 100, Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);

ShapeDrawable drawable = new ShapeDrawable(new ArcShape(0, 360));
drawable.getPaint().setColor(0xffff0000);
drawable.getPaint().setStrokeWidth(5.0f);
drawable.setIntrinsicWidth(100);
drawable.setIntrinsicHeight(100);
drawable.draw(canvas);

views.setImageViewBitmap(R.id.ImageView01, bitmap);
appWidgetManager.updateAppWidget(appWidgetId, views);

I knew it couldn't be that easy. So, am I even heading in the right direction? Update Ok, maybe that was too much information. The question I'm really trying to ask is this: If I want to draw shapes on a widget, should I use an ImageView and create a bitmap from my ShapeDrawable or is there more appropriate way to draw into a widget where it is constrained by RemoteViews?

View 7 Replies View Related

Android :: Get Bitmap Data Before It Is Drawn On Screen

Feb 22, 2010

To any normal android Widgets based on View( Button ,TextView ...), I wanna manipulate the bitmap data before it is drawn on screen. I have tried the onDraw(Canvas canvas) method, But when the programe hit the onDraw(Canvas canvas) method, I think the bitmap has already been drawn to screen.

If there is any way that I can get the bitmap data before it's drawn to screen, so I can prevent it from being displayed , but grab the data, put it on the intent for some further use?

View 2 Replies View Related

Android :: GLSurfaceView Swaps 2D Bitmaps Being Drawn / Cause Of This Can Be?

Sep 8, 2010

I have an application that receives information from a database, and is used to visualize 2D bitmaps onto a GLSurfaceView. The information received will determine the x-position of the bitmap, and which bitmap image to use (there are 4 different bitmaps in my res folder to choose from).

Below are the three classes that are being used. The Activity sets the Shapes objects that need to be drawn by passing an ArrayList to the GLLayer class. This ArrayList is passed to the instance of ShapeStorage class via another setList method. This class is responsible for drawing when they are received.

The problem that I'm having is the following. Suppose I receive one object (let's say that it's a square at it's located at x=1). Some time goes by, and I receive another shape (this time, it's a triangle, and it's located at x=-1). However, when this new shape appears on the screen, the old bitmap's appearance changes to a triangle, and the new one becomes a square. In other words, the objects themselves are at the correct position that they are supposed to be at, but the bitmap being associated with them has changed. Does anyone know what the possible cause of this can be? I'm still a newbie to OpenGL-ES, and while this code looks very convoluted, it just involves setting a bunch of various properties for the View. code...

View 1 Replies View Related

Android :: Gradient Drawn On Canvas Looks Banded / What To Fix

Sep 23, 2010

I have a gray gradient drawable (png image in res/drawable). If I draw it on a white Canvas it looks banded (not smooth). If I put the gradient on white background in GIMP, and then draw this drawable on the Canvas, it looks great. What's the problem? I tested this on Nexus One. Calling setDither(true) on the drawable has no noticable effect.

View 2 Replies View Related

Android :: Taking Screen Shot Of Whatever Is Drawn On View

Oct 28, 2009

I am trying to take a screen shot of whatever is drawn on my custom view's canvas. The getDrawingCache() call returns null sometimes. Any pointers to what I am doing wrong here?

View 3 Replies View Related

Android :: Why Force Close Before Activity Screen Is Drawn?

Jun 29, 2010

My app keeps force closing before it starts, eclipse returns no errors in my code and my xml is good.

package com.mhe.test.scan;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class main extends Activity {
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button myScanButton = (Button) findViewById(R.id.myScanButton); myScanButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
startActivityForResult(intent, 0);
} } );
} EditText totalbox = (EditText) findViewById(R.id.totalbox);
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) { if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
// Handle successful scan totalbox.setText(contents)
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel totalbox.setText("@string/bummer");
} } } }
Essentially it is supposed to call zxing Barcode Scanner to scan a barcode on a button click and return the result into an EditText field.

View 2 Replies View Related

Android :: Develop Owner Drawn EditText Widget

Jan 26, 2010

I'm considering to develop owner drawn EditText widget. So, what do you think I should read or refer, firstly? Or, could you give me some good examples of both owner drawn widget or custom widget?

View 1 Replies View Related

Android :: Measuring Text Width To Be Drawn On Canvas

Jul 15, 2010

Is there a method which returns the width ( in pixels ) of a text to be drawn on an Android canvas using the drawText() method according to the Paint used to draw it.

View 1 Replies View Related

Android :: Measuring Text Height To Be Drawn On Canvas

Sep 6, 2010

Any straight forward way to measure the height of text? The way I am doing it now is by using Paint's measureText() to get the width, then by trial and error finding a value to get an approximate height. I've also been messing around with FontMetrics, but all these seem like approximate methods that suck. I am trying to scale things for different resolutions. I can do it, but I end up with incredibly verbose code with lots of calculations to determine relative sizes. I hate it! There has to be a better way.

View 1 Replies View Related

Android :: Drawn Bitmaps Are Not Scrolling In Custom View

Nov 9, 2010

I am creating a CustomView with bigger image based on tutorial on and developers forum. It is scolling fine.I need exact pixel coordinates of my image.I am getting that also.now I want to draw some images upon scrolling image.I am able to draw images using onDraw().But images are not getting scrolled.Any idea how to resolve this?

View 4 Replies View Related

Android :: Show Shadow For Text Drawn On Google Map

Jun 7, 2010

In my map application I am using overlay items and texts. I need shadows for both. For overlayitems I am able to display shadows. How to show shadow for the text drawn?

View 4 Replies View Related

Android :: What Event Is Fired After All Views Are Fully Drawn?

Oct 16, 2010

I need to capture the absolute positions of some ImageViews to use as drop targets. I can't seem to find what event I need to put my code in to read the screen and get the Left(), Top() .. positions. I do not want monitor the inflation of each individual view. There must be some sort of onScreenFinsihed type of event, but I can't find it. onMeasure and onDraw seem to fire at the start of their work, I need to know when they are done.

View 1 Replies View Related

Android :: Get Information Of Activity Lifecycle Callbacks In Views Drawn?

Aug 3, 2010

I want to get the size of a view that is in my activity but I am not able to get that information in any of the activity lifecycle callbacks (onCreate, onStart, onResume). I'm assuming this is because the views have not been drawn yet. At what point are views drawn and is there a callback I can put my code so I can get the size of the view?

View 2 Replies View Related

Android :: Push Up Layout In Event That Soft Keyboard Is Drawn

Jul 15, 2010

I am designing an Android app and I'm having a couple of layout issues. I have a screen with 3 EditTexts on it in a row, and I would like for the 'next' key on the soft keyboard to cycle between the EditText fields. As for now, the 'next' key has no effect. Also, when the soft keyboard is displayed, it covers up the third of the EditTexts. Is there any way to push up the layout in the event that the soft keyboard is drawn?

View 1 Replies View Related

Android :: Custom View Gets Drawn Only When Added In OnCreate / Put Call?

Nov 12, 2010

I made a "GraphBar" custom view that is a RelativeLayout with a TextView on the bottom and an ImageView, varying in height, above that. Here is the code...

I've found it's probably a bug. The workaround should be, again, calling requestLayout(). Still i don't understand where i can put the call.

View 1 Replies View Related

Android :: Draw A New Line / Get A Carriage Return Drawn In Custom View

Jan 1, 2010

This is really frustrating, I am trying to get a carriage return drawn in my custom view and nothing is working. I have tried 'System.getProperty("line.separator")' but that makes it say null and I have tried '
' and '
' and those just both draw a little square. I am using the canvas.drawText meathod.

View 2 Replies View Related

Android :: Rotate Particular Image Among Multiple Images Drawn To Canvas In Droid

Jun 16, 2010

I need a small help on rotating one image around its center of axis among multiple images which are drawn to canvas in android.

I am loading images to canvas like below.

canvas.drawBitmap(mMachineBackground, 0, 0, null);
canvas.drawBitmap(mMachineRotator, 0, 0, null);

I want to rotate only the second bitmap around its center of axis instead of rotating the entire canvas(which includes first bitmap also).

View 2 Replies View Related

General :: App That Transcribes Words Drawn With Finger

May 18, 2013

recommend an app that lets u transcribe words drawn with your finger into text?

View 4 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 :: Switch To SurfaceView

Mar 25, 2009

Im creating a simple game using a SurfaceView for drawing the Graphics. It works fine, but now I tried to add a title screen, which is (for now) only a LinearLayout and a Start-button, specified in XML. However, when I click this button and try to switch to my SurfaceView (By doing setContentView(R.layout.game), the screen turns black. But if I do setContentView(R.layout.game) immediatly in my Activity.onCreate it works. But not if I start with my Title-screen and then try to switch

View 3 Replies View Related

Android :: SurfaceView On G1 - Crashes

Apr 30, 2009

I am finally testing my application on a G1 and even though it works fine on the emulator, it crashes on the G1

It crashes when it does:

CODE:.........

And the view is defined like this:

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

View 3 Replies View Related

Android :: 2 Mediaplayer Using One Surfaceview

Jun 16, 2009

I want to play 2 videos one after one minimizing delay between each video. so I created 2 mediaplayer, one playing the current video and the other preparing to play the following video.

The 1st video is played correctely but I couldn't get the video track of the second video. only sound without any error.

This is my source code : (note that here, I am using files on sdcard but the application will use files on a web server. that's why I need to prepare the second video while the 1st is playing)

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

View 5 Replies View Related

Android :: OnActivityResult Fc When Using SurfaceView?

Sep 4, 2010

My app fc when activity that's using SurfaceView as content view calls startActivityForResult(...) and activity that has been started calls finish()

This does not happen if I change content view to something else than SurfaceView.

This would be the requested logcat:

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

View 1 Replies View Related

Android : Put GLSurfaceview On Top On A SurfaceView

Dec 16, 2009

Look at this: http://nhenze.net/?p=172

They show that it is possible to put an GLSurfaceview on top on a SurfaceView. I hope it would be useful.

View 2 Replies View Related







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