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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:35:52+00:00 2026-05-23T03:35:52+00:00

My android app is supposed to go through twitter using twitter4j libraries, and return

  • 0

My android app is supposed to go through twitter using twitter4j libraries, and return a bunch of tweets with the keyword you search. The app doesn’t crash like it used to, but it is also bugged somehow to where it doesn’t print out anything.

Here is the code:

package com.SMARTlab.twitterapp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import twitter4j.*;

public class TwitterApp extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button search = (Button)findViewById(R.id.search_button);
        search.setOnClickListener(search_OnClickListener);
    }
    public void onClick(View v)
    {
        switch (v.getId())
        {
        case R.id.search_button:
            Intent i = new Intent(this, com.SMARTlab.twitterapp.TwitterApp.class);
            startActivity(i);
            break;

        }
    }

    @SuppressWarnings("deprecation")
    private Button.OnClickListener search_OnClickListener = new Button.OnClickListener()
    {
        @Override 
        public void onClick(View v)
        {
            Twitter t = new TwitterFactory().getInstance();
            EditText ed = (EditText)findViewById(R.id.search_box);
        TextView txt = (TextView)findViewById(R.id.text_box);
        Query q = new Query(ed.getText().toString());
        QueryResult res = null;
        try
        {
            res = t.search(q);
            txt.setText("");

        }
        catch(TwitterException ex) {System.out.println(ex.toString());}
        for (Tweet tw : res.getTweets())
        {
            try
            {
                long[] id = t.getRetweetedByIDs(tw.getId()).getIDs();
                for (int x = 0; x < id.length; x++)
                    queryRank += 1;
            } catch(TwitterException te) {}
            if (evaluateRank(queryRank))
            {
                txt.append((String)"[" + tw.getFromUser() + "] " + tw.getText() + "\n");
                }
            }

        }
        int queryRank = 0;
        private boolean evaluateRank(int rank)
        {
            if (rank > 10)
                return true;
            return false;
        }
    };
}

Here is the AndroidMnifest.xml file’s contents just in case you need it:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.SMARTlab.twitterapp"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="8" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".TwitterApp"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

</application>

And here is the LogCat:

06-13 09:35:42.036: DEBUG/AndroidRuntime(425): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
06-13 09:35:42.036: DEBUG/AndroidRuntime(425): CheckJNI is ON
06-13 09:35:42.255: DEBUG/AndroidRuntime(425): --- registering native functions ---
06-13 09:35:43.076: DEBUG/AndroidRuntime(425): Shutting down VM
06-13 09:35:43.076: DEBUG/dalvikvm(425): Debugger has detached; object registry had 1 entries
06-13 09:35:43.116: INFO/AndroidRuntime(425): NOTE: attach of thread 'Binder Thread #3' failed
06-13 09:35:43.625: DEBUG/AndroidRuntime(433): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
06-13 09:35:43.635: DEBUG/AndroidRuntime(433): CheckJNI is ON
06-13 09:35:43.855: DEBUG/AndroidRuntime(433): --- registering native functions ---
06-13 09:35:44.645: INFO/ActivityManager(59): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.SMARTlab.twitterapp/.TwitterApp }
06-13 09:35:44.705: INFO/ActivityManager(59): Start proc com.SMARTlab.twitterapp for activity com.SMARTlab.twitterapp/.TwitterApp: pid=439 uid=10040 gids={}
06-13 09:35:44.755: DEBUG/AndroidRuntime(433): Shutting down VM
06-13 09:35:44.765: DEBUG/dalvikvm(433): Debugger has detached; object registry had 1 entries
06-13 09:35:44.825: INFO/AndroidRuntime(433): NOTE: attach of thread 'Binder Thread #3' failed
06-13 09:35:46.026: INFO/ActivityManager(59): Displayed activity     com.SMARTlab.twitterapp/.TwitterApp: 1329 ms (total 1329 ms)
06-13 09:35:51.135: DEBUG/dalvikvm(123): GC_EXPLICIT freed 230 objects / 9920 bytes in 75ms
06-13 09:36:51.735: WARN/KeyCharacterMap(439): No keyboard for id 0
06-13 09:36:51.735: WARN/KeyCharacterMap(439): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
06-13 09:36:57.306: INFO/System.out(439): Permission deniedRelevant discussions can be on the Internet at:
06-13 09:36:57.306: INFO/System.out(439):     http://www.google.co.jp/search?q=d35baff5 or
06-13 09:36:57.316: INFO/System.out(439):     http://www.google.co.jp/search?q=08a954d5
06-13 09:36:57.316: INFO/System.out(439): TwitterException{exceptionCode=[d35baff5-08a954d5 43208640-0c814192], statusCode=-1, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.3}
06-13 09:36:57.316: DEBUG/AndroidRuntime(439): Shutting down VM
06-13 09:36:57.326: WARN/dalvikvm(439): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
06-13 09:36:57.336: ERROR/AndroidRuntime(439): FATAL EXCEPTION: main
06-13 09:36:57.336: ERROR/AndroidRuntime(439): java.lang.NullPointerException
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at com.SMARTlab.twitterapp.TwitterApp$1.onClick(TwitterApp.java:50)
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at android.view.View.performClick(View.java:2408)
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at android.view.View$PerformClick.run(View.java:8816)
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at android.os.Handler.handleCallback(Handler.java:587)
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at android.os.Handler.dispatchMessage(Handler.java:92)
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at android.os.Looper.loop(Looper.java:123)
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at android.app.ActivityThread.main(ActivityThread.java:4627)
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at java.lang.reflect.Method.invokeNative(Native Method)
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at java.lang.reflect.Method.invoke(Method.java:521)
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-13 09:36:57.336: ERROR/AndroidRuntime(439):     at dalvik.system.NativeStart.main(Native Method)
06-13 09:36:57.356: WARN/ActivityManager(59):   Force finishing activity com.SMARTlab.twitterapp/.TwitterApp
06-13 09:36:57.875: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{45050718 com.SMARTlab.twitterapp/.TwitterApp}
06-13 09:37:00.995: INFO/Process(439): Sending signal. PID: 439 SIG: 9
06-13 09:37:01.015: INFO/ActivityManager(59): Process com.SMARTlab.twitterapp (pid 439) has died.
06-13 09:37:01.015: INFO/WindowManager(59): WIN DEATH: Window{4503edf8 com.SMARTlab.twitterapp/com.SMARTlab.twitterapp.TwitterApp paused=false}
06-13 09:37:01.085: WARN/InputManagerService(59): Got RemoteException sending setActive(false) notification to pid 439 uid 10040

Please help! Thank you in advance for your answers! 🙂

  • 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-23T03:35:52+00:00Added an answer on May 23, 2026 at 3:35 am

    You shouldn’t just catch NullPointerExceptions and TwitterExceptions then do nothing in your catch block. The chances are that your code is failing and all you are effectively doing is preventing the cause from being reported. Remove your try/catch blocks which are catching and suppressing these exceptions and then work out what is causing them to be thrown. I would guess that once you fix your the root causes of these exceptions then things may start working.

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

Sidebar

Related Questions

My Android App has 2 activities. A login screen and a search screen. When
I'm developing an android app that has a bunch of screens (activities) that are
I'm building an Android app and I want to copy the text value of
I'm building a mobile web app targeting Android users. I need to know what
I have a new android app I put on the marketplace a few days
My android app fetches a JSON structure from the net. It's somewhat large, maybe
I want to update a Application on Android App Market but the problem is
I have three activities in my android app. First activity is main application screen
I thought I'd have a crack at building an Android app having not done
In my Android app I use a TabWidget without any special customization. I'd like

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.