nullpointerexception

Android: Nullpointer Exception in addOnGesturePerformedListener

自古美人都是妖i 提交于 2019-12-24 10:57:54
问题 public class TestActivity extends Activity implements OnGesturePerformedListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures); GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestureOverlayView1); gestures.addOnGesturePerformedListener(TestActivity.this); } My main.xml

NullPointerException report from android market

这一生的挚爱 提交于 2019-12-24 10:40:06
问题 A user submitted the following crash report: java.lang.NullPointerException at android.widget.TextView.onTouchEvent(TextView.java:7202) at android.view.View.dispatchTouchEvent(View.java:3778) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:886) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:886) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:886) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:886) at android.view.ViewGroup.dispatchTouchEvent

Getting NullPointerException in my custom Android camera-application

牧云@^-^@ 提交于 2019-12-24 10:38:07
问题 I'm trying to build my first custom camera-app in Android. On the emulator I get: "Unfortunately, [app name] has stopped" This is the error log: (if you want me to paste the full log, please say so) 11-13 19:14:04.023: E/AndroidRuntime(4474): FATAL EXCEPTION: main 11-13 19:14:04.023: E/AndroidRuntime(4474): java.lang.NullPointerException 11-13 19:14:04.023: E/AndroidRuntime(4474): at com.kachingcamapp.CameraApplication.surfaceChanged(CameraApplication.java:80) 11-13 19:14:04.023: E

My array gets a Null Pointer Exception?

吃可爱长大的小学妹 提交于 2019-12-24 10:25:49
问题 When I try to convert a string to int array, i get a Null Pointer Exception. My String array isn't being used. How do you change a int array into a string array or how do I fix my problem?. Here is my code. /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package javaapplication3; /** * * @author Ivan Beazer */ import java.io.*; /** This program demonstrates the search method in the IntBinarySearcher class. */ public class BinarySearchTest {

Android tabHost NullPointer

做~自己de王妃 提交于 2019-12-24 10:15:37
问题 I'm new to android programming but not to Java. I've been getting this error message regarding a NPE at: 12-09 10:29:58.247: D/dalvikvm(471): GC freed 711 objects / 54912 bytes in 163ms 12-09 10:29:58.337: D/dalvikvm(471): GC freed 45 objects / 1720 bytes in 37ms 12-09 10:29:58.457: D/AndroidRuntime(471): Shutting down VM 12-09 10:29:58.457: W/dalvikvm(471): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 12-09 10:29:58.457: E/AndroidRuntime(471): Uncaught handler:

null pointer in openFileOutput

柔情痞子 提交于 2019-12-24 09:50:09
问题 I'm trying to use openFileOutput from a class which is not Activity class. When I'm writing something following, it gives me null pointer exception- try { Context con = null; fosCAM = con.openFileOutput(camFile, Context.MODE_PRIVATE); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Can anyone help me please? 回答1: You're receiving a null pointer exception because you're setting the Context variable con to null and then referencing it with con

JavaFX FXMLLoader getController NullPointerException

限于喜欢 提交于 2019-12-24 09:47:36
问题 I have a project in school where I have to develop a program where you first can choose whether you want to save/read to/from a SQL DB or to save/read to/from XML. I've made a GUI where you can choose between both methods. The GUI closes after the user clicks on one of the buttons and the MainMenu GUI opens. Now I need to know in the MainMenuController what the user choose. I found online a Method to call the MainMenuController inside the first controller, with FXMLLoader.getController() .

JavaFX FXMLLoader getController NullPointerException

你说的曾经没有我的故事 提交于 2019-12-24 09:45:05
问题 I have a project in school where I have to develop a program where you first can choose whether you want to save/read to/from a SQL DB or to save/read to/from XML. I've made a GUI where you can choose between both methods. The GUI closes after the user clicks on one of the buttons and the MainMenu GUI opens. Now I need to know in the MainMenuController what the user choose. I found online a Method to call the MainMenuController inside the first controller, with FXMLLoader.getController() .

android createBitmap NullPointerException

爷,独闯天下 提交于 2019-12-24 09:36:10
问题 I got a java.lang.NullPointerException when I try to call createBitmap. Here is my code: board = Bitmap.createBitmap(handler.signs.length * cellSize, handler.signs[0].length * cellSize, Bitmap.Config.ARGB_8888); where the width and height are also greater than zero. And this is the stack trace: java.lang.NullPointerException at android.graphics.Bitmap.createBitmap(Bitmap.java:478) at org.me.five_stones_project.game.GameView.drawBoard(GameView.java:334) at org.me.five_stones_project.game

getClassLoader().getResource(filepath) returns a null pointer

∥☆過路亽.° 提交于 2019-12-24 09:06:25
问题 I'm using a method to generate XML files dynamically for a research project, they get put into a loader that reads from a file path, I don't have any control over how the loader handles things (otherwise I'd pass the internal XML representation instead of monkeying with temp files), I'm using this code to save the file: File outputs = File.createTempFile("lvlFile", ".tmp.xml"); FileWriter fw = new FileWriter(outputs); fw.write(el.asXML()); fw.close(); // filenames is my list of file paths