I tried a number of things but my Application keeps Crashing.  I tried debugging it is returned this error when I run the application.  java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference  package com.zybooks.pigdice;   import androidx.appcompat.app.AppCompatActivity;  import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView;  public class MainActivity extends AppCompatActivity {      final Context context = this;     //private EditText playerName;     private String name;     private int target_score_display;     //public TextView player_name;     private  EditText targetScore;      @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);         //player_name = findViewById(R.id.player_name);         targetScore = dialog.findViewById(R.id.enter_target_score);         //playerName = findViewById(R.id.enter_player_name);            Button start_game = findViewById(R.id.start_game);         start_game.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View view) {                 // custom dialog                 final Dialog dialog = new Dialog(context);                 dialog.setContentView(R.layout.dialogbox);                 dialog.setTitle("Title...");                 Button dialogButton = dialog.findViewById(R.id.start_game_dialog);                 // if button is clicked, close the custom dialog                 dialogButton.setOnClickListener(new View.OnClickListener() {                     @Override                     public void onClick(View v) {                          try{                             String value = targetScore.getText().toString();                             target_score_display = Integer.parseInt(targetScore.getText().toString());                             Intent intent = new Intent(getApplicationContext(),Gameplay.class);                             intent.putExtra("TARGET_SCORE",target_score_display);                             Bundle bundle = new Bundle();                             bundle.putString("TARGET_SCORE",value);                             intent.putExtras(bundle);                             startActivity(intent);                         } catch(NumberFormatException nfe) {                             System.out.println("Could not parse " + nfe);                         }                     }                 });                 dialog.show();             }         });     } }   Trying to pass input taken in the dialog box to the next Activity. Have been struggling with this for over 3 hours.
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?
CSS to make HTML page footer stay at bottom of the page with a minimum height, but not overlap the page I have the following page (deadlink: http://www.workingstorage.com/Sample.htm ) that has a footer which I can't make sit at the bottom of the page. I want the footer to  stick to the window bottom when the page is short and the screen is not filled, and stay at the document end and move down as normal when there is more than a screenful of content (instead of overlapping the content).  The CSS is inherited and befuddles me. I can't seem to change it properly to put a minimum height on the content or make the footer go to the bottom. Show the number of up-votes and down-votes on the mobile site theme This is a really weird situation. A guy contacted me regarding a business I have. He offered far in excess of my stated fees and even told me he could help me financially if I needed it, which I do. He said he was a doctor. Before he even showed up, he gave me his bank account and routing number and full name, which I used to pay some utility bills. All the payments went through. He also sent me $2500 through PayPal, and I received an email that I had received the payment, though it's been 24 hours and it still hasn't shown up in my "recent activity" in my account. But at the time when I met him, I had no reason to doubt the whole thing was real.   So we met, and through conversation he seemed totally legit. Halfway through our session, he abruptly left — he claimed he was being called in to the hospital. He had already received some, but not all, of the services we had agreed to. He said he would come back in a few hours. Oh yeah, and since the PayPal funds hadn't gone through yet, and I needed cash to pay rent, he said his "financial advisor" would be wiring me $800 a couple hours later. Well, I never heard back from him and never got a call about a wire transfer. In retrospect it all seems very obviously a scam, except for the fact that he gave me a bank account number that actually worked as far as paying some bills!  My question is, assuming the PayPal payment never goes through — I never got an email saying that it was cancelled, but it isn't showing up in my payments either. I'm planning on calling PayPal if it hasn't gone through by tomorrow. But assuming that payment doesn't go through, how can I use the bank account info to get the payment he promised me as far as the services I provided? Other than paying all my utilities in advance? You'd think with an account number and routing number and full name, I would be able to withdraw money somehow, but I really have no idea how. And since it isn't under my name, I can't make a payment on my student loans. I wouldn't take more than he owed me, but it would really be nice to at least get that, even if I didn't get the $2500 he had promised me.   You always hear about not letting people see your account number and stuff like that, but it seems impossible to do anything with this info even though I have it! If scamming people with their bank account number is so easy, how do scammers do it? So I'm wondering two things:   What legal way can I take what I am owed from this guy? What illegal way do people use this info if they had it? I don't want to get in trouble, but I'm just curious because you always hear how easy it is.   (Oh, and I never actually saw his ID so I don't know that the name &amp; bank info he gave me was actually his, he could have stolen it from someone, though he really didn't seem like a hacker — he was a middle aged black man who was very smart-sounding, polite, soft spoken, and he seemed to have a lot of knowledge that a real doctor would have. I have a college degree and am very skeptical in general and careful about not being scammed and I've never had an experience even close to this, and the whole time I kept thinking "is this guy for real?" but since the utility stuff had gone through, it seemed legit. And nothing he did sent up a red flag like he might be a criminal or something. But later I googled the name and couldn't find a doctor by that name, at least not in the state he said he lives in. And since he said he would be contacting me last night, and he never did, it seems obvious that he planned the whole thing, but it just makes no sense to me.) Do lure modules and incense cause new pokemon to spawn near you, or existing pokemon to be drawn to you? How can I make environment variables "exported" in a shell script stick around? How can I make a camera the active one? I have multiple cameras in a scene. What I want to do is to change which one is active. This way I can view the scene from different angles. How would I do this? Mid 2012 MBP shuts down claiming no power with charge at 30% or 40% or more How was the Cloak of Invisibility Created? Is there a way to get administrative access from Windows Subsystem Linux files to Windows files correctly? Can the activity dropdown say more than just "+2 tag wiki"? How to toggle or turn off text selection being sent to the clipboard I would like to disable the default behavior that seems to happen with every Linux distribution that I've ever tried that any selected text is immediately sent to the clipboard (Mint, Ubuntu, Fedora, SuSE, etc.) and every window manager (Gnome, KDE, Cinnamon), and instead to behave more like the Windows implementation.    I know that this is a beloved behavior by many in Linux, and I'm sure many will think I'm an idiot.  The reason I want to do this, is that I'm a keyboard junky when navigating a GUI.  (e.g.  when I'm in Linux and I copy a URL and then switch to my browser and type Ctrl+L, it selects the address bar and moves my intended paste down one notch and replaces it with what I'm trying to overwrite.)  I know there are MANY workarounds, but I don't really care about that, what I'd prefer is to be able to toggle the behavior for the clipboard. I'm trying to match SHA1's in generic text with a regular expression.  Ideally I want to avoid matching words.   It's safe to say that full SHA1's have a distinctive pattern (they're long and a consistent length) - so I can match these reliably - but what about abbreviated SHA1's?  Can I rely on the presence of numbers?  Looking at the SHA1's in my commit log - numbers always appear in the first 3 characters. But is this too short? How many characters of SHA1 do I need to consider before I can assume a number would have appeared?    This does not have to be 100% accurate - I just need to match an abbreviated SHA1 99% of the time. Custom ordering of duplicate targets is not necessarily honored on mobile apps Polynomial in $n$ variables Let $f$ be polynomial in $n$ variables. If we have $f(a_1,\ldots,a_n) = 0, a_i \in S_i$ and $S_1,\ldots,S_n$ are infinite subsets of a field $k$, how can I show that $f=0$? Let $(X, \mathcal{T})$ be a metrizable space. Prove that $X$ Lindelöf   implies that $X$ is separable.   My attempt:  Let $d$ be the metric that induces the topology $\mathcal{T}$.   For every $n \geq 1$, consider the open cover: $$\{B_X(x,1/n)\mid x \in X\}$$  Because the space is Lindelöf, this implies that for every $n \geq 1$, there is a countable (or finite) subcover given by $$\mathcal{B}_n:= \{B_X(x,1/n) \mid x \in I_n, |I_n| \leq |\mathbb{N}|\}$$  Now, define $D:= \bigcup_{n\geq 1} I_n$. Let $y \in X$. Let $\epsilon &gt; 0$. Choose $m$ a positive integer so large that $1/m &lt; \epsilon$.  Because $y\in X =\bigcup\mathcal{B}_m$, it follows that there exists $x \in D$ such that $y \in B_X(x,1/m)$, meaning that $d(x,y) &lt; 1/m &lt; \epsilon$, such that $x \in B_X(y, \epsilon) \cap D$. Hence, $y \in \overline{D}$ and it follows that $D$ is a dense countable set in $X$, such that $X$ is separable.  Is this correct? I'm having some trouble understanding cosets.  If I understand it correctly, cosets form a partition. So, if I have $|G:H| = 2$, then $G = H \cup xH$. Right?  In an exercise, I'm asked the following:  "For $G$ group and $H \le G$ such that $|G:H| = 2$, prove that $x^2 \in H$ for any $x \in G$"  If $x \in H$, then $x^2 \in H$ because $H$ is a group. But, if $x \notin H$, then $x \in gH$ for any $g \in G$, right? Then $x^2$ = $(gh)^2$ but I can't see why this is in $H$.  Can you give me some hint? Thanks for stopping by. I want to prove that $\mathbb{Q}$ is countable. So basically, I could find a bijection from $\mathbb{Q}$ to $\mathbb{N}$. But I have also recently proved that $\mathbb{Z}$ is countable, so is it equivalent to find a bijection from $\mathbb{Q}$ to $\mathbb{Z}$? What will at actually execute? About multi-root search in Mathematica for transcendental equations Why is $l^\infty$ not separable?