Android :: ImageView Object Allways Null

Sep 3, 2010

I have a very simple Android activity layout like this:

CODE:..

Now when I (from onOptionsItemSelected) do the following:

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

The contents of imgView is allways null!

Android :: ImageView object allways null


First Android App And Null Bundle Object

Oct 29, 2012

I've gone through the Notepad Tutorials and they are all working on my virtual device. I am now stuck in the midst of trying to write my own Android app.

My setup:
Windows 7 SP 1 64-bit
Eclipse Indigo Service Release 2
Android Development Tools 16.0.1.v201112150204-238534
Android Virtual Device Platform 2.3.3, API Level 10, CPU/ABI ARM (armeabi)

The app is about as simple as they come - you enter a number, it divides it by another number and displays the result.Here is the code involved:

AndroidManifest.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.driving"
android:versionCode="1"
android:versionName="1.0" >
[code]...

By the time DrivingTimeEstimator's onCreate() method gets executed, the Bundle object (savedInstanceState) is null (which I'm guessing is what leads to mMiles being null, which throws a NullPointerException and kills everything).

View 3 Replies View Related

Android :: Java - How To Check If Object Is Null

Jan 9, 2010

I am creating an application which retrieves images from the web. In case the image cannot be retrieved another local image should be used.

While trying to execute the following lines:

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

The line if(drawable.equals(null)) throws an exception if drawable is null.

Does anyone know how should the value of drawable be checked in order not to throw an exception in case it is null and retrieve the local image (execute drawable = getRandomDrawable())?

View 5 Replies View Related

Android :: Window.opener - Null - Is Not An Object

Jun 22, 2009

I have a webview with a FriendConnect button to allow a user to login to FriendConnect.

When clicking on this button, I'm taken through the expected screens for logging in.

However, it seems like the last redirect after logging in fails with a Javascript error in the browser:

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

View 2 Replies View Related

Android :: Why Is Parcelable Object Null In Receiving Activity?

Aug 16, 2010

I am following the Parcelable example in the Android developer guide with the intention of having a more complex object that I send to different activities. Right now, my class is a wrapper of a String member. If I put the object in the intent and read it back from the Intent it reads as expected, however, on the receiver side, it is always null-pointer.

View 1 Replies View Related

Android :: Location Object Passed Into OnLocationChanged Is Null?

Aug 8, 2010

I have an activity that implements LocationListener in my application and my onLocationChanged method has been working perfectly up until recently. For some reason the Location object being passed into the method is null. My question is, why is it null? Does it pass in a null object if it cannot acquire a location?

My GPS is on and I have it set to pull a location from the GPS, and I know my GPS can get a fix on me as I used Maps and had it locate me.

Also, I have the permission for my app set as:

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

I don't believe permissions is the issue though, as my activity was working beforehand and I have not altered the permissions since then.

Here is the code that determines the provider of the location object:

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

Here is the LogCat output of the error:

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

I have tested the same code on another device (an HTC MyTouch 3G to be precise) and it works flawlessly with the GPS, however on my Motorola Droid it crashes.

View 3 Replies View Related

Android :: Image Transparency - Load An Image File Into An ImageView Object

Aug 24, 2010

Is there a way to load an image file into an ImageView object, and then define a transparent color for this object?

View 1 Replies View Related

Samsung I7500 :: Phone Thinks Earplugs Are Allways Plugged In?

May 31, 2010

I got a problem with my Samsung Galaxy, I can't make normal phone calls since all my sound goes threw the minijack plug. I've tried connecting and disconnecting earplugs over 9000 times but still nothing. powered it off and on a lot of times, removes batterij etc. nothing seems te work. My last desperate act is to reset it to factory settings, but before I'm doing that I'm asking if any of you have a better salution? when I'm in my car (bluethooth carkit) I can make normal calls aswell.

View 13 Replies View Related

Android :: How Can I Get Current Activity Object In Instrumentation Object?

Sep 9, 2009

I want to do some automated testcase with Instrumentation . Suggest that my AUT has 2 Activity. After clicking the button in ther first Activity, the second one will be shown with new content base on what we enter in the first Activity.) Instrumentation provides us the function called startActivitySync() and return the Activity object for processing. My question is how we can get the pointer of the second Activity after the it is shown by clicking the button on the first activity.?

