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 7617875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:15:21+00:00 2026-05-31T03:15:21+00:00

I have a URL for a twitter feed and I have created a string

  • 0

I have a URL for a twitter feed and I have created a string from it and I want to put it in a JSONArray so I can call back the individual items. In this case – “text”.

Here’s the json

Here’s my code:

try {
   // Create a new HTTP Client
   DefaultHttpClient defaultClient = new DefaultHttpClient();
   // Setup the get request
   HttpGet httpGetRequest = new HttpGet(
         "https://api.twitter.com/1/statuses/user_timeline.json?screen_name=evostikleague&count=10");

   // Execute the request in the client
   HttpResponse httpResponse = defaultClient.execute(httpGetRequest);
   // Grab the response
   BufferedReader reader = new BufferedReader(new InputStreamReader(
         httpResponse.getEntity().getContent(), "UTF-8"));
   String json = reader.readLine();

   // Instantiate a JSON object from the request response
   JSONObject obj = new JSONObject(json);
   List<String> items = new ArrayList<String>();

   JSONArray jArray = obj.getJSONArray(json);

   for (int i = 0; i < jArray.length(); i++) {
      JSONObject oneObject = jArray.getJSONObject(i);
      items.add(oneObject.getString("text"));
      Log.i("items", "items");
   }

   setListAdapter(new ArrayAdapter<String>(this, R.layout.single_item,
         items));
   ListView list = getListView();
   list.setTextFilterEnabled(true);

   list.setOnItemClickListener(new OnItemClickListener() {

      public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
            long arg3) {
         // TODO Auto-generated method stub
         Toast.makeText(getApplicationContext(),
               ((TextView) arg1).getText(), 1000).show();
      }

   });

} catch (Exception e) {
   // In your production code handle any errors and catch the individual exceptions
   e.printStackTrace();
}
  • 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-31T03:15:22+00:00Added an answer on May 31, 2026 at 3:15 am

    You are trying to parse the response as JSONObject ({}), while it is a JSONArray ([]). You should probably remove the line:

    // Instantiate a JSON object from the request response
    JSONObject obj = new JSONObject(json);
    

    instead, you need:

    JSONArray jArray = new JSONArray(json);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a URL string in the following format. http://myserver.com/_layouts/feed.aspx?xsl=4&amp;web=%2F&amp;page=dda3fd10-c776-4d69-8c55-2f1c74b343e2&amp;wp=476f174a-82df-4611-a3df-e13255d97533 I want to replace
I have am reading a twitter feed in my iPhone application and can do
I have regexp for twitter profile url and someone's twitter profile url. I can
I have a twitter feed displaying my tweets on a page. I want to
couldn't find my solution. hope you can help. I want to have a url
I have a url string like this: http://www.google.com/cse?cx=017840637368510444960:ny1lmky7r-0&client=google-csbe&output=xml_no_dtd&q=simon+g I need to send this url
I have an url like this: http://www.w3schools.com/PHP/func_string_str_split.asp I want to split that url to
I have a table: name, date, url, no , url includes facebook,twitter,other . How
I have a page which open a new window with External Url (Twitter Authentication
Say, I have a direct URL to a Twitter post, like $url=http://twitter.com/#!/YourName/status/01234567890123456; or $url=http://twitter.com/YourName/status/01234567890123456;

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.