Note that there are some explanatory texts on larger screens.

plurals
  1. POConverting UNIX time from Android JSON feed
    primarykey
    data
    text
    <p>I know similar questions have been asked, but I haven't been able to find a solution that works for me. I've added the code I am using to call the JSON feed and display it in a ListAdapter. I need to get my fields "ShowDate" and "ShowStart" to display in a readable format, not UNIX. </p> <pre><code>public class Schedule extends ListActivity { protected EditText searchText; protected SQLiteDatabase db; protected Cursor cursor; protected TextView textView; protected ImageView imageView; protected ArrayList&lt;HashMap&lt;String, String&gt;&gt; myList; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.schedule); View layout = findViewById(R.id.gradiant); GradientDrawable gd = new GradientDrawable( GradientDrawable.Orientation.TOP_BOTTOM, new int[] { 0xFF95B9C7, 0xFF06357A }); gd.setCornerRadius(2f); layout.setBackgroundDrawable(gd); myList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); JSONObject jsonObjSend = new JSONObject(); JSONObject json = JSONfunctions .getJSONfromURL("MyAPIURL"); JSONArray current = json.getJSONArray("d"); for (int i = 0; i &lt; current.length(); i++) { HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); JSONObject e = current.getJSONObject(i); map.put("id", String.valueOf(i)); map.put("showid", "" + Html.fromHtml(e.getString("ShowID"))); map.put("name", "" + Html.fromHtml(e.getString("Title"))); map.put("showvenue", "" + e.getString("ShowVenue")); map.put("subtutle", "" + e.getString("SubTitle")); map.put("venueid", "" + e.getString("VenueID")); map.put("showdate", "" + e.getString("ShowDate")); map.put("showstart", "" + e.getString("ShowStart")); map.put("showend", "" + e.getString("ShowEnd")); map.put("image250", "" + e.getString("Image250")); map.put("aboutartist", "" + Html.fromHtml(e.getString("AboutArtist"))); myList.add(map); } } catch (JSONException e) { Log.e("log_tag", "Error parsing data " + e.toString()); } ListAdapter adapter = new SimpleAdapter(this, myList,R.layout.line_item, new String[] { "name", "showdate","showstart", "showvenue", "image250" }, new int[] { R.id.title, R.id.showdate,R.id.showstart,R.id.showvenue, R.id.list_image }); setListAdapter(adapter); final ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { HashMap&lt;String, String&gt; hashMap = myList.get(position); // hashMap.put("map", hashMap); Intent intent = new Intent(getApplicationContext(), ArtistDetails.class); intent.putExtra("map", hashMap); startActivity(intent); } }); } </code></pre> <p>Any suggestions or advice will be greatly appreciated. I've spent way too much time on this for something I assume is fairly simple. Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload