nullpointerexception

Reup: Notification (NPE Issue)

混江龙づ霸主 提交于 2020-01-06 20:06:40
问题 I reworked the code to my notification class. Its spitting an Null pointer Exception at me every time I go to run it. So once more here is the code: import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.RemoteViews; public class kickStart extends Activity { NotificationManager nm; Context context = this

java array nullpointer

前提是你 提交于 2020-01-06 19:42:31
问题 I'm trying to find minimum of an array. The array contain Nodes - a node contains of an element E and a priority int. Im want to find the Node in the array with the smallest priority. @Override public E min() { Node temp = S[0]; for(int i = 1; i<S.length; i++){ int prio= S[i].getPrioritet(); <-- nullpointer excp. if(prio<temp.getPrioritet()){ temp = S[i]; } } return temp.getElement(); But i get an nullpointer exception when i try to use it. Does anybody know what im doing wrong? Here is my

Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://media/external/images/media/57054 (has extras) }}

Deadly 提交于 2020-01-06 19:29:10
问题 I'm writing an Image splitting method for a jigsaw puzzle game. Beside the default image the app can pick and split an image from the gallery. I get this error after choosing an image from the gallery and the app force close. Here are my code: ImageView image; Uri selectedImage; private final int RESULT_LOAD_IMAGE = 1; int chunkNumbers = 16; ArrayList<Bitmap> chunkedImages; Button[] buttons; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Parcelable object that receives passed data coming up null

…衆ロ難τιáo~ 提交于 2020-01-06 18:07:23
问题 I'm working on an Android app that stores contact information, I'm trying to add a feature that when you click on a contact item in the ListView it will send the contact object that implements parcelable over two the second activity. This is Where I send the contact object over to the Contacts Activity. ` @Override protected void onListItemClick(ListView l, View v, int position, long id) { // TODO Auto-generated method stub final Contact item = (Contact) getListAdapter().getItem(position);

What is a NullPointerException, and how do I fix it?

落花浮王杯 提交于 2020-01-06 15:18:12
问题 This post is a Community Wiki . Edit existing answers to improve this post. It is not currently accepting new answers. What are Null Pointer Exceptions ( java.lang.NullPointerException ) and what causes them? What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely? 回答1: When you declare a reference variable (i.e. an object) you are really creating a pointer to an object. Consider the following code where you

Nullpointer exception in HBase MapReduce

送分小仙女□ 提交于 2020-01-06 15:18:10
问题 I have a mapreduce app that takes an HBase source data and mapreduces it to another HBase table, all written in Java.When I run it using hadoop jar myhbase.jar It terminated with a NullpointerException as below: 14/01/31 11:07:02 INFO zookeeper.ClientCnxn: Socket connection established to 127.0.0.1/127.0.0.1:2181, initiating session 14/01/31 11:07:02 INFO zookeeper.ClientCnxn: Session establishment complete on server 127.0.0.1/127.0.0.1:2181, sessionid = 0x143e677d6e30007, negotiated timeout

Instantiated private class -> null pointer exception

半世苍凉 提交于 2020-01-06 08:44:08
问题 Hi awesome person! I have a problem... I get a NullPointerException when my test case reaches allEdges.add(newEdge); in the connectNodes method. I think it has something to do with Edge newEdge = new Edge( n1, n2, weight ); previously in that same method. Is the problem my use of generics in the Edge class or something like that?. I previously got an error directing me at the Edge newEdge = new Edge( n1, n2, weight ); line, saying something like "class not found". But now i seem to get the

Getting nullpointer exception on capturing VIDEO from camera, android?

岁酱吖の 提交于 2020-01-06 06:53:26
问题 I tested my code on sony, samsung and HTC devices where it works fine. But it doesnt work on other devices like karbonn etc... Here is my code Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO); // create intent.putExtra(MediaStore.EXTRA_OUTPUT,fileUri); // set the video file name intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startActivityForResult(intent,CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE); This is the onactivity result code

Getting nullpointer exception on capturing VIDEO from camera, android?

三世轮回 提交于 2020-01-06 06:51:20
问题 I tested my code on sony, samsung and HTC devices where it works fine. But it doesnt work on other devices like karbonn etc... Here is my code Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO); // create intent.putExtra(MediaStore.EXTRA_OUTPUT,fileUri); // set the video file name intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startActivityForResult(intent,CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE); This is the onactivity result code

Android LiveData null error when trying to update object

我与影子孤独终老i 提交于 2020-01-06 06:43:40
问题 I am looking for help to better understand LiveData in Android. I have created an application that allows a user to view, edit or create entries in a db. I have used a viewmodel on the form activity to share information between the activity and fragments and to also make the data Lifecycle aware. The code works great when I load a entry from the database. Any changes are captured and saved back to the database However when I want to create a new entry using the same code I get Caused by: java