Android :: GPS On - LocationManager Returns Null

Feb 5, 2010

The GPS on my Android phone is on, supported by the fact that :

location_manager.isProviderEnabled(LocationManager.GPS_PROVIDER)

returns true. Yet, the following line: Location location = location_manager.getLastKnownLocation(LocationManager.GPS_PROVIDER); returns null.

Android :: GPS on - LocationManager returns null


Android :: LocationManager.getLastKnownLocation() Returns Null

Oct 22, 2009

So I'm trying to sample the gps coordinates just once in an application. I don't want to create a LocationListener object to constantly get gps updates. I want to wait until receiving the coordinates, and then proceed on to another task.

Here is a code snippet

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

The loc variable is always null in the emulator. I tried using the command "geo fix latitude longitude" to set it, and also I tried using the DDMS way of setting it. Neither method had any effect on the code. Also the snippet isn't causing any exceptions.

View 3 Replies View Related

Android :: How Often Does GetLastKnownLocation(LocationManager.NETWORK_PROVIDER) Return Null

Sep 10, 2010

Do the Android users have the chance to reset the NetworkProvider, so that the location will be null?
I came up with the idea, that its only possible to have that location null, after starting the device the very first time. But also than google will check the location right away for my opinion.

Sure, I'm implementing a default location for this rare case. I just want to know how seldom this case is.

View 3 Replies View Related

Android :: Geocoder API - Returns A Null Value

Aug 26, 2009

I am having a real hard time with the geocoder API of android sdk 1.5rc2. In my app I am trying to get the addresses corresponding to a location name by using the getFromLocationName method of the Geocoder class. But the problem is whenever I call this method it returns a null value. I have also pushed a geodb file containing some fake addresses at 'data/misc/location' directory in the phone.

The format of the data in the geodb file is as follows :

address 1 latitude "38.898763" longitude "-77.036655" line 0 "1600 Pennsylvania Ave NW" line 1 "Washington, DC 20006" locality "Washington" region "DC" postalCode "20006" countryCode "US" countryName "United States"

and following is the code snippet : Geocoder geocoder = new Geocoder(this, Locale.getDefault()); List<Address> addresses=geocoder.getFromLocationName("1600 Pennsylvania", 10);

View 2 Replies View Related

Android :: FindViewById Returns Null

Jul 12, 2010

I have super.xml and a subset.xml.

...............

I get a null pointer exception at price.setText(data.getStrTotalPrice()); Very strange, name.setText(data.getStrDescription()); does not give a null pointer exception.

View 3 Replies View Related

Android :: ANDROID_ID Returns Null On G1?

Nov 15, 2009

Following other threads - I'm trying to get a unique device ID from the device. I tried this:

String ID = Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);

but this returns null when running on my G1. Is it supposed to be returning a valid number, or am I accessing it wrong? I don't want to use the telephony device ID because that requires more permissions.

View 13 Replies View Related

Android :: GetDeviceId Returns Null

Jul 14, 2009

I am running this piece of code..............

View 10 Replies View Related

Android :: Why InputStreamReader Returns Null?

Feb 26, 2009

I am trying to solve my problem about InputStreamReader returns null..I have a Login screen which checks the configuration file. and here is the configuration class import java.io.*;

import j2me.microtools.BufferedReader; import j2me.microtools.BufferedWriter; import j2me.microtools.FileReader; import j2me.microtools.FileWriter;.....................

View 2 Replies View Related

Android :: GetRingtone Returns Null

Feb 1, 2009

why RingtoneManager.getRingtone(this, Settings.System.DEFAULT_RINGTONE_URI); always returns null when launching from my activity? Shouldn't it return some object which is System.DEFAULT_RINGTONE_URI, which I can then play()? Is there any small example of code which shows how to play Ringtone from Activity? MediaPlayer way also not works. MediaPlayer.create(this, Settings.System.DEFAULT_RINGTONE_URI)

simply crashes with:

02-01 11:19:51.008: ERROR/TAG(351): null 02-01 11:19:51.008: ERROR/TAG(351): java.lang.NullPointerException 02-01 11:19:51.008: ERROR/TAG(351): at android.content.ContextWrapper.getContentResolver(ContextWrapper.java: 89) 02-01 11:19:51.008: ERROR/TAG(351): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:589) 02-01 11:19:51.008: ERROR/TAG(351): at android.media.MediaPlayer.create(MediaPlayer.java:516) 02-01 11:19:51.008: ERROR/TAG(351): at android.media.MediaPlayer.create(MediaPlayer.java:497)

View 2 Replies View Related

Android :: JNI - GetObjectField Returns NULL

Mar 19, 2010

I'm currently working on Mangler's Android implementation. I have a java class that looks like so:

public class VentriloEventData {
public short type;
public class _pcm {
public int length;
public short send_type;
public int rate;
public byte channels;
};
_pcm pcm;
}

The signature for my pcm object:......................

View 1 Replies View Related

Android :: GetLastNonConfigurationInstance Always Returns Null

Sep 4, 2010

HashMap myMap = (HashMap) getLastNonConfigurationInstance();

myMap is always null. getLastNonConfigurationInstance() should return an object.

public Object onRetainNonConfigurationInstance()
{
HashMap myMap = new HashMap();
myMap.put("symbol", this.symbol);
final Object data = myMap;
return data;
}

View 1 Replies View Related

Android :: GetLastKnownLocation() Always Returns Null

May 21, 2009

I'm having no luck getting getLastKnownLocation to return a non-null value in the Android emulator running in Eclipse. The following call always returns null:

locationManager.getLastKnownLocation(bestProvider);

(bestprovider is "gps")

In the intent's onCreate method I spawn a thread that calls requestFirstUpdate(). The onLocationChanged method fires so I presume the location was updated (I use the location section of the DDMS to push out a location first)..................

View 3 Replies View Related

Android :: BitmapFactory.decodeStream Returns Null

Oct 3, 2009

I have an activity which performs an image search, the results (URLs of thumbnails on the web) are rendered in a GridView. My GridView adapter class delegates creating the actual Bitmaps to an AsyncTask that loops to sequentially fetch the image content from each URL using HTTPClient, and creates the Bitmaps using:

BitmapFactory.decodeStream(entity.getContent()).

I found that the above method sometimes returns "null" silently instead of creating a Bitmap. The occurrences appear to correlate with larger stream sizes (I check this by logging entity.getContentLength()). However, if I put a breakpoint just prior to the decodeStream call & then resume immediately every time I hit it (i.e. pause briefly on each iteration), the Bitmaps are created perfectly every time. All the images are quite small (most <10K), so the download & decodeStream happens fairly quickly. There are never more than 10 images processed in one AsyncTask.

View 6 Replies View Related

Android :: BitmapFactory.decodeByteArray Returns Null

Aug 18, 2010

In my application I am converting base64 string to image.For that I initially converted base 64 file to byte array and later am trying to convert to images.
To convert to Images I am using the below code