View 2 Replies View Related

Android :: Cast Picture Object To Bitmap Object

Jun 8, 2009

I would like to convert a Picture object to Bitmap object in memory, without writing data to disk.

View 2 Replies View Related

Android : Get Activity Object From Intent Object

Sep 21, 2009

I have an Activity that running on system. I can get the Intent that is used to start the activity. But i don't know how to get the Activity object from the Intent object or something else. Can anyone tell me how to do this??? Note that, I don't use Instrumentation object.

View 11 Replies View Related

Android :: Imageview Ontop Of Another Imageview

Jun 15, 2010

I have a listlayout with items in it that looks like this:

There is first an ImageView (the light) and then two textViews. All of this inside a TableLayout. (source here: http://code.google.com/p/switchctrl/source/browse/trunk/android/res/layout/device_switch.xml)

I want to have a rotating animation of a loading indicator Ontop of this light when this particular device (light) performs an action or an action is performed on it.

How do I put an animation ontop of this light imageview?

View 1 Replies View Related

Android : Convert Android.net.Uri Object To Java.net.URI Object

Feb 18, 2009

I am trying to get a FileInputStream object on an image that the user selects from the picture gallery.

This is the android URI returned by android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI content://media/external/images/media/3

When I try to construct a java URI object from this object, I get an IllegalArgumentException with the exception description Expected file scheme in URI: content://media/external/images/media/3 whereas the android URI shows the scheme as content

Never found a solution for the original question. But if you want the byte stream of an image in the pictures gallery, this piece of code will do that.

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

View 4 Replies View Related

Android :: Why Does LocationListener Become Null?

Jan 28, 2010

I am having issues regarding a LocationListener in my Service called myService.

Here is my code:

///onStart method ..
onStart() {
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE)
.
.
provider = locationManager.getBestProvider(criteria, true);
locationListener = (LocationListener) new MyLocationListener();
locationManager.requestLocationUpdates(provider, 0, 0, locationListener);
}

In my Activity there is a button which should stop the service. On the click of the button I am doing:

stopService(new Intent(getApplicationContext(), myService.class).................

View 1 Replies View Related

Android :: Use Null Layout ?

Mar 8, 2010

Is there an equivalent to Java's null layout in Android? Basically I want to specify the x and y coordinates of each component and not have the layout manager choose where they go. They will be within a scroll pane so it doesn't matter whether they fit on the screen.

I know null layouts are generally not a good idea but I have a special case where I need it. I'm porting a Java TV guide app and the program grid is made up of JLabels. The program dynamically generates them all, setting the x and y coords based on start/end time and channel. Each program could start and end at any time so as far as I know a table layout won't work.

View 1 Replies View Related

Android :: How To Set SetImageResource To Null

Jul 9, 2010

I have a picture in the setImageResource, but I want to make it null; so far I am using i.setImageResource(1), but would like to know a better way.

View 2 Replies View Related

Android :: Location Value Is Always Null

Jan 30, 2009

I am trying to run a simple program which shows lat and long values but Location value is always null.

CODE:...

Emulator shows alert force close - wait

How can i debug line by line, at the moment i am usinng if, else to see veriable value.

View 2 Replies View Related

Android :: GetLastKnownLocation Getting Null - On SDK

Dec 16, 2009

I am facing with problem related to the Location API.

I tried the following code:

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

View 4 Replies View Related

Android :: RingtonePreference Is Always Null

Sep 30, 2010

CODE:......

This is my preference xml. But

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

Always returns null. I am debugging on a device (HTC Wildfire).

View 2 Replies View Related

Android :: Parsing Kml And Null Results

Sep 7, 2010

I changed test.kml to test.xml.

When i tried this XmlResourceParser x = this.getResources().getXml(R.xml.test);

It returns null.

What am i missing?

Below is the kml.

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

View 2 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 :: Why Do I Get Null Pointer With FindWiewById ?

Jun 15, 2010

I'm working on an application where I want to add adWhirl to manage adds. The app is working fine until I tryed to use adWhirl. I have try to get the view created with setContentView(R.layout.main) by calling LinearLayout layout.

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 :: 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.

View 1 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







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