I have two activities lets say Level Activity and Result Activity, so what happens is when I go from level -> level1 -> result activity I check if the score is > 4 if it is I unlock the next level in level activity by simply removing an imageview on a button in level activity by doing something like this in Result Activity  SharedPreferences pref = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);         final int score111 = pref.getInt("score111", 0);         v1.setOnClickListener(new View.OnClickListener(){             @Override             public void onClick(View v) {                 startActivity(new Intent(ResultActivity2.this,Lyricswho.class));                 if (score111 &gt;= 4) {                                            Intent act2= new Intent(ResultActivity2.this,Lyricswho.class);                     act2.putExtra("hideImageView", true);                     startActivity(act2);                 }             }         });     }   and then in Level activity   if(score111 &gt;=4 ){                 hideImageView = getIntent().getExtras().getBoolean("hideImageView");             if (hideImageView) {                 v.setVisibility(View.INVISIBLE);             }         }   It works fine for the first time but when I restart the app by closing it down and go to Level Activity it crashes and goes back to previous activity. The reason as I have figured out is the hideImageView gives null pointer error when I restart the app because it satisfies the condition that is score is greater then 4 (which previously it doesn't because the score is 0 so the code doesn't go in if condition) but there is nothing in hideImageView so it throws null exception. I tried using boolean variable so that if condition is ran only once but then my imageview appears again so I can't use that. How can I solve this problem? Been stuck there for days.
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?
Paging Lucene's search results I am using Lucene to show search results in a web application.I am also custom paging for showing the same. Search results could vary from 5000 to 10000 or more. Can someone please tell me the best strategy for paging and caching the search results? Why is "No new release found" when upgrading from a LTS to the next? How do I configure Apache 2 to run Perl CGI scripts? I would like to configure Apache 2 running on Kubuntu to execute Perl CGI scripts. I've tried some steps that I came across by googling, but nothing seems to work.  What is the right way of achieving this? GParted can't resize partition, but unallocated partition is available I added a user to a group, but group permissions on files still have no effect I changed permissions of a file (chmod g+w testfile) and running ls -l testfile gives:  -rwxrwxr-x 1 user1 user1 0 2011-01-24 20:36 testfile   I then added a user to that group ("/etc/group" has user1:x:1000:user2 line), but am failing to edit that file as user2. Why is this so? Google Apps Script Javascript compatibility error I have successfully created . Handy to avoid multiple calls to GAS services whit ordinary getRange calls.  While the code perfectly works in javascript, it throws an error in Google Apps Script upon saving.  The offending code is:  return matrix.slice(startRow, endRow + 1).map(i =&gt; i.slice(startCol, endCol + 1))   GAS seems rejecting code in the .map function. Can I extend a class using more than 1 class in PHP? If I have several classes with functions that I need but want to store separately for organisation, can I extend a class to have both?  i.e. class a extends b extends c  edit: I know how to extend classes one at a time, but I'm looking for a method to instantly extend a class using multiple base classes - AFAIK you can't do this in PHP but there should be ways around it without resorting to class c extends b, class b extends a What is the equation for the tension on the ends of a cable suspended at different heights? I'm looking for an equation to find the tension on the ends of a cable suspended between two poles (one higher than the other) with no load but the cable itself.    I determined that the tension would be different on each end, that the shape of the suspended cable would be a  truncated at one end, and that the following would be the variables necessary in the equation:   cable weight cable length vertical distance between ends horizontal distance between ends   Some links that could be helpful: Query Activity for ORDER BY xxx DESC LIMIT I'm trying to create a query activity in order to show, from a Data Extension, only the last 5 articles ids. I tried with the formula ORDER BY xxx DESC LIMIT 0,5 as in SQL but it is not working and it is returning this exception:     The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified   How can I use ORDER BY in a Data Extension? Dealing with "java.lang.OutOfMemoryError: PermGen space" error Could it be that Goldbach conjecture is undecidable? Dynamic Comparison Operators in PHP What can I do if I forgot my Windows password? I got a brand new Windows 7 machine, installed the operating system, created one account and forgot its password. What can I do?  There is no external CD, the operating system is loaded from somewhere inside the machine.  I already tried to remember passwords and tried all candidates with all possible combinations of caps lock, num lock etc. How do I remove diacritics (accents) from a string in .NET? I'm trying to convert some strings that are in French Canadian and basically, I'd like to be able to take out the French accent marks in the letters while keeping the letter. (E.g. convert é to e, so crème brûlée would become creme brulee)  What is the best method for achieving this? Wirtinger Inequality: $\int_0^1 f'^2 \geq \pi^2 \int_0^1 f^2 $ I have a  basic question  Let $f$ be a $\mathcal{C}^1$  map  from  $[0,1]$ into $\mathbb{R}$ vanishing in $0$ and $1$. I want to prove that   $$\int_0^1 f'^2 \geq \pi^2 \int_0^1 f^2 $$  and to see when we have equality. How can I determine if it is possible to check luggage during a layover? A common desire among some travelers with long layovers is to leave the airport for a while, and perhaps do some shopping, or even buy goods in the airport.  But this then often necessitates the ability to check additional luggage during the layover, for the remainder of the journey.  There might be other reasons to want to check luggage mid-journey as well.  Are there any general rules one can use to determine whether this is an option in a given airport when traveling with a given airline, and the associated costs (when it is possible)? How do I install Java, including in my browser, so websites with Java work? Why don't I have this option?    here's my disk layout  sudo fdisk -l  Disk /dev/sda: 640.1 GB, 640135028736 bytes 255 heads, 63 sectors/track, 77825 cylinders, total 1250263728 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x5b53cc54     Device Boot      Start         End      Blocks   Id  System /dev/sda1   *        2048      409599      203776    7  HPFS/NTFS/exFAT /dev/sda2          409600  1153767021   576678711    7  HPFS/NTFS/exFAT /dev/sda3      1216962560  1250050047    16543744    7  HPFS/NTFS/exFAT /dev/sda4      1250050048  1250261679      105816    c  W95 FAT32 (LBA)  Disk /dev/sdb: 4005 MB, 4005527552 bytes 32 heads, 63 sectors/track, 3880 cylinders, total 7823296 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x20d8782d     Device Boot      Start         End      Blocks   Id  System /dev/sdb1   *          63     7822079     3911008+   c  W95 FAT32 (LBA) How do I pass parameter TO a Visualforce page from a link in an email? Here's what I am trying to do:  1) User creates record A.  2) Time-based workflow sends an email to the Record A creator based on a date field in the record.  3) The email template has a URL link.  4) The URL links to a Visualforce page that is basically a form with fields to be filled out (this Visualforce page is in a managed package) and a save button that creates a new User record.  5) When the User clicks the URL link in the email, the Visualforce page opens in a new window.  6) I would like to pass the values of the fields in record A to pre-fill the Visualforce page fields.   Here's my link:  &lt;a href="https://cs19.visual.force.com/apex/CloneThisUser?Desktop=true&amp;Id={!Pending_User__c.User_to_CloneId__c}&amp;formGroupInputSmall={!Pending_User__c.First_Name__c}   And here's the code from the relevant section of the Visualforce page:  &lt;div class="form-group form-group-sm"&gt;       &lt;!-- &lt;apex:outputLabel styleClass="col-sm-2 control-label" for="formGroupInputSmall"&gt;First Name&lt;/apex:outputLabel&gt; --&gt;       &lt;div class="col-xm-11 col-sm-12"&gt;           &lt;apex:inputField html-placeholder="First Name" styleClass="form-control FirstNameInput"  value="{!u.FirstName}" id="formGroupInputSmall"/&gt;       &lt;/div&gt;     &lt;/div&gt;   I have only included the first field I would like to pass the parameter to, in order to keep this post simple.   The link passes the User_to_Clone_Id__c just fine but does not fill in the "First Name" field with the value of the First_Name__c .  What am I doing incorrectly? Thanks. Discord suddenly very slow