File sdImageMainDirectory = new File("/data/data/com.ayansys.Base64trial");
FileOutputStream fileOutputStream = null;
String nameFile="Images";
try {.......................

View 1 Replies View Related

Android :: CacheManager.getCacheFileBaseD­ir() Always Returns Null

Mar 15, 2010

I've been trying to use the CacheManager for caching some http requests but it failed every time with a nullpointer exception. After some digging I believe I found out why: CacheManager.getCacheFileBaseDir() always returns null so when I try to use CacheManager.getCacheFile() or CacheManager.saveCacheFile() they fail.

CacheManager.cacheDisabled() returns false :S I hadn 't created a cache partition via the AVD manager so I thought the problem lie there. But after creating a cache partition getCacheFile() still return null:

03-16 00:25:16.321: ERROR/AndroidRuntime(296): Caused by: java.lang.NullPointerException 03-16 00:25:16.321: ERROR/AndroidRuntime(296): at android.webkit.CacheManager.getCacheFile(CacheManager.java:296)

What could be the problem? I've got the code posted here: http://pastebin.com/eaJwfXEK But it's a bit messy because I've been trying tons of stuff.

View 4 Replies View Related

Android :: CacheManager.getCacheFileBaseDir() Always Returns Null

Mar 16, 2010

I've been trying to use the CacheManager for caching some http requests but it failed every time with a nullpointer exception. After some digging I believe I found out why: CacheManager.getCacheFileBaseDir() always returns null so when I try to use CacheManager.getCacheFile() or CacheManager.saveCacheFile()
they fail. CacheManager.cacheDisabled() returns false. I hadn 't created a cache partition via the AVD manager so I thought the problem lie there. But after creating a cache partition getCacheFile() still return null:

03-16 00:25:16.321: ERROR/AndroidRuntime(296): Caused by: java.lang.NullPointerException
03-16 00:25:16.321: ERROR/AndroidRuntime(296): at android.webkit.CacheManager.getCacheFile(CacheManager.java:296)

View 2 Replies View Related

Android :: View.getContext Returns NULL

Jun 13, 2010

I'm trying to save a file in Activity.onPause method and sometimes (I've fond it in Market stacktrace) View.getContext returns NULL. The code:

public class MyActivity extends Activity { ... @Override protected void onPause() { super.onPause(); surface.saveState(); } ...
}

View 2 Replies View Related

Android :: RingtoneManager GetRingtone Sometimes Returns Null

May 2, 2010

I am having trouble debugging my app where i have an sub activity which uses the static method getRingtone. Sometimes it works, sometimes it returns null. Specifically its in a custom listview in the getView function. Strangely enough, i have another sub activity which this always works. I suppose the only difference would be the context passed in. I am looking for tips on how to determine why RingtoneManager.getRingtone is returning null, and what those conditions might be.

simply put, here is the sample code line: Ringtone rt = RingtoneManager.getRingtone(context, Uri.parse(strTemp)); strTemp is a string that looks like content://media/external/audio/media/9 I verified that Uri.parse returns a Uri object, context is what is passed into the ListActivity constructor. Any advice is appreciated.

View 2 Replies View Related

Android :: Location.getLastKnownLocation Returns Null

Oct 17, 2009

I can't display my map on android emulator. i have, locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); location = locationManager.getLastKnownLocation("gps"); After those lines,the Log shows null for location instead of the object location

View 4 Replies View Related

Android :: MTelephonyMgr.getLineNumber1() Returns Null

Sep 14, 2010

This was working at one time in development but now it does not seem to be working. I am using the emulator right now and it DID return 5555218135 before (a few days ago) but now it is returning null. I have <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission> listed in the AndroidManifest.xml. I do not know of anything I changed that should affect this.

View 3 Replies View Related

Android :: FindViewById Returns Null In New Intent

Jun 17, 2010

I am having a problem where in the started Intent, the findViewById returns null. Is there anything special I should know about starting a new intent? It goes something like this for me:

//in the MainList class
Intent stuffList = new Intent(this, StuffList.class);

then in the new Stuff's constructor:...............

View 2 Replies View Related

Android :: WebView.getUrl() Returns Null

Jul 5, 2010

I have an issue with Webview. I'm programming my own WebChromeClient class overriding onProgressChanged method because I want to show the page when it finishes loading and then, to hide the splash screen. As I just want it to happen with a specific url, I compare the actual WebView url with a specific string, but there is a problem, I get a null pointer when webview.getUrl() method is called and my application finishes.
This is the code:

