Android :: Catching Points With GPS - Geo Fix
May 5, 2009
I am trying to write a code about catch lat. and long. points with the GPS, actually I am using the shell with the commands "geo fix" because the DDMS doesn't work in linux apparently, I am using this scripts:
getBestProvider(criteria, true); getLastKnownLocation(provider); requestLocationUpdates(provider, 2000, 10, locationListener);
The questions is: the program is working right now in the emulator, but what about if I move the program to the real cellphone? Is the same? I need think in something else?
View 2 Replies
Oct 15, 2010
I am (supposedly) catching NullPointerException and returning 0 if that happens. But occasionally I get NullPointerException failure anyway. Is catching it this way no enough to prevent this failure?
private char getCharBehindCursor (int offset){ // get a single char behind cursor + offsett CharSequence cSeq; InputConnection inputConnection = getCurrentInputConnection(); if (inputConnection != null){ try { cSeq = inputConnection.getTextBeforeCursor (offset + 1, 0); } catch (NullPointerException npe) { /* failure*/ return (char)0; }
if (cSeq.length() == offset+1){ return cSeq.charAt(0); } } return (char)0;
View 3 Replies
View Related
Mar 18, 2009
I have tried all day to capture a trackball event in a View. Basically I want to use the trackball to move a Sprite in a 2D game left and right. The onTouchEvent works perfectly well in the View to move the Sprite with my finger but it would be nicer and cleaner to use the trackball.Can anyone provide me with a simple example that uses the trackball to move something in a View in a 2D type game world (not a menu or UI type of example)? Or can someone explain what I'm not doing. Thanks so much for any help you can give me.
View 3 Replies
View Related
Aug 12, 2009
In my application I would like to catch all exceptions globally - it should not matter, where those exceptions occur. Some runtime exceptions are practically impossible to catch (OutOfMemoryError for instance), but I want to show an informative dialog and resume execution at some well-defined point (main menu activity or something).
Using Thread.setDefaultUncaughtExceptionHandler() does this for background threads, but it is of no help in the UI thread (or adjacent handlers). If an exception occurs in the UI thread, the UI will be jammed - not reacting to any key or touch events anymore. Of course, this seems natural since it did not catch that exception; but I wonder if there is a way to recover the UI thread. So:
- Can I recover / restart the UI thread after an uncaught exception (from another thread) ?
- Is there another way to catch uncaught exceptions globally ?
- Are there viable alternatives to handle this problem ?
View 2 Replies
View Related
Aug 2, 2009
I've got this problem: When my program using too much memory, it die. Is there an exception or something else to warn me? How can I catch it?
View 11 Replies
View Related
Aug 22, 2009
I am getting an outofmemory error (java.lang.outofmememoryerror) from a bitmapfactory that doesn't seem to be caught despite the fact that it is in a try{ }catch block. Can I catch this error somehow or is it outofmemory inherently uncatchable?
View 9 Replies
View Related
Jul 9, 2009
I want my app to catch downloads of a particular kind of file.
Here's the corresponding part of AndroidManifest.xml:
CODE:............
Now, open a page with a link to an .exe file, click it. The download manager starts and then tells that The content is not supported on the phone. My activity doesn't even get called.
The questions are:
1) Why doesn't my activity get called?
2) What's the correct way of letting download manager do it's job and then get notified upon file download completion?
View 2 Replies
View Related
Mar 17, 2009
I am trying to intercept xml links that are clicked in the android web browser. I want my activity to handle these xml files, however I cannot seem to get this to work. Whenever I click on the xml file in the browser it just displays the xml file.Here is the entry that I have in my AndroidManifest.xml. Is this enough or do I need to do something more?
View 2 Replies
View Related
Jan 27, 2010
Has anyone found a way to catch outgoing calls from the Htc Hero Dialer?I currently use the NEW_OUTGOING_CALL intent in my app and this works for the standard Android dialer but not for the Htc Hero one.The hero dialer seems to not fire that specific intent.Is there any other way to achieve this?
View 2 Replies
View Related
Nov 11, 2009
I have the following code...
CODE:.................
My mClient get method is a simple HttpClient execute with an output buffer to read the input stream, so it's very trivial. Everytime I execute this task UnknownHostException will be triggered which will in turn call onTaskError on my currect Activity, but I still get a RuntimeException, but I don't see why. Maybe it's because it's late and i've done about 12 hours of writing code so it's something simple I just can't see?
View 6 Replies
View Related
Mar 12, 2010
I've a piece of code that launches an Intent. I'm wondering if there's any way to get return codes and/or catch exceptions? The particular scenario I'm facing is when I launch an Intent passing a 'rtsp' URL but it turns out the URL isn't available.
View 1 Replies
View Related
Jun 23, 2009
The JavaDoc of Context's public abstract void startActivity (Intent intent) said:
This method throws ActivityNotFoundException if there was no Activity found to run the given Intent.
But when I look at the android source code, it does not catch ActivityNotFoundException.
For example in AlarmClock.java:
CODE:..................
what is the code which handles the case when there is no activity for that intent?
View 7 Replies
View Related
Jun 19, 2009
In the Eclipse log I can clearly see a warning pop up (something about buffer overflow) every time I don't read from the AudioRecord buffer fast enough and consequently miss a chunk of audio samples. Is there any way I can detect that notification programatically so I know exactly when I have missed a chunk?
View 2 Replies
View Related
Jan 11, 2010
I'm trying to catch an action like ACTION_HEADSET_PLUG. But I think it might be too much to set this action on the manifest file.
How could I register a listener for this action? I only need to care about it when my application is running not all the time as I think it would happen when registering it under the manifest file...
View 4 Replies
View Related
Nov 3, 2010
I thought I knew how to catch list selection events in Android and then I regained consciousness. In my situation, I have a ListView that I populate with a custom view, all of the same class (let's call it the NewsChannel() class). NewsChannel consists of a LinearLayout of ImageViews and TextViews. When the list is displayed, the user may select a NewsChannel item in the list; I want to find out which list item was selected. Also, I registered an onClickListener to one of the TextViews and that works fine: when the text is clicked on, an activity is launched which is looking for the position of the NewsChannel item in the list. So, here's what my code looks like:
1. Registering the onClickListener in the ListActivity:
public class NewsListActivity extends ListActivity {...
public void onCreate(Bundle icicle) { super.onCreate(icicle);
setContentView(R.layout.news_list_format); ListView lv = getListView();
lv.setOnItemClickListener(new OnItemClickListener()
{ public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text item_index = position;
Toast.makeText(getApplicationContext(), "item clicked = " + position,
Toast.LENGTH_SHORT).show(); }}); ...
2. The layout for the ListView associated with NewsListActivity:
<?xml version="1.0" encoding="UTF-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/ android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@drawable/wpaper_tile" >
<ListView android:id="@id/android:list" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_alignParentTop="true"
android:dividerHeight="15dp" android:divider="@android:color/transparent"
android:cacheColorHint="@android:color/transparent" android:scrollbars="none" />
<FrameLayout android:layout_width="fill_parent" android:layout_height="55dp"
android:layout_centerHorizontal="true" android:layout_alignParentBottom="true"
android:background="#88000000"/>
<ImageView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true" android:src="@drawable/phonetop_bg" /> </RelativeLayout>
3. The NewsChannel layout:
<?xml version="1.0" encoding="UTF-8"?> <RelativeLayout xmlns:
android="http://schemas.android.com/apk/res/ android"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<include layout="@layout/news_heading_format"
android:id="@+id/news_heading_header"/>
<ImageView android:id="@+id/news_channel_image" android:layout_width="88dp"
android:layout_height="66dp" android:layout_alignParentLeft="true"
android:layout_below="@id/news_heading_header" android:padding="10dp" />
<TextView android:id="@+id/news_channel_text" android:lines="4"
android:inputType="textMultiLine" android:layout_toRightOf="@id/news_channel_image"
android:layout_below="@id/news_heading_header" android:layout_width="fill_parent"
android:layout_height="wrap_content"/> </RelativeLayout>
When I run the app, the ItemClickListener is never called. However, if NewsChannel were of a simpler type, say, a single ImageView or TextView embedded in the layout, the callback does get called. Any idea what I'm doing wrong? My whole goal is simply to let the activity launched by NewsChannel (not shown) to find out which instance of NewsChannel it was launched from.
View 10 Replies
View Related
Oct 20, 2010
I need to specify the full button images for both the up and down positions. My impression is that the most probable choice is to use an custom button based on the ImageView and specify the image for up and down positions. I am using the OnTouchEvent method to capture the ACTION_DOWN, but I'm not getting the ACTION_UP event.
Is there a better choice for creating a button that controls the full button image, catches the Down/Up and can subdivide the down time into time slices? If not, how do I catch the up event.
My application expects a screen touch on the "button" and not a keyboard action.
View 3 Replies
View Related
Oct 31, 2010
I noticed that a toast isn't displayed when it's used inside a catch block.
Does anyone know how to show toasts when catching exceptions?
View 2 Replies
View Related
May 5, 2010
I love the fact that I can type words like "im" and it predicts into "I'm". Is it an all or nothing though because I'm continually getting odd words thrown into my texts and not catching it. Mostly happens with slang usage or proper names. Is the only trick to keep entering these things into the personal dictionary until you root out the majority of mishaps or is there a better way. Almost wish there was a list of usual suspects that it'd auto fix but that it'd leave alone proper name entries and abbreviations and so forth. Wishful thinking or possible?
View 4 Replies
View Related
Aug 9, 2012
Alright how does one catch and stop a one decimal point error? The user inputs a single . and that is all; you can not allow that because you will be doing math with that input.if you have this in your xml file:
Code:
<EditText
android:id="@+id/edittext01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="number|numberDecimal"
android:lines="1" >
</EditText>
and the user types just one decimal and nothing else the program will blow up.I tried the following code but the program blows up at the second IF.At first the two IFs were just one line, they got broken up to see where the problem was As you can see if the length of the user input is only 1 we check to see if it is only one decimal only
The program blows up at the second IF, but errx is a STRING.I used the Log.i to see how far to program went. And the errx is a "."
Code:
if (stop == 0) // checking for one decimal only and nothing else
{
String errx =null;
errx = (edtxt01.getText().toString());
Log.i("ONE DEC:", "START OF IF xxxx: " + errx);
if (edtxt01.length() == 1 ) // *********** 1st if
[code]...
View 1 Replies
View Related
Jun 29, 2009
I understand the notion of overlays and all, but what if I want to display thousands of points on a map?The map becomes unresponsive after a few hundred OverlayItems are added.What's the best approach for doing this?
View 4 Replies
View Related
Apr 29, 2010
I want to make a apps that check what's the nearest place from where the user is. I can easily get the location of the user and I have a list of places with latitude and longitude. What would be the best way to know the nearest place of the list against the current position. I could not find anything in the google APIs. I am worried I need to resort to my calculate and have to do math to calculate it.
View 2 Replies
View Related
Aug 1, 2009
I am just a beginner in the Android and was experimenting with HTTP.I have published the result of my experimentation through the following link http://kausikdas.webs.com/apps/blog/show/1489440-http-in-android. I am yet to get a device but working with the Simulator.I need feedbacks on the possible network problems I should handle. e.g.: 1. Do I need to discover the access points and dial one before connecting? 2. How can I know which services (Data/Data & Voice/Voice/No/Emergency etc.) current network is supporting? 3. Anything more to take care of?
View 3 Replies
View Related
Jan 6, 2010
I'm trying to add a label to each of the points on a map that I've created. Setting the "title" and "snippet" values of the OverlayItem don't seem to automatically cause these labels to appear however. I would've thought this would be a pretty simple and common requirement. Am I missing something? Can someone tell me if there's a function that does this?
View 3 Replies
View Related
Dec 6, 2009
I'm trying to develop an application which display the locations of contacts on a map (a Msn-like but for geo-localisation). I search to display a route between my own location and a contact location I want to join but I find yet no solution to do this. In the Android API and Maps add-on API I just find classes to display and listen Location, Distance, GeoPoint, etc., but no possibility to display a route between two points. Is it possible or not provided by the API?
View 7 Replies
View Related
May 23, 2010
Has anyone checked to see if 3 or more points will show up on an Incredible? I'm trying to see if there's hardware/driver/android support for more touch points. Why more touch points? I dunno. It could be cool for something. I read that the physical screen supports 10 but my first tests printing MotionEvent.getPointerCount() only give me 2.
View 2 Replies
View Related
Oct 7, 2009
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.
View 3 Replies
View Related
Jul 16, 2010
I have some code that uses a network connection. I create a connection by calling openConnection() on a URL object. Is there any documentation that explains how this process works? Which access point is being used? When that access point becomes invalid, will it automatically switch to another accespoint? etc. I would like to use only WiFi access points and otherwise fail even tho 3G or GPRS could be available, is that possible?
View 7 Replies
View Related
Feb 9, 2009
I am developing an application on the android platform. The app performs continues WiFi scan and sends information about the list of visible access points to server. However, I need to remove all the Ad Hoc points. The android.net.wifi.ScanResult api does not seem to have any information on "mode" of the network. Is there anyway I can distinguish a given point is Ad Hoc or Master?
View 3 Replies
View Related
Sep 28, 2010
I would like to draw a curve(an arc) connecting three points in my screen PointA = (480,46) PointB = (160,137) PointC = (0,228) How to draw the curve using Android APIs ?
View 7 Replies
View Related
Sep 1, 2010
I am looking for a mapping application that will let me browse maps offline, as well as plot points onto the map. Does anyone have any ideas which app might let me do that? According to the MapDroyd app, it won't let me plot points
View 1 Replies
View Related