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

  • Home
  • SEARCH
  • 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 7409975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:09:44+00:00 2026-05-29T06:09:44+00:00

Actually, I am facing a problem in Android. I am creating an application that

  • 0

Actually, I am facing a problem in Android. I am creating an application that connects to a Twitter like app called Status.Net. I have created an account in this site with my own username and password. Now the application which I have created, connects to this Status.Net site. Originally, this android application was picked up from one of the learning android website called Learning Android by Marko Gargenta and I have downloaded the source code from its git. I am creating my own version of this application by specifying a different API root as farmnews.aaditech.com/api (originally the API root was http://yamba.marakana.com/api). The code with original API root was working fine. It updated the status in yamba.marakana.com and the status is shown in the timeline too. But when I specify my own API root, it just updates into the status.net and shows a toast message “Failed To Post” which should not be bcoz it is obviously posting on the status.net. I don’t knw wht is the problem. But I know if I just change one line of the API root, everything will be working fine.

YambaApplication.java

package com.marakana.yamba8;

import java.util.List;

import winterwell.jtwitter.Twitter;
import winterwell.jtwitter.Twitter.Status;
import android.app.Application;
import android.content.ContentValues;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;

public class YambaApplication extends Application implements
OnSharedPreferenceChangeListener {
private static final String TAG = YambaApplication.class.getSimpleName();
public static final String LOCATION_PROVIDER_NONE = "NONE";
public static final long INTERVAL_NEVER = 0;
public Twitter twitter;
private SharedPreferences prefs;
private StatusData statusData;
private boolean serviceRunning;
private boolean inTimeline;

@Override
public void onCreate() {
super.onCreate();
this.prefs = PreferenceManager.getDefaultSharedPreferences(this);
this.prefs.registerOnSharedPreferenceChangeListener(this);
this.statusData = new StatusData(this);
Log.i(TAG, "Application started");
}

public synchronized Twitter getTwitter() {
 if (this.twitter == null) {
   String username = this.prefs.getString("username", null);
   String password = this.prefs.getString("password", null);
   //String url = this.prefs.getString("url",
   //  "http://yamba.marakana.com/api");
   String url = this.prefs.getString("url",
   "http://farmnews.aaditech.com/index.php/api"); //1
   //String url = this.prefs.getString("url",
   //"http://identi.ca/api");
   //String url = this.prefs.getString("url",
   //"http://farmnews.aaditech.com");

    if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password)
      && !TextUtils.isEmpty(url)) {
      this.twitter = new Twitter(username, password);
      this.twitter.setAPIRootUrl(url);
    }
  }
  return this.twitter;
}

 public boolean startOnBoot() {
   return this.prefs.getBoolean("startOnBoot", false);
 }

 public StatusData getStatusData() {
   return statusData;
 }

  public synchronized int fetchStatusUpdates() {
    Log.d(TAG, "Fetching status updates");
    Twitter twitter = this.getTwitter();
    if (twitter == null) {
    Log.d(TAG, "Twitter connection info not initialized");
    return 0;
  }
  try {
    List<Status> statusUpdates = twitter.getFriendsTimeline();
    long latestStatusCreatedAtTime = this.getStatusData()
      .getLatestStatusCreatedAtTime();
    int count = 0;
    ContentValues values = new ContentValues();
    for (Status status : statusUpdates) {
      values.put(StatusData.C_ID, status.getId());
      long createdAt = status.getCreatedAt().getTime();
      values.put(StatusData.C_CREATED_AT, createdAt);
      values.put(StatusData.C_TEXT, status.getText());
      values.put(StatusData.C_USER, status.getUser().getName());
      Log.d(TAG, "Got update with id " + status.getId() + ". Saving");
      this.getStatusData().insertOrIgnore(values);
      if (latestStatusCreatedAtTime < createdAt) {
       count++;
      }
     }
    Log.d(TAG, count > 0 ? "Got " + count + " status updates"
      : "No new status updates");
    return count;
    } catch (Exception e) {
    Log.e(TAG, "Failed to fetch status updates", e);
    return 0;
   }
 }

  public synchronized void onSharedPreferenceChanged(
    SharedPreferences sharedPreferences, String key) {
    this.twitter = null;
  }

  public boolean isServiceRunning() {
     return serviceRunning;
  }

  public void setServiceRunning(boolean serviceRunning) {
    this.serviceRunning = serviceRunning;
  }

  public boolean isInTimeline() {
     return inTimeline;
  }

  public void setInTimeline(boolean inTimeline) {
     this.inTimeline = inTimeline;
  }

  public String getProvider() {
     return prefs.getString("provider", LOCATION_PROVIDER_NONE);
  }

  public long getInterval() {
     // For some reason storing interval as long doesn't work
     return Long.parseLong(prefs.getString("interval", "0"));
  }

  @Override
  public void onTerminate() {
  super.onTerminate();
  this.statusData.close();
  Log.i(TAG, "Application terminated");
  }
}

