我正在尝试格式化从数据库表中检索的日期,我想格式化为"2015 02 11 12 00"到"2月2日",但是当我格式化它时会出错.格式化这些日期还有其他方法吗?
遵循以下代码:
protected String doInBackground(String... args) {
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
// getting JSON string from URL
JSONObject json = jParser.makeHttpRequest(url_all_events, "GET", params);
// Check your log cat for JSON reponse
Log.d("All events: ", json.toString());
try {
// Checking for SUCCESS TAG
int success = json.getInt(TAG_SUCCESS);
if (success == 1) {
// events found
// Getting Array of events
events = json.getJSONArray(TAG_EVENTS);
// looping through All events
for (int i = 0; …Run Code Online (Sandbox Code Playgroud) 我正在尝试从我的数据库在线获取图片,在我的"imagelink"中,这是我表中的数据字段,我把那些我上传的图片的网址放在那里,但不幸的是它给了我这个错误.
02-08 15:05:29.432 14364-14364/com.example.jithea.testlogin E/BitmapFactory? Unable to decode stream: java.io.FileNotFoundException: /http:/agustiniancampusevents.site40.net/newsDB/images/Visual%20Report%20Filipino%20Final-12%20copy.JPG: open failed: ENOENT (No such file or directory)
Run Code Online (Sandbox Code Playgroud)
这是我在onPostExecute中的代码:
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all products
pDialog.dismiss();
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(
NewsActivity.this, productsList,
R.layout.news_list_item, new String[]{TAG_PID, TAG_IMAGELINK,
TAG_NEWSTITLE, TAG_DESCRIPTION},
new int[]{R.id.pid, R.id.imageView, R.id.newstitle, R.id.description});
// updating listview
setListAdapter(adapter);
} …Run Code Online (Sandbox Code Playgroud) 在TabHost我们能做到getActionBar().setTitle("ACTITIVTY TITLE").
但是intent呢?
有没有办法设置标题intent?
码
Intent i = new Intent(MenuActivity.this, DrawerListActivity.class);
startActivity(i);
Toast.makeText(getBaseContext(), "RF number: " +
KEY_RFnumber, Toast.LENGTH_SHORT).show();
Run Code Online (Sandbox Code Playgroud)