private class MyWebChromeClient extends WebChromeClient {
@Override
public void onProgressChanged (WebView webview, int newProgress) {
super.onProgressChanged(webview,newProgress);
if(webview.equals(w1) && newProgress == 100 && webview.getUrl().startsWith("https://ssl.facebook.com/login.php")) {
webview.setVisibility(WebView.VISIBLE);
ImageView imageview = (ImageView)findViewById(R.id.ivsplash);...........................

View 1 Replies View Related

Android :: FindViewById(R.id.list) Returns Null

Sep 23, 2010

I have a class that is called when my app launches. public class MainActivity extends Activity implements NetworkEvent.


In this situation, list = (ListView) findViewById(R.id.list); works perfectly.

However if I then call a new intent via:

CODE:.........

where SimpleList is defined as: public class SimpleList extends ListActivity implements NetworkEvent then when I call

CODE:.........

From within the SimpleList class, list is null :(

How come? Both classes are within the same package.

View 2 Replies View Related

Android :: ListView: GetTag() Returns Null

Jun 14, 2010

I have a ListView which contains a Button in each line.

The following code is part of the getView() Method

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

For my App i need to known to which item the Button belongs to, so i try to detect it.

The code:

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

I can't understand, why do i get a "null" but not an Integer? How can i find out the Position of an Item in a ListView?

View 2 Replies View Related

Android :: MediaPlayer.Create Returns Null On Some Handsets?

Oct 20, 2009

I have a background service that plays a sound when an event has happened with the following code: 1. MediaPlayer mp = MediaPlayer.create(getBaseContext(), R.raw.theEnd); 2. mp.start(); But sometimes I see from my errorlogs that people are getting a nullpointer on line nr 2 here. My music file is a MP3 file and works great on my G1. The comments on my app says "Doesn't work on Hero after update" but I am unsure if this is specific to the Hero since I don't have that information in my errorlogs. The app has > 50000 downloads so this code works for most of the people out there, but do anyone know why it doesn't work for all of them?

View 4 Replies View Related

Android :: GetContextMenuInfo() Returns Null On Sub Menu MenuItems

Feb 19, 2010

I have an ExpandableListView with a registered context menu (loaded from an resource file). When an item is selected I use the getMenInfo() function to get the ContextMenuInfo associated with the context menu for the clicked item to determine the index of the group and / or child that was clicked. Now, this works great if the item selected is part of the main context menu. However, if the item selected is part of a sub-menu, getMenuInfo() returns null. This seems wrong. Why wouldn't you be able to get the menu info from a sub-menu? I am getting around this by saving the menu info off when it's created, but this seem hacky. Is this a bug, intended behavior, or am I just missing something obvious? Has anyone gotten this to work like this?

View 6 Replies View Related

Android :: ARCHOS 5 - MediaPlayer Create Method Returns Null

Oct 16, 2009

my app is working perfectly and playing its music in the 1.5 and 1.6 emulators, my ADP1, and for everyone in the Android Market (at least there were no complaints). The problem is that when the app is run on the ARCHOS 5 tabled, the MediaPlayer.create(Context context, int resid) method returns null. I guess there might be a problem with the ARCHOS' Android implementation, but did anyone experience the same problem? What might be a possible reason for the create method to return false? The docs don't say anything. I'm also using SoundPool in parallel with MediaPlayer if that's relevant.

View 2 Replies View Related

Android :: View Get Drawing Cache Method Always Returns Null

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

Android :: FindViewById Returns Null MapView When Following Maps Tutorial

Jun 4, 2009

I'm following this tutorial here: http://developer.android.com/guide/tutorials/views/hello-mapview.html

and am on point 11

Here's the res/layout/main.xml:

CODE:........

Here's the code:

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

View 2 Replies View Related

Android :: BitmapFactory.decodeFile Returns Null Even Image Exists / Why Is So?

Aug 2, 2010

Saving the file code...

The last line gives a null pointer exception, why is BitmapFactory.decodeFile returning null? I can verify that the file is getting saved correctly as I can pull it using adb and see the png displaying properly.

View 1 Replies View Related







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