Android :: GluUnProject Function Always Return NaN
Nov 20, 2009i want to get the 3D coordinate from the android screen x,y coordinate i choose to use the gluUnProject but the gluUnProject function always returns NaN why?
View 3 Repliesi want to get the 3D coordinate from the android screen x,y coordinate i choose to use the gluUnProject but the gluUnProject function always returns NaN why?
View 3 RepliesI'm having problems with gluUnProject. I saw other discussions on this message base regarding this function and they did not solve my problem. When I use GLU.gluUnProject I get values that are close, but not quite right. I'm manually keeping track of my model matrix and I replicate the projection matrix manually. (I have also tried setting the projection matrix to identity and manually incorporating a projection matrix into my model matrix, and I ended up with the same results). I tried using the builtin GLU.gluUnProject function and I also implemented my own based on reading that source and reading the C GLU sources and both seemed to give substantially similar results. So I put together a small demo, trying to keep it as minimal as possible and still get the point across. Either this demo shows a misunderstanding I have of gluUnProject or it shows a bug in the function or opengl projections. Can someone check this over and see if I'm just doing something wrong or if there's a bug that needs to be filed? The files are here: http://www.thenewsh.com/~newsham/unproj/ In particular:
unproj.java - full source to example unproj-debug.apk - resulting apk file unproj - directory with full ant-buildable project unproj.zip - zip of directory
How do I use gl.gluUnproject in my OpenGL ES 1.1 android app to determine what is selected when the user touches the screen?
My understanding is that the touch event results in a line and I have to find the first "thing" it intersects with.
Are there any tutorials on how to do this?
If I need to return my phone before the 30 days are up and they are out of stock, will they still honor the return policy and just call you when they have one available or will you have to stick with the phone that you have?
View 5 Replies View RelatedMy activity stack is ABC, in activity C I press back, and return to B, then press back again and go to A. What should I do to return to A directly from C?
View 5 Replies View RelatedI have an application that open an other class using intent :
CODE:.........
In Repository.class we have the onActivityResult method :
CODE:...................
I don't know how I can return the value of num to the first class (that create Repository.class).
I want to get a return value from javascript in webkit.
View 2 Replies View RelatedI want to make a content provider for font file. But I can not find any way to return a Typeface from Cursor. According to SDK reference, Matrix Cursor sounds like a solution, but it doesn't support any object except String,Long,Double,Short,Flow.
View 4 Replies View RelatedIs there a way to return the GPS signal Strength? Thank you for your input 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
View 3 Replies View RelatedI am able to successfully get lat/long and pass it to the geocoder to get an Address. However, I don't always get an address back. Seems like it takes a couple of attempts? I'm not sure why.
Is there a better way for me to obtain the address at this point?
CODE:.................
I am calling this method here:
CODE:.....................
According to my research, which includes reputable sources (Mark Murphy et al), the most preferred way of polling a remote source and presenting said data to the user is by creating a service and using AsyncTask within that service to do the polling. I have done that.But, when I read the docs there seem to be several "Threading Rules" that conflict with this way of doing things: "The task instance must be created on the UI thread." and "execute(Params...) must be invoked on the UI thread." As stated, I have created the task instance on the Service thread (not the UI thread). Am I missing something? Also, when the AsyncTask finished, I sent out a Broadcast on onPostExecute, which is then picked up by the Activity, telling it to retrieve the final value again from the service (since I couldn't obviously update the UI from the service). I couldn't figure out any other way to return the result of the AsyncTask. Is this the correct practice?
View 8 Replies View RelatedAndroid documentation says that AsyncTask postExecute() is called on the UI thread. I was under the impression that postExecute() was called from the Thread where execute() was called : I have been using an AsyncTask in a background Service with its own thread, and postExecute() was called in the service thread, not the main thread. However, I recently had an issue with the postExecute() not being called at all, while an exception was thrown : " sending a message to a Handler on a dead thread". How is it exactly :
- shall AsyncTask be used ONLY from the main thread ?
- if not, in which thread postExecute() is supposed to be called : always the UI thread, or the execute() calling thread ?
I want to get a return value from javascript in android. With Iphone, i can do it, but Android, i can't. I use loadUrl but return void not object.
View 3 Replies View RelatedFrom the JavaDoc, it said it returns 'a bitmap representing this view or null if cache is disabled'. My question is what if the View is longer than the phone screen (you need to scroll vertically), what does the bitmap return? * only the visible portion of the view * everything the view has (both visible + invisible part)
View 4 Replies View RelatedI have a simple task (simple in other platforms, not in Android :-( ): take a photo and return its pathname to the caller. I searched a lot the net and tried many variants to the code. I'm aware of the "thumbnail image" bug and am trying to bypass it. The following code works, but its somewhat dificult to get the photo: the guy has to go to the media picker, click menu button, select "camera capture", take the photo, click back, and finally select the photo from the list. The good thing: the photo returned is BIG.
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*");
startActivityForResult(intent, TAKE_PHOTO);
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) { case TAKE_PHOTO: if (resultCode == RESULT_OK)
try { Uri uri = data.getData(); java.io.InputStream is = getContentResolver().openInputStream(uri);
java.io.FileOutputStream os = new java.io.FileOutputStream(targetPhotoName);
byte[] buf = new byte[4096]; int r; while ((r = is.read(buf)) > 0) os.write(buf,0,r);
is.close(); os.close(); Launcher4A.pictureTaken(0,null);
} catch (Exception e) { String stack = Log.getStackTraceString(e);
AndroidUtils.debug(stack); } break; }
I also saw a code that (in theory) would do exactly what I need:
sourcePhotoName = Environment.getExternalStorageDirectory() + java.io.File.separator + "tmpPhoto.jpg"; targetPhotoName = s;
Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
Uri uri = Uri.fromFile(new java.io.File(sourcePhotoName));
i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, uri);
startActivityForResult(i, TAKE_PHOTO);
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{ switch (requestCode) { case TAKE_PHOTO: if (resultCode == RESULT_OK)
try { java.io.InputStream is = new FileInputStream(sourcePhotoName);
java.io.FileOutputStream os = new java.io.FileOutputStream(targetPhotoName);
byte[] buf = new byte[4096]; int r; while ((r = is.read(buf)) > 0) os.write(buf,0,r);
is.close(); os.close(); } catch (Exception e) {
String stack = Log.getStackTraceString(e); AndroidUtils.debug(stack);
} break; } }
It works (almost) as expected: the camera application is shown, and after the photo is taken, the photo is returned to the application. However, it has two problems:
1. If I pass a folder inside my application's directory, when I press "done" button, the camera application does not return; it stays in the same screen until I press cancel. Seems that the camera application does not have permissions to write to my folder.
2. The image returned from this code is the Small Image (Thumbnail).
So, I now have a code that works and return a big image, but is somewhat burocratic to the guy to use (and also can lead to errors, if he selects the wrong picture), and a code that does what i want but returns a small picture. I'm using a HTC G2 with Android 1.6, and I have to use it because 1.6 is the requirement for my system. Ok, now the question: is there something I can do in code #2 to make it return the big picture?
I am a beginner programmer and I am attempting to use the android NDK.
Is there a way to return an array (in my case an int[]) created in JNI to java? If so, please provide a quick example of the JNI function that would do this.
I am trying to perform a rating system, where with the choices to select from returns a constant number so I can insert a value into a database. My intentions are to have 3 choices, 'Great', 'Mediocre' and 'Bad'. I would like Great to be a constant for '3', Mediocre to have a constant '2' and Bad to have a constant for '1'. I would like to insert only the numerical values if possible, any easy way to do this?
View 1 Replies View RelatedMy HTC's wallpaper used to be a dark gray mesh pattern with flecks of color, with was fairly attractive to me, and provided good contrast with most icons..
I recently tried out a live wallpaper, and now I can't get back to the original one. My only choices are the live ones, and about 6 more from HTC..
I've searched the directory structure for .jpg. .png files, but have been unable to find the original pattern.
Any idea where it is, or how to get it back?
I'm trying to get the ANDROID_ID on two different devices but it always return null on both. I'm using a Google Ion (aka HTC Magic) with firmware 1.6 and a Motorola Milestone with firmware 2.0.
I've been using this small sample to show the id, but it always shows null:
CODE:........................
I was expecting the getEdgeFlags() method of MotionEvent to tell me when a MotionEvent had reached the edge of something, but the value returned from getEdgeFlags() is *always* zero. Is this the expected behavior? The documentation says that the flags indicate when a touch has reached the edge of the display. I've tried this on a real device and in the emulator, and the location coordinates never quite reach the edge of the display, and getEdgeFlags() always returns 0. By "never quite reach" I mean that if dragging a finger off the left edge of the display, the smallest X I got was 2. Reaching the edge of the view doesn't seem to change the value returned either.
I suppose I could set the flags myself using setEdgeFlags() using calculations with known dimensions of the object whose edges I care about. Is that how it's supposed to be used? Is this broken for now?
How do I have an app return to the 'Home' screen when the user is on a different class and they click the back/return button on their phone?
View 2 Replies View RelatedI've searched for quite some time over this forum and also using Google, so I hope I'm not duplicating a thread.
Does anyone know if there is any way of returning to the homescreen after sending an SMS? I have a Desire Z and whilst it's only a case of pressing the home key, it's a small gripe as I have to flip the keyboard back in and press home.
I'm using the default SMS application and I'm not too fussed on external SMS apps as I don't like the graphics (I've tried Handcent and the default Android skin still isn't quite the same), plus the only real reason I wanted them was to change the LED colour, but that doesn't work either. Anyways, if anyone has some ideas please feel free to let me know.
How i can return String value from onClick method?code...
View 1 Replies View RelatedIs is possible to get back a result intent when launching an Intent from a Notification? Similar to the way startActivityForResult() works ?
View 3 Replies View Related1. what is the getKeyDownTime() method? What does its return value mean logically? 2. what is the getKeyEventTime() method? What does its return value mean logiccaly? 3. I want to measure the time a key was depressed for. Eg: Key A was pressed for 60 ms. which of the above methods would be useful?
View 7 Replies View RelatedI live in an area which is 9 feet above sea level, and when I call getAltitude I get back a value less than -10. Am I doing something wrong, is my device a failure, or is there some nifty scale that I don't know about?
View 2 Replies View RelatedI've tried null and empty string, any other ideas?
View 3 Replies View RelatedI am implementing an application to search for nearest local venues from a gps coordinates database.
I am using the Location class distanceTo() function to calculate distance between two location the current one and the one from the database.
CODE:............
This work fine and i am able to use this distance to calculate proximity in the rest of my app, but the distance it self is not apparently in meters i am getting result like 4134801.4 i am sure that the distance is 3200meters in this case.
I'm getting unexpected behavior in my Android 1.5 application under the Windows emulator and debugging with Eclipse. Here's a generalization of what the code is doing:
if (someCondition) {
System.out.println("got here");
return "a";
}
if (someOtherCondition)....................
i seem to have a classic task, yet i can't find any examples on how to do it.i want to download something. well i call a web service and get a response but its pretty much the same.in order to do this i have an activity that starts a service that spawns a thread that does the job.now i would like to use the data i got in the activity that started the service.(i assume that starting another activity to handle the job of displaying the result would be simple)my problem is how does the service notify an activity (the one that started it or another one) of something.
View 1 Replies View Related