I have an app with 5 tabs, 3 are the same fragment and two are two different fragments. This problem happens in all 5 fragments since the code is the same.  When I click the tabs really fast and there's some text in my AutoCompleteTextView, the app crashes.  I've tried to check if my components (listAdapter and ArrayAdapter) are not null before asigning or initializing them.  override fun afterTextChanged(s: Editable?) {             val db = DataBaseHandler(context)             var listAdapter: ArrayAdapter&lt;String&gt;              Handler().postDelayed({                 search = etSearch.text.toString().trim()                 if (search.length &gt;= 3){                     resultList.clear()                     products = if (isNumeric(search)) db.readData_SomeProductsId(search)                         else db.readData_SomeProductsDesc(search)                     for (product in products!!)                         resultList.add(product.prod_description)                     if (resultList.size == 1){                         product = products!![0]                         ETClear(etSearch)                         addProduct()                     } else{                         if (resultList.size &gt; 1){                             listAdapter = ArrayAdapter(context, android.R.layout.simple_spinner_dropdown_item, resultList)                             etSearch.setAdapter(listAdapter)                             etSearch.showDropDown()                         }                      }                 }             }, 600)              etSearch.setOnItemClickListener{ parent,view,position,id-&gt;                 val selectedItem = parent.getItemAtPosition(position).toString()                 product = db.readData_ProductDescription(selectedItem)!!                 ETClear(etSearch)                 addProduct()             }         }   The error shows as follows:  06-05 18:01:49.034 26859-26859/com.example.said.puntodeventa E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.said.puntodeventa, PID: 26859 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference     at android.view.LayoutInflater.from(LayoutInflater.java:234)     at android.widget.ArrayAdapter.&lt;init&gt;(ArrayAdapter.java:178)     at android.widget.ArrayAdapter.&lt;init&gt;(ArrayAdapter.java:163)     at com.example.said.puntodeventa.SaleFragment1$onViewCreated$1$afterTextChanged$1.run(SaleFragment1.kt:109)     at android.os.Handler.handleCallback(Handler.java:739)     at android.os.Handler.dispatchMessage(Handler.java:95)     at android.os.Looper.loop(Looper.java:158)     at android.app.ActivityThread.main(ActivityThread.java:7231)     at java.lang.reflect.Method.invoke(Native Method)     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)   Thanks in advance
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?
How do I find playtesters? Obviously the first tester group would be your own group. But beyond that? It would seem to make sense to have at least more than one group test out your game, as different groups want different things and play differently. Fresh eyes find different bugs, etc. etc.  Are there resources out there to help aspiring game designers without a lot of contacts find people willing and eager to test out their game?  Or is this in essence a "" issue?  To clarify my own situation:  I have the mechanics finished. The setting is still under development, but in accordance with the motto "fail faster" I want to go ahead and test the mechanics (in a different setting for now) to see if they work and are fun or if I need to go back to the drawing board. I have a sort-of group, but I don't know them very well and they don't meet often, and so I'm not excited about the prospect of presenting the mechanics to them right now (as I'm sure there are a dozen issues I've overlooked). Also, I'd like to test the game (including the setting, later) on more than one group, as mentioned above. I've put out some feelers among my current friends and acquaintances, but nobody's really been excited about playtesting or even really giving in-depth feedback, and I don't want to be that person who's always shoving their project in your face. I'm willing to run something online as well. I'm also interested in having others run a game without me present, and giving me their feedback.  Also, I'm looking for something of a guide-type answer that might help someone besides just me. PHP: Split string into array, like explode with no delimiter How can I use a variable in the replacement side of the Perl substitution operator? Firstly, how do you gain the score exactly? I know it shows in the bar on the side of the map, but I remember a match where I was lone-wolfing and still got a pretty high score in that bar. I suppose my other squad members were together, but do I also gain for their work?  Also, does the score reset when I start a new game? I mean, I play support with the Offensive perk and it took me a long game of conquest to just unlock lvl-3 extra grenade. In the next match, that 'nade is gone. Don't I keep it forever? $\require{enclose}\enclose{horizontalstrike}{\rm Greatest}\!$ Least prime factor of $n$ is less than square root of $n$, proof I remember reading this somewhere but I cannot locate the proof. Financial proof to get a Schengen visa to France I am planning to apply for a Schengen visa to visit France. I have an attestation d'acceuil, but the visa requires I submit bank statement for the past 3 months. I can get this statement, but the problem is that my company has been paying my salary in cash for the past months, and I place the money into the account by myself.  Can I submit the following?   my accounting book (current account)  letter from the bank stating that I have money in it payslips for the past 3 months   Will that satisfy the financial requirements for the visa? How can I strike through an expression (e.g. "2x") obliquely, e.g. from bottom left to top right, so as to indicate cancellation? With the \sout command from the ulem package, I can only strike horizontally. is a one-by-one-matrix just a number (scalar)? I was wondering. Clearly, we cannot multiply a (1x1)-matrix with a (4x3)-matrix; However, we can multiply a scalar with a matrix. This suggests a difference.  On the other hand, I was, for example, in an econometrics lecture today, where we had for a (Tx1)-vector $\underline{û}=\left( \begin{array}{c} û_1\\ \vdots\\ û_T\end{array}\right)$:     $S_{ûû}:= \sum_{i=1}^T û_i^2$ shall be minimized. We see see that   $S_{ûû}=\underline{û}^T\underline{û}$.   Well, formally, shouldn't it be $(S_{ûû})=\underline{û}^T\underline{û}$ or $S_{ûû}=\det(\underline{û}^T\underline{û})$, to ensure that we stay in the space of matrices and not suddenly go to the space of scalars? So here, the professor (physicist) not only treats $\underline{û}^T\underline{û}$ like a scalar, but also calls it a scalar. Is this formally legit or a wrong simplification (though it does not seem to have any impact, and surely makes life easier)? Why does one often see "null != variable" instead of "variable != null" in C#? Without appealing to choice, can we prove that if $X$ is well-orderable, then so too is $2^X$? Without appealing to the axiom of choice, it can be shown that (Proposition:) if $X$ is well-orderable, then $2^X$ is totally-orderable.  Question: can we show the stronger result that if $X$ is well-orderable, then so too is $2^X$?  Proof of Proposition. Pick any well-ordering of $X$. Then the lexicographic order totally orders $2^X$.  More explicitly: for any two $f,g \in 2^X$, define $f &lt; g$ iff   there exists $x \in X$ such that $f(x) \neq g(x)$, and if $x \in X$ is minimal such that $f(x) \neq g(x)$, then $f(x)=0$ and $g(x)=1$.   It can be shown that $&lt;$ totally-orders $2^X$. If A and B play a game with a fair coin such that A wins by getting consecutive TT for the first time, while B wins by getting a consecutive TH.  Who has higher probability of winning the game?   I tried the following method but not sure:  For A to win,     TT, HTT, HHTT ... that is, 2-k for each game length k   For B to win,     TH, HTH, HHTH ... that is, 2-k for each game length k   So ultimately I am getting same probability of each to win. Objective-C Static Class Level variables Unable to open any graphical app with "sudo" Tried to find some answer here: , but it didn't solve my problem.  $ sudo gedit Failed to connect to Mir: Failed to connect to server socket: No such file or directory. Unable to init server: Could not connect: Connection refused.  (gedit:4574): Gtk-WARNING **: cannot open display:   only gedit in terminal works fine. This is my local computer, not a remote system. Is there a name based virtual host SSH reverse proxy? I've grown quite fond of HTTP reverse proxies in our development environment and found the DNS based virtual host reverse proxy quite useful. Having only one port (and the standard one) open on the firewall makes it much easier for management.  I'd like to find something similar to do SSH connections but haven't had much luck. I'd prefer not to simply use SSH tunneling since that requires opening port ranges other than the standard. Is there anything out there that can do this?  Could HAProxy do this? Moments of the truncated normal distribution (univariate) away from the mean Can we implement temporary automatic comment ban on 'x' number of validated rude comment flags? There's been problems with abusive comments since the site started.   We still haven't managed to conquer the issue.   Users can be issued chat bans and post bans. The API automatically bans IP addresses with validated spam flags. (Would it be difficult to implement comment bans? Would mods have the power to impose comment restrictions?).   Although comments have been classically referred to as second class citizens, rude comments on the site are the one place that is driving people away.   Can we implement temporary automatic comment ban on 'x' number of validated rude comment flags? It would probably be better if the exact heuristics were not disclosed publicly, much like the serial voting scripts  This question  was asked 7 years ago. Can we revisit it?  This question is related, but is asking for a more complex approach: bibtex and genitive / possessive 's: the proper way to obtain "Kuran's (1989) model" Is there an automatic way to attach a genitive apostrophe or " ' s " to an author's name?  Currently I use:  \citeauthor{kuran1989}'s \citeyear{kuran1989}   But since this comes up regularily I'd like to know whether there's a general solution. How can I search for special characters? Situation: It started out as me  for the literal string C-c in  but it ended up omitting the - sign and showing results which contained the strings C/C++ and C &amp; C++.  is an example of a post which contains that string of characters (yet fails to show up in the results).  Things I've tried:   post suggests that I can use the undocumented code: operator, but when I do that, it just wraps the whole term in double quotes like .  As @terdon in Unix &amp; Linux chat has , using this  does yield some relevant results, but it doesn't show me  that is supposed to be there. edit: It appears that the Symbolhound query no longer returns that result.  Finally,  says that you can search for literal characters, but as you can see:    Quoted phrases are exact matches except for case-sensitivity, for example, you can search  or .  The second example (symbols) leads to 0 results.  So by now I assume that the search engine has changed (but the old documentation still lingers on this site). Is there a method for me to search for strings that include special (or is it literal?) characters? Heres a picture. im making a body, and it seems to have flash in the middle. Man is sitting in his room and gets contradictory advice from two men from the future