DDMS LogCat

    10-28 00:36:04.964: ERROR/YambaApplication(844): Failed to fetch status updates
10-28 00:36:04.964: ERROR/YambaApplication(844): winterwell.jtwitter.TwitterException: org.json.JSONException: No value for profile_background_color
10-28 00:36:04.964: ERROR/YambaApplication(844):     at winterwell.jtwitter.Twitter$User.<init>(Twitter.java:693)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at winterwell.jtwitter.Twitter$Status.<init>(Twitter.java:464)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at winterwell.jtwitter.Twitter$Status.getStatuses(Twitter.java:342)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at winterwell.jtwitter.Twitter.getStatuses(Twitter.java:1691)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at winterwell.jtwitter.Twitter.getFriendsTimeline(Twitter.java:1454)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at com.marakana.yamba8.YambaApplication.fetchStatusUpdates(YambaApplication.java:73)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at com.marakana.yamba8.UpdaterService.onHandleIntent(UpdaterService.java:35)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:59)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at android.os.Looper.loop(Looper.java:123)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at android.os.HandlerThread.run(HandlerThread.java:60)
10-28 00:36:04.964: ERROR/YambaApplication(844): Caused by: org.json.JSONException: No value for profile_background_color
10-28 00:36:04.964: ERROR/YambaApplication(844):     at org.json.JSONObject.get(JSONObject.java:354)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at org.json.JSONObject.getString(JSONObject.java:510)
10-28 00:36:04.964: ERROR/YambaApplication(844):     at winterwell.jtwitter.Twitter$User.<init>(Twitter.java:660)
10-28 00:36:04.964: ERROR/YambaApplication(844):     ... 10 more

I tried using the other API root URL http://identi.ca/api but it does not seem to be working

Please help me out

Regards and Thanks
Sohaib Rahman

  • 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-05-29T06:09:44+00:00Added an answer on May 29, 2026 at 6:09 am

    I’ve had the same problem, the identi.ca API doesn’t appear to return values for:

    profile_background_color
    profile_link_color
    profile_text_color
    profile_sidebar_fill_color
    profile_background_tile

    But the customised JTwitter library supplied by the book’s author expects the API to return values for them and when it doesn’t find them, it throws a org.json.JSONException wrapped up in a winterwell.jtwitter.TwitterException.

    I’ve downloaded the source for the library from:

    https://github.com/marakana/LearningAndroidYamba/tree/master/JTwitterYamba

    and updated the library by commenting out the relevant lines for those items listed above. This has solved the problem for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing to android application signing problem. My application contains Google MapView. When
I have facing problem in scrolling webview in verticlly, actually i have scroll view
I'm facing a very strange problem in my ASP.NET Application. When the user clicks
I am facing a problem in Frame by Frame animation in Android . Actually
I am facing problem when i run my app on Device connected to my
I am facing some problem with MySQL database. actually It was fast when I
I am facing a problem while making Excel's LinEST function. My program goes like
I'm trying to create an Android app that searches for a certain type of
I am facing a problem with installing tomcat. I have a xampp server which
I'm facing a simple problem I would like to get a local path from

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.