Source

reddit-sl4a / reddit-sl4a.py

Full commit
import android,simplejson,urllib

droid = android.Android()
droid.dialogCreateSpinnerProgress("loading")
droid.dialogShow()
result = simplejson.load(urllib.urlopen('http://www.reddit.com/.json'))
list = []
list_url = []
list_pl = []
list_nc = []
list_sc = []

for k in result['data']['children']:
  list.append(k['data']['title'])
  list_url.append(k['data']['url'])
  list_pl.append(k['data']['permalink'])
  list_nc.append(k['data']['num_comments'])
  list_sc.append(k['data']['score'])

def show(list, list_url):
  droid.dialogCreateAlert('reddit')
  droid.dialogSetItems(list)
  droid.dialogShow()
  response = droid.dialogGetResponse().result
  droid.dialogCreateAlert(list[response["item"]])
  droid.dialogSetItems(["Link", "Comments" + " ("+str(list_nc[response["item"]])+")"])
  droid.dialogShow()
  response2 = droid.dialogGetResponse().result
  if(response["item"] == 0):
    droid.webViewShow(list_url[response["item"]], True)
  else:
    droid.webViewShow("http://i.reddit.com"+list_pl[response["item"]], True)
  del list[response["item"]]
  del list_url[response["item"]]
  del list_pl[response["item"]]
  del list_nc[response["item"]]
  del list_sc[response["item"]]
  show(list, list_url)
  
show(list,list_url)