Android :: Want Simple Drawing View / Program
Aug 30, 2010
I'm trying to create the simplest 2D drawing program possible to isolate what exactly I can't figure out about drawing. This program should literally just draw a 20x20 rectangle. Here's what I have: Code...
View 1 Replies
Sep 16, 2009
I've the following code I'm trying to run on emulator ( v 1.5 of OS), but it seems like I can't use the whole canvas! Code...
View 2 Replies
View Related
Aug 21, 2010
I'm new to Android and Java programming and I've manage to create a simple paint program, but how do I add a zoom feature? Right now I'm just extending the View class and using the "on Draw()" method. Do I have to use a Drawable to be able to add zooming functionality? I'm not really understanding the differences between the two. If I am way off base then please point me to a good tutorial on paint/zooming.
View 1 Replies
View Related
Oct 1, 2010
I have a simple activity program in android. Basically the class just extends Activity.
But when I start it I get a ClassCastException in the constructor of my class. I don't even have a constructor defined, so it must be in the constructor of the superclass which is Activity. Unfortunately the debugger doesn't give any detailed information on what class it is trying to cast. Here is the stacktrace:
Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread$PackageInfo.makeApplication(boolean, Instrumentation) line: 649
ActivityThread.handleBindApplication(ActivityThread$AppBindData) line: 4232
ActivityThread.access$3000(ActivityThread, ActivityThread$AppBindData) line: 125
ActivityThread$H.handleMessage(Message) line: 2071
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]
And when I look into this runtimeexception I get:
detailMessage "Unable to instantiate application com.test.MyApp: java.lang.ClassCastException: com.test.MyApp" (id=830067694464)
The only code is:
package com.test;
import android.app.Activity;
public class MyApp extends Activity {
}
View 3 Replies
View Related
May 26, 2010
I'm having a small problem with drawing a View offscreen to a Bitmap. The View is created using LayoutInflater.inflate(int resource, ViewGroup root) with null passed to the root parameter. The View has a fixed size (200x180 pixels). I can create a Bitmap for this View either by using the method View.getDrawingCache() or by calling View.draw(Canvas canvas) using a Canvas that in turn has a backing Bitmap. This works fine if the View doesn't change after the inflate. However, if I have a TextView inside my View that I will update, the size of the TextView is never updated regardless of what method I call on the View (requestLayout(), forceLayout() invalidate() etc.). If I display the View on screen directly, everything works fine (sizes are updated as needed, etc.). What is the correct way of drawing Views off screen and being able to update their layout when needed?
View 3 Replies
View Related
Mar 31, 2009
I'm trying to create a custom widget which looks lick HTML table. I chose to derive from TableLayout, which is the subclass of ViewGroup and View. What's confusing me is that the drawing I put into my override of View.onDraw did not take effect, until I moved the codes to the override of ViewGroup.dispatchDraw. I know dispatchDraw is a good place to draw something, but I'm just wondering why there's such difference in my practice?
View 3 Replies
View Related
Mar 20, 2010
Could someone please suggest me a good/efficient way to communicate with the server. I could think of two options 1) Use http post methods to send data to a php script at the server which would later call the google api's written in another java program (jar)or use php to use google api's (if its possible) to find nearby restaurants and send the list back to client. 2) Use simple java socket programming. The server has a jar file that supports multi threading and it does the job of finding restaurants and sending the list.
View 4 Replies
View Related
Jul 13, 2010
I am trying to put a background image and draw on top of that screen. I assumed activity will have a on draw method, but it does not have. it seems i need to use surfaceview. Can I put a surfaceview on top of the image view and make it transparent ? any example/tutorial i can refer to ?
View 5 Replies
View Related
May 4, 2009
Can you please tell me how does android determine when View should enable the drawing cache? I try calling in my class (which inherits form LinearLayout) Bitmap drawingCache = getDrawingCache(); I get a null in my drawingCache.
View 5 Replies
View Related
Sep 9, 2010
I am using SurfaceView to draw my game on the screen of the phone. Basically now I want to be able to draw Android Views on my View, such as a Button or ListView. I am simlpy getting a Canvas and then I draw on that... does anybody know how to draw AndroidViews (Button, ListView.) on my Canvas?
View 2 Replies
View Related
Jul 6, 2010
I have a few doubts about view flipper I am using viewflipper to go to another view using scroll_left animation. i have kept 2 linearlayouts inside the ViewFlipper Code...
View 2 Replies
View Related
Sep 26, 2010
I'm trying to draw a custom border by drawing a custom view. Here is a sample of one side of the border: Code...
View 1 Replies
View Related
May 12, 2010
I'm working with Android 2.1 and have the following problem:
Using the method View.getDrawingCache() always returns null. getDrawingCache() should return a Bitmap, which is the presentation of View's content.
Example code:
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final View view = findViewById(R.id.ImageView01);
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
final Bitmap bmp = view.getDrawingCache();
System.out.println(bmp);
}
I've already tried different ways to configure the View object for generating the drawing cache (e.g. View.setWillNotDraw(boolean) and View.setWillNotCacheDrawing(boolean)), but nothing works. What is the right way, or what I'm doing wrong? In real code I want to apply getDrawingCache() on a ViewGroup like RelativeLayout. Is the behaviour the same when using a ViewGroup?
View 2 Replies
View Related
Jul 19, 2010
I am drawing text in my custom view in android using canvas.drawtext. i need to change back color, and want text right aligned. for example i want to print the text in a 10, 10, 100, 20 rectangle of color yellow and text color red and right aligned. how can i do that ?
View 2 Replies
View Related
Jun 9, 2010
I have table with 3 columns which is binded to an XML document with three text views.
CODE:........
Depending on the value store in the third column, I have to decide whether i should display this row or not
How should, I go about with this.
This is what I have so far :
CODE:...............
View 2 Replies
View Related
Jul 12, 2010
I am calling one webservice.Result of webservice I am storing in an Array list. Result of webservice I want to display as list view. For ListView I am using SimpleAdapter. and SimpleAdapter is something like this:- SimpleAdapter adapter = new SimpleAdapter(this,hashmap, layout, from, to);
I am not able to put array list into hashmap. Is there anyway to do this?
View 2 Replies
View Related
Jun 18, 2010
I am new to android Programming and NDK.Yet i am not clear with working in NDK.I just downloaded android ndk r4.If i want to develop appln using NDK,and i refereed http://marinara.com/forums/android/android_examples/49.HTML for reference,But still not clear how to create the header file and implementation,I did nt have any previous exp in c language.And they asked for run Java tool to create the JNI header file. I don't know how to use Java tool,but i found it in Java bin directory and i tried using cmd Java -jni com.sarmal.MyLib It shows as class file not found, when i list the folders and files,it is shown,this is the Image
View 2 Replies
View Related
Mar 18, 2009
I have table with 3 columns which is binded to an XML document with three text views.
CODE:........
Depending on the value store in the third column, I want to change the text color in R.id.c. How should, I go about with this.
This is what I have so far :
COD:...............
View 3 Replies
View Related
Sep 15, 2010
So I have an ImageView sitting on a FrameLayout.I want to move this image view when user taps on it and drags it somewhere.This does not work however.The imageView does not move. Do I need to refresh the view somehow after I set new layout parameters?
View 1 Replies
View Related
Aug 25, 2010
Any news on someone making a program to view/edit sketchup files? I'd quite like to be able to have an engineering doodle when bored.
View 3 Replies
View Related
Aug 7, 2010
I've read several example programs and tutorials to try and solve my problem but they all seem to go the same way.I've used a couple Activities and xml documents to create a menu that loads when my game starts. When the user clicks the "Start The Game" button, it loads a new Activity that sets the view with my game thread and all of the game properties.I know this activity works because I've run it alone as its own project, but every way I've tried to start it after the Menu, I get a nullPointerException and it force closes.I read the SurfaceViewOverlay tutorial and attempted to use that implementation, but I'm using a SurfaceView, not a GLSurfaceView. I'm debating rewriting my entire program to use OpenGL but I figured I would see if anyone else knows what I'm doing wrong here.If you need the code snippets I can paste some here, but it's not really the specific code that's wrong, I think it's the way I'm using(abusing) the language.
View 1 Replies
View Related
Jun 4, 2010
I AM WRITING FROM TURKEY,
I HOPE I CAN FIND ANSWERS FOR MY QUESTION.
I OWN A HTC HERO AND VERY MUCH LIKE IT,
BUT I CAN NOT OPEN E-MAIL MEDIA FILES, OR POWER POINT PRESENTATIONS. WHENEVER I RECEIVE AN E-MAIL WITH MEDIA FILES OR PPS I AM DOWNLOADING IT SOMEWHERE I DO NOT KNOW BUT COULD NOT OPEN IT. DO I NEED A PROGRAM FOR IT?
View 1 Replies
View Related
Nov 5, 2009
I was wondering if there is a program that i can use to view the files on my hero from my pc
View 3 Replies
View Related
Mar 26, 2010
What is a good program to view .tiff files? I get my faxes sent directly through to email and they come in as .tiff files.
View 1 Replies
View Related
Jul 22, 2010
Recently my HTC Desire got damaged but fortunately I had copied and pasted all the data from my HTC Desire to my laptop. I connected my Desire to my Laptop in 'Disk Drive' mode and copy/pasted all contents/folders.
Now my Desire replacement has not yet arrived. Is there anyway I can access my 'Text' messages that were stored on my Desire in my laptop.
Where will I find those text and do I need some external program to open/view them?
View 3 Replies
View Related
Jul 21, 2010
What is your best drawing app?
I've tried Draw!, Draw(er), and MagicMarker, but I dunno, they each have their pros and cons and can't find one that suits me well. I'm not looking for Photoshop on my phone, but something better than a colored line. So what is your best drawing app?
View 3 Replies
View Related
Aug 2, 2010
I am trying to set up a ViewFlipper that changes a SlidingDrawers content each time a button is pressed. So far every view I set up worked fine, but now I am trying to create a ListView (including single_choice_mode) within a child view of the ViewFlipper, but my attempt only let to a NullPointerException. As I only discovered ViewFlipper today, I am not yet familiar with it and may not have understood it completely. if someone could give me a hand and help me find out what I have done wrong, that would be great. Here is what I have done:
The code for the onClick event of the ImageButtons:
public void onClick(View v){
if (v == btnExposure){
mFlipper.setDisplayedChild(0); }
else if (v == btnProperties){
mFlipper.setDisplayedChild(1);}
else if (v == btnSpecialEffects){
mFlipper.setDisplayedChild(2);.............
View 1 Replies
View Related
Nov 5, 2010
This is more of a question about animating than a specific problem coding. i need to fill in the broad strokes left by the research i've been doing.
What i'm trying to do:
The activity should load with only the a togglebutton visible. when the button is touched, a png will be animated to a certain position relative to the togglebutton. also, another button will slide in from off screen and slide off if/when the togglebutton is pressed again.
What i can't figure out:
I can draw an image, but only via xml. creating an imageview and setting the background programmatically does nothing.
When i draw from xml, i can't move the image when the togglebutton is pressed like i want to. when i call getPositionOnScreen() i get a null pointer, even though the complier can see i'm referring to the imageview described in both xml and in code.
I'm calling getPositionOnScreen because via xml, i have the image positioned behind the togglebutton so that it's not visible until the button has been pressed and the image starts moving. the idea is that with different screen sizes i won't know exactly where the view is until runtime. getPostionOnScreen allows me to get the coordinates of the imageview so i know where it has been positioned. when i have a start position, can tell it to "move up" on the screen from behind the togglebutton by simply adding to x or y until it's where i want.
This is the code to draw the image (inserted in the onCreate method).
CODE:.......
This is the code i'm using to animate. when the button is clicked, it calls this method on the view from the listener.
CODE:...............
I'm well aware that this is horribly wrong and won't work. what i need to understand is why.
View 1 Replies
View Related
Apr 18, 2010
I'm trying to learn about Android programming by rewriting a C app I've moved from DOS to X-windows to Windows as a learning tool. It's just a silly little app that draws symmetrical 'game of life' patterns on the screen in a kaleidoscopic fashion. It's structured so that the patterns do their own animations. I.e. there's a 'Life' class that produces the next generation and redraws itself from the center outward, inserting delays to produce a kaleidoscopic effect.
I've got it so that the patterns draw - I took the LunarLander sample as a starting point, and an drawing on a SurfaceView. But my problem is with timing the 'animations'. I'm not doing traditional animation, where I build a whole frame and then draw it, but the surface seems to want to draw itself completely on each iteration of my loop, so my inserted sleep's don't insert delay in the right places.
So my questions:
1. Is there a more direct way to write to the screen than via a SurfaceView? If I did that, would the various steps of my 'animation' occur as I drew them, producing the desired effect. 2. If such a drawing method exists, would I be wasting my time learning how to use it? 3. What's the 'standard' way to do this kind of animation?
View 3 Replies
View Related
Oct 8, 2010
Is there any api for drawing financial chart in android.
View 2 Replies
View Related