其中因為資料過多,當超過6~7筆(依螢幕大小,不同)
在滑動會有資料跳動要注意
像下面這幾個是還不錯的,都有介紹到
在這邊,我是因為部份資料要使用刪除線,但滑動後卻都是刪除線
經過學長的指教,才知道資料一開始會全部已經轉成刪除線,當遇到不用改變時
已經變成刪除線TextView時,當然看到全都是刪除線!!!
所以這時要在另加入恢復成原本,才可以。
//將資料寫入JSONArray JSONArray result = new JSONArray(json_data); //取出陣列內所有物件 for(int i = 0;i < result.length(); i++) { //取出JSON物件 JSONObject stock_data = result.getJSONObject(i); //取得物件內資料 System.out.println("t:"+stock_data.getString("t")); System.out.println("l_cur:"+stock_data.getString("l_cur")); System.out.println("c:"+stock_data.getString("c")); System.out.println("cp:"+stock_data.getString("cp")); }
TextView textview = (TextView) findViewById(R.id.textview1); Paint paint = textview.getPaint(); paint.setFlags(Paint.STRIKE_THRU_TEXT_FLAG); paint.setAntiAlias(true);
TextView textview = (TextView) findViewById(R.id.textview1); Paint paint = textview.getPaint(); paint.setFlags(Paint.ANTI_ALIAS_FLAG); paint.setAntiAlias(true);
public void UploadFiles(String PathFile) { new Thread() { @Override public void run() { super.run(); List< NameValuePair> params = new ArrayList< NameValuePair>(); params.add(new BasicNameValuePair("file",PathFile)); HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("Server Address/update.php"); try{ //setup multipart entity MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); for(int i=0;i< params.size();i++){ //identify param type by Key if(params.get(i).getName().equals("file")){ File f = new File(params.get(i).getValue()); FileBody fileBody = new FileBody(f); entity.addPart("image"+i,fileBody); }else{ entity.addPart(params.get(i).getName(),new StringBody(params.get(i).getValue())); } } post.setEntity(entity); //create response handler ResponseHandler< String> handler = new BasicResponseHandler(); //execute and get response UploadFilesResponse = new String(client.execute(post,handler).getBytes(),HTTP.UTF_8); if(D) Log.e(TAG, "--- response ---"+ UploadFilesResponse); }catch(Exception e){ e.printStackTrace(); } } }.start(); }
<?php if(move_uploaded_file($_FILES['image0']['tmp_name'], "./ImageFiles/".$_FILES['image0']['name'])){ echo "uploaded"; }else{ echo "unsuccessfully"; } ?>
<!-- Camera --> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" />
//設定檔名 File tmpFile = new File( Environment.getExternalStorageDirectory(), "image.jpg"); Uri outputFileUri = Uri.fromFile(tmpFile); Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); //利用intent去開啟android本身的照相介面 intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(intent, 0);
new File( 路徑, 檔名)
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(D) Log.e(TAG, "--- onActivityResult ---"); if (resultCode == RESULT_OK) { String img_address = Environment.getExternalStorageDirectory()+"image.jpg"; Bitmap bmp = BitmapFactory.decodeFile(img_address); //利用BitmapFactory去取得剛剛拍照的圖像 ImageView ivTest = (ImageView)findViewById(R.id.imageView1); ivTest.setImageBitmap(bmp); } }