I have an ArrayList of Nodes. One of the fields of Node class is level. I would like to find the level of the node that has the maximum level in the list. This code gives me an NullPointerException... private int findMaxLevel(ArrayList<Node> nodes)
Logcat: **FATAL EXCEPTION: main Process: com.atg.antivirusnew, PID: 22956 Theme: themes:{default=overlay:system, iconPack:system, fontPkg:system, com.android.systemui=overlay:system, com.android.systemui.navbar=overlay:system} java.lang.RuntimeExcept
I try to use viewPager with the tablayout but when i set adapter with the view pager i'm getting error "java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass() on a null object reference" i d
This question already has an answer here: What is a NullPointerException, and how do I fix it? 12 answers I have a custom view (which has checkbox) for listview. I also added a checkbox in activity layout to select all checkboxes. I'm getting all the
This question already has an answer here: Why can't overriding methods throw exceptions broader than the overridden method? 12 answers I have overridden a method from parent and added a throws declaration on that method. It gave me error when I added
I am using SceneBuilder to create a GUI to get information from the user via text feilds. I get this InvocationTargetException and stack trace when I click the calcPremiumButton button. > Exception in thread "JavaFX Application Thread" java.l
On an Android app with min SDK v. 16 and target SDK v. 23 I want to programmatically change the title of a menu item which belongs to the drawer menu. I thought it would be a simple matter of doing: MenuItem myMenuItem = (MenuItem) findViewById(R.id.
I have been trying to get this piece of code to work but with no joy. Here is the error from logcat Search suggestions cursor at row 0 returned exception. java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.app.
Using Java and no IDE, but rather the command line, I'm supposed to write a basic-ish phone book program focusing around arrays in which the user has three options: search for a name in an array and print the name and phone number if the name is foun
In LinkedList we normally assign null value to last node and also use this condition to check for the last node. I am checking for the last node with the same condition either its "next" node link is null or not. But I'm unable to handle NullPoi
Whenever the user quits my app (MainActivity) using honeycomb I'm getting the following error: 06-12 02:30:42.612: E/AndroidRuntime(322): FATAL EXCEPTION: main 06-12 02:30:42.612: E/AndroidRuntime(322): java.lang.RuntimeException: Unable to destroy a
My code is throwing a NullPointerException, when i select an null Arraylist this is the stack trace: javax.el.ELException: /jsf/projet/phases/viewPhases.xhtml @27,170 value="#{PhaseComponent.listPhaseTaches(PhaseComponent.phase.idphase)}": java.
I have a problem with btn.setOnClickListener(this). I have a simple project that works good, but when I add an action to the button I get the message: unfortunatelay (app name) has stopped When I comment btn.setOnClickListener(this) out the project w
I am having a problem with a null pointer exception. Please specify some general cases of it. Here is my code: public class GuessActivity extends ListActivity implements OnClickListener { EditText GNum; Button nxt; int[] a = new int[4]; int[] d = new
I am trying to make a custom dialog in my Library Project via XML. Here is the XML File: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layou
I'm using the support library v7 on a certain project. I'm trying to instantiate the support action bar like this: ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayOptions(ActionBar.DISPLAY_S
I found out that when I press the menu button on my device, it gives me a NullPointerException. public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); //NullPointer Here return true; } So what I did is to comple
I'm writing a simple class to simulate an airplane reservation system. Unfortunately, I keep having my plan-to-hog-all-first-class-seats glee interrupted by multiple null pointer exceptions, and I can't find them anywhere. Here is my completed work:
I have used EMC Documentum Foundation Classes to perform some actions in documentum repository. The code was working fine. I exported the project as a runnable JAR and then tried to run it. However I got following error and I am not able to understan
Effective java recommend that we shouldn't catch NullPointerException. Is it always right? In many cases of catching NullPointerException, catch body only calls printStackTrace(). If I don't catch NullPointerException and call printStackTrace(), how
I'm new to Android programming and I'm having problems while passing an ArrayList of a Parcelable to a fragment. This is the Activity that is launched(working well!) where feedlist is an ArrayList of a parcelable Music. Intent in = new Intent(context
I'm trying to customize an AlertDialog by adding RadioButton and CheckBox to ask for information from users. However, the app crashes when loading the dialog and I get NullPointerException when adding setOnCheckedChangeListener to both radio buttons
I have declared two ArrayLists in my main class. One is an ArrayList of Routine objects, the other a String array of Routine names. Everytime a routine is constructed, that Routine name as well as being stored in the routine is stored in the Names ar
thanks in advance for help i am trying to display the longitude an latitude in on location update method , but getting null pointer exception. my code for the main activity is public class LocationStat extends Activity implements LocationListener{ do
I have a program which uses view flipper I am getting a NullPointerException as follows when the activity is called. I wish to cycle through a set of images as long as the activity is being run. 06-13 18:52:05.358: E/AndroidRuntime(368): Caused by: j
This is not a question, more like sharing with others a problem I encountered and how I resolved it. Basically, I was trying to create a ViewAnimator, who would create additional children in response to user clicks. To clean up after I have animated
ERROR/AndroidRuntime(545): at no.jarle.f02.myActivity.onClick(myActivity.java:38) public void onClick( View v ) { tvTextView.setText(editText1.getText()); <--- line 38 } <application android:icon="@drawable/icon" android:label="@strin
It seems that the Android SDK doesn't compile my android app correctly. After building an app, I sometimes get seemingly random exceptions. The error goes away if I comment out the offending code, rebuild, uncomment the code, then rebuild again. For
I am trying to load all types of files (like Microsoft Notepad). The SwingWorker I have can load normal text just fine but when a file such as mp3, pdf, etc. is attempted to be loaded I receive a NullPointerException. Can someone take a look at my co
If I get a NullPointerException in a call like this: someObject.getSomething().getSomethingElse(). getAnotherThing().getYetAnotherObject().getValue(); I get a rather useless exception text like: Exception in thread "main" java.lang.NullPointerEx