Hi, i am extremely new to Android Development.
I have a little bit of coding background, but its very little.
Right now, i am working on an application that connects to Facebook and 
after login succesful it shows a simplified "feed" of a page. (this because 
i want to make something personal that notifies me when a page-update has 
been made)
I have all of the feeds working, but the "Created_Time" is really troubling 
me and i do not know how to change my code in such a way it starts to read 
MM-DD-YYYY
I have tried all possible codes from many websites, but i am stuck.

Can someone help me where i should post the code and what kind of code for 
using simple date format?
This is called PageFeed.class
If i need to add MainActivity.class as well just let me know.

package com.sg.app.edupoint;

        import android.content.Intent;
        import android.net.Uri;
        import android.os.Bundle;
        import android.support.design.widget.FloatingActionButton;
        import android.support.design.widget.Snackbar;
        import android.support.v7.app.AppCompatActivity;
        import android.view.View;
        import android.widget.ArrayAdapter;
        import android.widget.ListView;

        import com.google.android.gms.appindexing.Action;
        import com.google.android.gms.appindexing.AppIndex;
        import com.google.android.gms.common.api.GoogleApiClient;

        import org.json.JSONArray;
        import org.json.JSONException;
        
        import java.util.ArrayList;
        
public class PageFeed extends AppCompatActivity {
    
        /**
     * ATTENTION: This was auto-generated to implement the App Indexing API.
     * See https://g.co/AppIndexing/AndroidStudio for more information.
     */
    private GoogleApiClient client;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pagefeed);

        Intent MyIntent = getIntent();
        String jsondata = MyIntent.getStringExtra("jsondata"); // receiving 
data from  MainActivity.java
        
        JSONArray pagefeed;
        ArrayList<String> feeds = new ArrayList<String>();
        try {
            pagefeed = new JSONArray(jsondata);
            for (int l = 0; l < pagefeed.length(); l++) {

                feeds.add(pagefeed.getJSONObject(l).getString("created_time"));
                feeds.add(pagefeed.getJSONObject(l).getString("message"));
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

        // adapter which populate the feeds in listview
        ArrayAdapter adapter = new ArrayAdapter<String>(this, 
R.layout.activity_listview, feeds);

        ListView listView = (ListView) findViewById(R.id.listView);
        listView.setAdapter(adapter);

        FloatingActionButton fab = (FloatingActionButton) 
findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Refresh List", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
        // ATTENTION: This was auto-generated to implement the App Indexing API.
        // See https://g.co/AppIndexing/AndroidStudio for more information.
        client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
    }

    @Override
    public void onStart() {
        super.onStart();
        client.connect();
        Action viewAction = Action.newAction(
                Action.TYPE_VIEW, // TODO: choose an action type.
                "PageFeed Page", // TODO: Define a title for the content shown.
                Uri.parse("http://host/path";),
                Uri.parse("android-app://com.sg.app.edupoint/http/host/path")
        );
        AppIndex.AppIndexApi.start(client, viewAction);
    }

    @Override
    public void onStop() {
        super.onStop();
        Action viewAction = Action.newAction(
                Action.TYPE_VIEW, // TODO: choose an action type.
                "PageFeed Page", // TODO: Define a title for the content shown.
                Uri.parse("http://host/path";),
                Uri.parse("android-app://com.sg.app.edupoint/http/host/path")
        );
        AppIndex.AppIndexApi.end(client, viewAction);
        client.disconnect();
    }
}



-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/83a21363-75fe-4b7b-a615-f43640880a21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to