Android :: Draw A Semicircle Using Path?
Sep 27, 2010How do i draw a semicircle using a path?
View 4 RepliesHow do i draw a semicircle using a path?
View 4 RepliesIn my android application I use this method in "draw" Overlay class for draw route on map. Can someone tell me if this method is good (in terms of performance) for route draw on map or I must to put code in Thread ??
I'm new to android.
public synchronized void draw(Canvas canvas, MapView mapView, boolean shadow) {
if (pointsAndTimes.isEmpty()) {
return;
}
Projection projection = mapView.getProjection();
Paint paint = new Paint();
paint.setARGB(250, 255, 0, 0);.............
Can I parse kml file in order to display paths or points in android? Please could you help me with that?
This is kml sample code which I would like to display in android google map:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Paths</name>
<description>Examples of paths. Note that the tessellate tag is by default
set to 0. If you want to create tessellated lines, they must be authored
(or edited) directly in KML.</description>.....................................
Do anybody know how to draw path between two points on Map?
I need to draw a line, from one point to other...
I found one link (http://csie-tw.blogspot.com/2009/06/android-driving- direction-route-path.html) about this, but itīs not works well.
I'v been busy for a long long long time finding out how to draw a line between two (gps) points on the map in HelloMapView but with no luck.Could anyone please tell me how to do so.Suppose I use the HelloMapView which extends MapView. Do I need to use overlays? If so do I have to override the onDraw() method of the overlay and draw a line here? I actually tried these things but with no result.
View 5 Replies View RelatedI am writing a application that needs to draw a "route" comprised of lots of GPS points (long+lat). The points are close together and don't follow roads, simply drawing a line between each point is ideal.
The current implementation I have is very slow as I am looping over all the GPS coordinates and creating a new Point and overlayitem in an itemized overlay. This takes around 20 seconds for it to load all of these points and draw them to the mapview. Is there a way in which I can construct a series of lines or point from the GPS coordinates and draw them onto the mapview?
Example of current implementation:
CODE:...................
Is there a way to read the points created when drawing a path? It seems silly to me that a path cannot be readable.Or is it just better to manually write the current finger position to an array?
View 1 Replies View RelatedI want to have a elmenent with a 2 color border outline. I can do a single color outline using the element, but this only allows me to draw a single line. I tried using 2 elements within my but that didnt work either. Is there a way to either draw a shape within a shape or draw 2 lines around my shape (which has rounded corners btw).
View 3 Replies View RelatedI am launching an image picker (from the gallery) and my code crashes every single time. I tried to get some help in another post, but people quit responding to the post. Please help. When I do a debug, it tells me this (there are TONS of errors, but these looked the most important - also, I changed the "com.app.name/com.app.name.activity" for privacy reasons):
04-01 14:09:30.254: WARN/dalvikvm(719): threadid=3: thread exiting with uncaught exception (group=0x4000fe68) 04-01 14:09:30.254: ERROR/AndroidRuntime(719): Uncaught handler: thread main exiting due to uncaught exception 04-01 14:09:30.274: ERROR/AndroidRuntime(719): java.lang.RuntimeException: Failure delivering result ResultInfo {who=null, request=1, result=-1, data=Intent { data=content://media/ external/images/media/7 }} to activity {com.app.name/ com.app.name.activity}: android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1 04-01 14:09:30.274: ERROR/AndroidRuntime(719): Caused by: android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
Here is the code that invokes the activity, follwed by the code that is invoked after the activity has finished:
public void takePic() { Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, 1);
}
I have create a zip file on the phone sdk. So i need to create a program to attach that zip file and mail it. For that i need the uri of that file. I used its physical path but it doesn't work. path to the file - sdcard/myfile.zip. i used it in the code in foloowing way
sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse("file://sdcard/ myfile.zip"));
when email is sent no attachment can be seen. Is it a problem with a uri. is it a problem with the MIME type
I'd like to use the RandomAccessFile class to access a file that ships with my application. However, that class only accepts a String which is the path to the file. If I place my file somewhere like the assets directory, how do I construct a path to that file? I know I can use the getAssets methods to read up resources, but those only return InputStreams which cannot be seeked.
View 3 Replies View RelatedI have a Samsung galaxy ace 3 and its sdcard path is "/strorage/extSdCard".However, when i use
"Environment.getExternalStorageDirectory()",
it always returns "/storage/emulated/0" but in my Emulator it is "/storage/sdcard".
how can I get sdcard path in all android devices?" and "why in andoird 4.2 get path of sdcard so hard?"
I'm working on a game which will use projectiles. So I've made a Projectile class and a new instance is created when the user touches the screen:
@Override
public boolean onTouch(View v, MotionEvent e){
float touch_x = e.getX();
float touch_y = e.getY();
new Projectile(touch_x, touch_y);
And the Projectile class:
public class Projectile{
float target_x;
float target_y;
Path line;
public Projectile(float x, float y)
target_x = x;
target_y = y;
line = new Path();
line.moveTo(MyGame.mPlayerXPos, MyGame.mPlayerYPos);
line.lineTo(target_x, target_y);
So this makes a Path with 2 points, the player's position and and touch coords. My question is - How can you access points on this line? For example, if I wanted to get the x,y coords of the Projectile at the half point of the line, or the point the Projectile would be at after 100 ticks (moving at a speed of X pixels/tick)? I also need the Projectile to continue moving after it reaches the final point. Do I need to use line.addPath(line) to keep extending the Path?
I managed to get the Projectiles moving in a straight line, but they're going in strange directions. I had to fudge some code up:
private void moveProjectiles(){
ListIterator<Projectile> it = Registry.proj.listIterator();
while ( it.hasNext() ){
Projectile p = it.next();
p.TimeAlive++;
double dist = p.TimeAlive * p.Speed;
float dx = (float) (Math.cos(p.Angle) * dist);
float dy = (float) (Math.sin(p.Angle) * dist);
p.xPos += dx;
p.yPos += -dy;
The Angle must be the problem. I'm using this method, which works perfectly:
private double getDegreesFromTouchEvent(float x, float y){
double delta_x = x - mCanvasWidth/2;
double delta_y = mCanvasHeight/2 - y;
double radians = Math.atan2(delta_y, delta_x);
return Math.toDegrees(radians);
However, it returns 0-180 for touches above the center of the screen, and 0 to -180 for touches below.
http://itunes.apple.com/us/app/pathpix-pro/id338509060?mt=8... I got my Ken Ken and Pi cross fix. Now I need my Path Pix fix.
View 5 Replies View RelatedAs with any software it would be benficial to have an easy migration path from the main competitor in the landscape.Create an iphone/ipod to Android App migration tool. The android app marketplace could build a migration app or tool that allowed you to interrogate your itunes apps and give you a translation to the comparable Android apps on the android market that do the same thing.
View 2 Replies View RelatedI am trying to do the following.
I have an Image viewer where in the user picks an Image from within the gallery. The uri to that selected Image is available to me. Now, I want to use this URI information and send it as a file over a socket using FileInputStream. Is this a valid syntax to perform the above action?
CODE:..............
I have a Main_Overlay class that extends Overlay. I added This overlay to the mapview and override the Draw method as of below:....................
View 5 Replies View RelatedDoes anyone know how to get the real filesystem path where the images are stored? I know that Using Media.EXTERNAL_CONTENT_URI thru a content provider you can get the pictures inside the folder and from there get the path. but if the pictures folder is empty, how I can get the full path?
View 2 Replies View RelatedI have a binary file in the R.raw folder. Now I am able to get the file name and can read the file as well, but I need to find out the complete path of the file in string format.
View 1 Replies View RelatedIs there way, from the emulator, to get the SD Card file name / path?
View 2 Replies View RelatedI know the absolute path of an image (say for eg, /sdcard/cats.jpg). Is there any way to the content uri for this file? Actually in my code I download an image and save it at a particular location. In order to set the image in an ImageView currently I open the file using the path, get the bytes and create a bitmap and then set the bitmap in the ImageView. This is a very slow process, instead if I could get the content uri then I could very easily use the method ImageView.setImageUri(uri)
View 1 Replies View RelatedI trying to do XML parsing program. I also used FileInputStream for my XML file. I placed XML file under android's assets folder,META-INF folder. That's file name is "container.XML". Here is my code parseXML,
public void parseXMLinfoBook() throws FileNotFoundException, ParserConfigurationException, SAXException{
FileInputStream in = new FileInputStream("file:///android_asset/META-INF/container.xml");
StringBuffer inLine = new StringBuffer();
InputStreamReader isr = new InputStreamReader(in);
BufferedReader inRd = new BufferedReader(isr);
SAXParserFactory spf=SAXParserFactory.newInstance();..................
I am trying to read a csv file from assets/file.csv, but the log keeps spitting out that it doesn't exist. Is my path correct for internal file storage? This is the class file:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class ReadList {
public String[][] mainMenuList() throws IOException {
String [][] arrayList = new String [24][24];
File file = new File("/data/data/com.xxx.view/file.csv");.....................
How does one tell it where to put the AVD? by default it is creating it in my windows home directory under a .android folder. i cannot start my avd if its located over a unc path oavd. our sys admins put all of your home directories on another shared server.
View 1 Replies View RelatedExport PATH=${/home/mohit/}:<android-sdk-linux_86>/tools
This is what i am using..
error:--bash: PATH=${/home/mohit/}:: bad substitution
This is the path of sdk
CODE:...................
I want to load an mp3 from a string path in andriod which is situated in drawable folder?
View 1 Replies View RelatedI'm developing an application that is supposed to run on both Android as well as regular Java SE. I have an eclipse project called foobar-core which contains code that is used both by the Android and the SE version. I have another project called foobar-android, which contains all android-specific code. I need to reference some of the foobar-core code in the foobar-android project, so I added foobar-core to foobar-android in Settings -> Java Build path -> Projects -> Required projects on the build path. This works fine, as I can use code from foobare-core in foobar-android now.
Here's the problem: Both foobar-core and foobar-android are independent git repositories, which means they both have a .git subdirectory. Now I get a lot of warnings on the "Console" tab whenever I compile foobar-android. They look like this:
/foobar-core/src/.git/HEAD conflicts with another file already put at .git/HEAD
/foobar-core/src/.git/config conflicts with another file already put at .git/config
/foobar-core/src/.git/description conflicts with another file already put at > .git/description
/foobar-core/src/.git/hooks/applypatch-msg.sample conflicts with another file already > put at .git/hooks/applypatch-msg.sample
How can I tell Eclipse to ignore the .git files when importing sources from the foobar-core project?
Is it possible to get path of database file in android at path : "/data/system/accounts.db"
In my app i want to use this database, but not getting its path. if i do hardcoding and remove the file i'm able to do it. But i want to access it as database so that i can drop the table.
code i tried:
CODE:.................
I need to get the absolute path of the file associated with a specific android.net.Uri instance. I know how to get the URI instance based on the file instance (with Uri.fromFile(file)) and i need the inverse action.
View 4 Replies View RelatedIn the app I am making, I would like to take a Base64 image that is received from a server, and save it to a file for displaying later. My question is where should I store this file? It needs to be dynamic, and may be empty when the program launches. I am unsure how exactly the file system on Android works, such as how file paths look.
Ideally I would like to be able to write the data to the image file using a FileOutputStream, and then display that image somehow.