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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:01:33+00:00 2026-06-15T08:01:33+00:00

I am creating an android app for my facebook page. The app is supposed

  • 0

I am creating an android app for my facebook page. The app is supposed to display random statuses(not just the recent ones) from the facebook page. Is there anyway I could do this?

  • 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-15T08:01:34+00:00Added an answer on June 15, 2026 at 8:01 am

    I haven’t done anything of that kind ever, but I think you can gran some logic from this and get it to work.

    Step 1:

    Make a call to the Facebook API, get all Status Updates and in a for loop, add them to an ArrayList<String>. For example, Facebook returns its data in JSON format. I am assuming, you already know how to fetch data. You need to parse the “message” tag from the JSON data returned by your Facebook API call.

    For example:

    ArrayList<String> arrStatusMessage;
    
    
    for (int i = 0; i < JAFeeds.length(); i++)  {
        JSONObject JOFeeds = JAFeeds.getJSONObject(i);
    
        if (JOFeeds.has("message")) {
            String strStatusMessage = JOFeeds.getString("message");
            arrStatusMessage.add(strStatusMessage );
        }
    }
    

    Step 2:

    Once you have your entire set of Facebook Status Messages, you will now need to use a java.util.Random instance.

    For example: (Please note: I have not tested this code and it might result in errors. You may have to play around with it a bit to get it to work. 🙁 )

    private static final Random randomGenerator = new Random();
    
    
    int intRandom = randomGenerator.nextInt(arrStatusMessage.size());
    String strRandomStatus = arrStatusMessage.get(intRandom);
    

    Step 3:

    Use the strRandomStatus to set it on a TextView.

    For example:

    TextView txtRanStatus = (TextView) findViewById(R.id.txtRanStatus);
    txtRanStatus.setText(strRandomStatus);
    

    You haven’t posted any code, so it is difficult to provide something that fits in your scheme of things. But I think this should get you started. You will, possibly, need to adapt a few things and fit them in your own code.

    Hope this helps.

    EDIT: As per a comment by th OP, adding some bits of code to fetch Facebook Status Messages:

    in your onCreate() method:

    Start a new AsyncTask:

    new getFacebookFeeds().execute();
    

    I use this method in my app to make the Facebook Call to get all feeds from the Graph API.

    private class getFacebookFeeds extends AsyncTask<Void, Void, Void>  {
        @Override
        protected Void doInBackground(Void... params) {
            String URL = "https://graph.facebook.com/me/home&access_token=ACCESS_TOKEN?limit=10";
            try {
                HttpClient hc = new DefaultHttpClient();
                HttpGet get = new HttpGet(URL);
                HttpResponse rp = hc.execute(get);
    
                if (rp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                    String result = EntityUtils.toString(rp.getEntity());
    
                    // GET THE INTIAL RESULTS JSON ROOT
                    JSONObject JORoot = new JSONObject(result);
    
                    // GET THE "DATA" TAG FOR FEEDS ROOT
                    JSONArray JAFeeds = JORoot.getJSONArray("data");
    
                    for (int i = 0; i < JAFeeds.length(); i++) {
                        JSONObject JOFeeds = JAFeeds.getJSONObject(i);
    
                        if (JOFeeds.has("message")) {
                            String strStatusMessage = JOFeeds.getString("message");
                            arrStatusMessage.add(strStatusMessage );
                        }
                    }
                }
            } catch (Exception e) {
                // TODO: handle exception
            }
        }
    
    }
    

    You can do the remaining code, where you select a random Status Update, in the onPostExecute() of the AsyncTask shown above:

    @Override
    protected void onPostExecute(Void result) {
        int intRandom = randomGenerator.nextInt(arrStatusMessage.size());
        String strRandomStatus = arrStatusMessage.get(intRandom);
    
        txtRanStatus.setText(strRandomStatus);
    
    }
    

    Declare the TextView as a Global Variable and cast it on your onCreate() before calling the AsyncTask. I think this should work just fine. Let me know how it goes. 🙂

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

Sidebar

Related Questions

if yes, is there a tutorial available for creating an android app using the
Possible Duplicate: Creating and managing a Facebook app from a Business Account I know
I'm creating an android app where user loads some data from an online server
I'm creating an Android app and am wondering if there is anything special I
I am creating an Android app to help actors rehearse from a script. The
I'm creating a global Facebook object (from android-facebook-sdk) to be able to share it
I am creating an app for android that uses the facebook login. My question
I'm creating an Android app which must do some web surfing in the background
I am creating an android app myself (min sdk version 7 or 2.1 and
I am creating an Android app based on The Legend of Zelda, I wanted

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.