getting NullPointerException while setting custom adapter to listview. my ListView is in Fragment. ............................................................................................................................................  Class 1:  public class Fragment_chats extends Fragment { ListView lv;     String[] namem={"Gauri","Jayesh","Nitya","Rupali","Lalit","Poonam"};     Integer[] imgm=    {R.mipmap.a,R.mipmap.b,R.mipmap.c,R.mipmap.d,R.mipmap.e,R.mipmap.f};  public Fragment_chats() {     // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);      }   @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,                          Bundle savedInstanceState) {     // Inflate the layout for this fragment super.onCreate(savedInstanceState);    View v= inflater.inflate(R.layout.fragment_fragment_chats, container, false);     lv=(ListView)getActivity().findViewById(R.id.lv);     customList cl=new customList(getActivity(),imgm,namem);     lv.setAdapter(cl);     return v; }  }   Class 2:  class customList extends ArrayAdapter {     Activity act;     String[] na;     Integer[] img; public customList(Activity context, Integer[] resource, String[] objects) {     super(context, R.layout.chats, objects);     act=context;     na=objects;     img=resource;  } @Override public View getView(int position, View convertView, ViewGroup parent) {     if (convertView == null)     {         convertView = View.inflate (act,R.layout.chats, null);     }     ImageView iv= (ImageView) convertView.findViewById(R.id.imageView);     TextView name=(TextView)convertView.findViewById(R.id.textView1);     TextView chat=(TextView)convertView.findViewById(R.id.textView2);     iv.setImageResource(img[position]);     name.setText(na[position]);     chat.setText("chat");      return convertView; } }   Custom layout is R.layout.chats and  fragment layout is R.layout.fragment_fragment_chats
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?
What does outputting to /dev/null accomplish in bash scripts? 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. It is written everywhere that gravity is curvature of spacetime caused by the mass of the objects or something to the same effect. This raises a question with me: why isn't spacetime curved due to other forces or aspects of bodies?  Why isn't it that there are curvatures related to the charge of a body or the spin of particles or any other characteristics? Changing the homepage Is it possible to change the Home page so it's not a blog, but a page? And also is it possible to change the name of the homepage?  If yes, how is this done?  Thanks, Richard What exactly did mv /tmp/folder/* /* do to my filesystem? It's hard to search for special characters on google, which is why I'm posting this here.  I recently ran (as root) a mv /tmp/folder/* /* when I meant to run mv /tmp/folder/* ./ Big mistake!  Things broke! A lot of files got mixed up and placed into strange places, none of the normal unix commands worked (ls, dir, cat, etc) and once you logged off, you couldn't ssh back in -- it would give you a prompt, but not accept the old passwords.  Running ls /* shows me that it performs ls on every directory in /. If I tried to draw a parallel, then mv should have simply moved (or copied?) the files to every directory in /. Instead, really weird things happened, and I was just curious what exactly was going on.  More info: The files in /tmp/folder had been transferred from a windows machine, and had been named file (#).txt, where (#) is a number up to two digits, with a space between file and the parenthesis. There were ~40 of these text files. Is it ever acceptable for a period to come after a quote at the end of a sentence? Today I was going through my text book exercise and got hold of the following question.     Let $X$ be a normed linear space with norm $\lVert\cdot\rVert$ and $A$ is a non empty convex subset of $X$ then prove that $\operatorname{Closure}(A)$ is also a convex subset of $X$.   I gave it a try but could not succeed. I have an existing trigger which converts leads into peron accounts if the company name is blank.  Trigger AutoConvert on Lead (after insert) {      LeadStatus convertStatus = [           select MasterLabel           from LeadStatus           where IsConverted = true           limit 1      ];      List&lt;Database.LeadConvert&gt; leadConverts = new List&lt;Database.LeadConvert&gt;();       for (Lead lead: Trigger.new) {           if (!lead.isConverted &amp;&amp; lead.Company == null) {                Database.LeadConvert lc = new Database.LeadConvert();                String oppName = lead.Name;                 lc.setLeadId(lead.Id);                lc.setDoNotCreateOpportunity(true);                lc.setConvertedStatus(convertStatus.MasterLabel);                 leadConverts.add(lc);           }      }       if (!leadConverts.isEmpty()) {           List&lt;Database.LeadConvertResult&gt; lcr = Database.convertLead(leadConverts);      } }   I need to also write a trigger that stops records from coming into Salesforce if that email already exisits in a contact or an account (we use person accounts).  The issue is how do I get it working with the existing trigger (I need it to run before the trigger that converts it into a person account is run).   Is there a way to combine the two or add the functionality to create the record only if the email address doesn't already exist as a contact in the org? Setting the pivot point of an object I have a sword that currently rotates around a pivot point thats off of the actual object. Im new to blender and im not sure how i would go about changing it so that the sword rotates around the handle. Any help would be appreciated! induction with 2 recursive sequnces I'm having trouble solving this problem. I have relation for two sequences of natural numbers.   $$a(n)+\sqrt3\cdot b(n)=\left(1+\sqrt3\right)^n$$  and I have to prove that recursions:  $$\begin{align*} &amp;a(n+1)=a(n)+3b(n)\\ &amp;b(n+1)=a(n)+b(n) \end{align*}$$  will satisfy relation mentioned above. I tried solve it using induction but I failed. Can anybody help with some other ideas? I was wondering if someone knows if there is a foot/feet symbol available in any of latex packages that I could use in my text? I would appreciate any hint.  I do really mean a foot/feet icon as in the picture below. Auto comment "possible duplicate of ..." missing on voting to close as duplicate typeof is an operator and a function How to parseInt a string with leading 0 Code snippet comments in code formatting break the formatting of the post Do we need to unbind event listeners in directives when angular starts to destroy? Terminal, how to quit --More-- list Let $f: M \to N$ be a mono in $\mathsf{Mon}$. I want to prove that the underlying function $U(f): U(M) \to U(N)$ is injective.   How can this be done ? Thanks in advance. I can't install software-center on Kali Many questions already ask about this topic ( , , etc.) and their answers vary, but they always give exceptions to the apostrophe-s rule, for example:      6.24 The general rule for the possessive of nouns covers most proper nouns, including most names ending in sibilants."   Examples they give include Kansas’s, Ross’s land, and Jones’s reputation. Exceptions include Jesus’  and Moses’.  Which names does this apply to?  Is the Aeneas’  form correct, or is it Aeneas’s instead?