nullreferenceexception

Android Studio: Attempt to setOnClickListener on a null object reference

你说的曾经没有我的故事 提交于 2019-12-14 02:28:10
问题 I am trying to cause a new activity to start when a user clicks the logout button. However whenever I click on the button the app crashes and gives the calling setOnClickListener on a null object reference. The Java code is below package hanyang.hyu_se; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7

ASP.net Null Reference Exception Due to Not Finding Controls

坚强是说给别人听的谎言 提交于 2019-12-13 23:17:21
问题 I am having this exception that I can't figure out why it is happening. I searched this site and others trying to find a solution but none have worked so far. The Problem I have the following two div in my .aspx page. <div ID="success" style="visibility:hidden" runat="server"> // buttons and textfields </div> <div ID="fail" style="visibility:hidden" runat="server"> // buttons and textfields </div> On page load, I want one to become Visible depending on some criterion. But when I try to target

Android.app.Notification.extras null

安稳与你 提交于 2019-12-13 18:15:13
问题 So I am confused and I don't know how to fix the error crashlytics and google playstore keep saying my users are having. Here is my code: if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) { Notification notification = (Notification) event.getParcelableData(); String text = ""; if (notification.extras.getString(Notification.EXTRA_TEXT) != null){ text = notification.extras.getString(Notification.EXTRA_TEXT); } if (text != null) { if (text.equals("You have been idle

NullReferenceException with HtmlDocument reference in C#

浪尽此生 提交于 2019-12-13 16:22:07
问题 I am using HtmlAgilityPack in order to scrape information off of Google Translate for a translation program. I have downloaded the HtmlAgilityPack dll, and successfully referenced it in my program. I am using Assembly in Unity. Below is my code for the two programs: using UnityEngine; using System.Collections; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using HtmlAgilityPack; public class GUIScript : MonoBehaviour { private string

Why do I get an “object reference error” with this multi dimensional array?

送分小仙女□ 提交于 2019-12-13 15:25:54
问题 Here is my class pax public class pax { public pax(); [SoapElement(DataType = "integer")] public string age { get; set; } public string firstName { get; set; } public string lastName { get; set; } public string paxType { get; set; } public string title { get; set; } } and i have declare the following array pax[][]rooms=new pax[3][]; rooms[0][0].paxType = "Adult"; rooms[0][1].paxType="Adult"; rooms[0][2].paxType="Child"; rooms[0][2].age = "6"; Its throwing an error Object reference not set to

Xamarin custom UITableViewCell throws System NullReferenceException

瘦欲@ 提交于 2019-12-13 15:11:15
问题 I'm creating a Xamarin app for iOS and I've added a UITableViewCell to a storyboard to give it my own style. I did add a class to this custom UITableViewCell, namely MainMenuCell. I added two labels to the cell and connected them with the MainMenuCell.h file, resulting in the following code: MainMenuCell.cs using System; using Foundation; using UIKit; namespace MyProjectNamespace { public partial class MainMenuCell : UITableViewCell { public MainMenuCell (IntPtr handle) : base (handle) { }

XmlSerializer Giving a Null exception in c#

吃可爱长大的小学妹 提交于 2019-12-13 10:42:12
问题 A gold medal to the person who can tell me why this isnt working. FYI it has no inner exception text so its not helping me at all... XmlSerializer x = new XmlSerializer(typeof(DownloadedSite)); My innerexception is just Null. My error is: {"Object reference not set to an instance of an object."} Here is my class: namespace WayBackMachine.Business.Obj { using System; using System.Xml.Serialization; using System.Linq; using System.Collections.Generic; [Serializable] [XmlRoot("DownloadedSite")]

c# - Code that HAS NOT RUN YET is causing an exception? How is this even possible?

﹥>﹥吖頭↗ 提交于 2019-12-13 09:48:20
问题 So I am completely stumped on this one. I am getting an error Object reference not set to an instance of an object. and I am not sure why. I have a class FILE public class FILE { private string _fileName; public string fileName { get { if (!Settings.Values.CaseSensitive) return this._fileName.ToUpper(); else return this._fileName; } set { if (!Settings.Values.CaseSensitive) this._fileName = value.ToUpper(); else this._fileName = value; } } public string folderName { get; set; } public byte[]

Why is this object reference supposedly not set to an instance of an object that has obviously been identified by the compiler?

岁酱吖の 提交于 2019-12-13 09:39:15
问题 Some people -- perhaps gullibly -- believe that there are multiple ways of being a catskinner. When my attempt to search all the Controls on a Page for Checkboxes continued to fail ignominiously (for proof of that, see this), I thought maybe I could just look at the ID of the Control, rather than care what type of control it was at heart. So, I commented out this line: If TypeOf cntrl Is System.Web.UI.WebControls.CheckBox Then ...and tried this instead: If cntrl.ID.ToString().Contains("ckbx")

ComboBox crashing WPF application because SelectionChanged is firing too soon

北城以北 提交于 2019-12-13 09:31:00
问题 Here's my XAML: <ComboBox x:Name="cloneSelector" Width="80" SelectedIndex="0" VerticalAlignment="Top" Margin="10" SelectionChanged="cloneSelector_SelectionChanged"> <ComboBoxItem Content="All" /> <ComboBoxItem Content="Top" /> <ComboBoxItem Content="Middle" /> <ComboBoxItem Content="Bottom" /> <ComboBoxItem Content="None" /> </ComboBox> And here is the SelectionChanged handler (as requested by a comment): cloneSelection = (CloneFormat) cloneSelector.SelectedIndex; var frameSize = videoDevice