android - CodeLearn Twitter Tutorial nullpointer error on TweetAdapter.java -


I am currently doing codelearn Twitter tutorial but I am getting a zero point in my code below - someone please help Can I?

Public Category TweetAdapter ArrayAdapter Expanded & lt; Tweet & gt; {Private LayoutsInflator Inflator; Private Arrestist & lt; Tweet & gt; TweetsList; Public Tweak Adapter (activity activity, list & lt; Tweet & gt; Tweets) {super (activity, R.Lateout.ORT, Tweets); TweetsList = (Arrayist & lt; Tweet & gt;) Tweets; Inflater = activity.getWindow (). GetLayoutInflater (); } @ Override public view getView (integer position, seeviewview, ViewGroup parents) {Tweet t = tweetsList.get (status); *** TextView Title = (TextView) ConvertviewFindvubid (RIDTTT); *** TextView Body = (TextView) ConvertviewFindViewID (RTDBBB); Title.setText (t.getTitle ()); Body.setText (t.getBody ()); Return inflater.inflate (R.layout.row_tweet, guardian, incorrect); }

}

your convertView It can be redundant, there is no guarantee that it will be non-null. If there is no old view to reuse, then it will be empty

Change

  public view getView (see the status of int, seeviewview, ViewGroup parent) {Tweet t = tweetsList.get (terms); *** TextView Title = (TextView) ConvertviewFindvubid (RIDTTT); *** TextView Body = (TextView) ConvertviewFindViewID (RTDBBB); Title.setText (t.getTitle ()); Body.setText (t.getBody ()); Return inflater.inflate (R.layout.row_tweet, guardian, incorrect); }  
  see public getView (see the status of int, viewview, parent ViewGroup) {if (convertView == null) convertView = inflater.inflate ( R.layout.row_tweet, guardian, incorrect); Tweet t = tweetsList.get (status); *** TextView Title = (TextView) ConvertviewFindvubid (RIDTTT); *** TextView Body = (TextView) ConvertviewFindViewID (RTDBBB); Title.setText (t.getTitle ()); Body.setText (t.getBody ()); Return Convertview; }  

You have to check whether convertView is non-null and if it is null

You should also take a look at

.

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -