Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7953837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:15:00+00:00 2026-06-04T03:15:00+00:00

I am trying to pull a timeline from yamba with an android application, but

  • 0

I am trying to pull a timeline from yamba with an android application, but whenever I run the program it fails with this error:

04-15 15:58:18.578: E/AndroidRuntime(5418): FATAL EXCEPTION: Thread-171
04-15 15:58:18.578: E/AndroidRuntime(5418): java.lang.NullPointerException
04-15 15:58:18.578: E/AndroidRuntime(5418):     at com.example.yamba.UpdaterService$1.run(UpdaterService.java:32)

The code is this:

package com.example.yamba;
import java.util.List;

import winterwell.jtwitter.Twitter;
import winterwell.jtwitter.Twitter.Status;
import winterwell.jtwitter.TwitterException;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

public class UpdaterService extends Service{
    static final String TAG = "UpdaterService";
    static final int DELAY = 30; //seconden
    Twitter twitter;

    @Override
    public void onCreate() {
        super.onCreate();
        Twitter twitter = new Twitter("student", "password");
        twitter.setAPIRootUrl("http://yamba.marakana.com/api");
        Log.d(TAG, "onCreated");
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        new Thread() {
            public void run() {
                try {
                    while(true) {
                        List<Status> timeline = twitter.getPublicTimeline();

                    for (Status status : timeline) {
                        Log.d(TAG, String.format("%s: %s", status.user.name,
                                status.text));
                        }

                        Thread.sleep(DELAY*1000);
                    }

                } catch (TwitterException e) {
                    Log.e(TAG, "Failed because of network error.", e);
                } catch (InterruptedException e) {
                    Log.d(TAG, "Updater interrupted", e);
                }
            }
        }.start();

        Log.d(TAG, "onStarted");
        return super.onStartCommand(intent, flags, startId);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.d(TAG, "onDestroyed");
    }


    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}

Where line 32 is: List<Status> timeline = twitter.getPublicTimeline();

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:15:02+00:00Added an answer on June 4, 2026 at 3:15 am

    You initialize a local instance of Twitter inside the onCreate method, so your class member stays null.

    Instead of

    Twitter twitter = new Twitter("student", "password");
    

    it should be

    twitter = new Twitter("student", "password");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pull two values from this Dictionary, But the values I'm getting
I am trying to pull dynamics from a load that I run using bash.
Trying to pull the text from a label on the page but it's not
I've been trying to pull a copy of my sqlite database from my android
I am trying to pull data from api cart but I am not experienced
I am trying to pull from my heroku remote, I get this message: >git
I am trying to pull data from DBF files into my program using C#.
I'm trying to pull in images from Flickr using the phpFlickr library but the
I'm trying to pull some results from a database but I guess I'm kind
Trying to pull information from a web page for use in a Android app.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.