  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                ผมมีปัญหาเรื่องการส่งค่าจาก listview ไปยัง activity คือพอส่ง text ยาวๆเลย จอมันดำแล้วมืดไปเลยอะคับ ไม่มีแจ้งเออเร่อใดๆเลย 
 
 
อันนี้โค๊ตที่เป็นตัวส่ง 
Code (Android-Java) 
public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_search);
		if (android.os.Build.VERSION.SDK_INT > 9) {
			StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
					.permitAll().build();
			StrictMode.setThreadPolicy(policy);
		}
		// EditText ed = (EditText) findViewById(R.id.txtSearch);
		// ed.setFocusable(false);
		SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
		request.addProperty("keyword", "");
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
				SoapEnvelope.VER11);
		envelope.setOutputSoapObject(request);
		HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
		final ListView lstView1 = (ListView) findViewById(R.id.listView1);
		try {
			androidHttpTransport.call(SOAP_ACTION, envelope);
			SoapObject result2 = (SoapObject) envelope.bodyIn;
			Log.d("test", "allservice" + result2.getProperty(0).toString());
			if (result2 != null) {
				final ArrayList<HashMap<String, String>> MyArrList = new ArrayList<HashMap<String, String>>();
				HashMap<String, String> map;
				JSONObject json = new JSONObject(result2.getProperty(0)
						.toString());
				Log.d("test", "obj: " + json);
				JSONArray data2 = json.getJSONArray("shop");
				Log.d("test", "arr: " + data2.length());
				for (int i = 0; i < data2.length(); i++) {
					JSONObject c = data2.getJSONObject(i);
					map = new HashMap<String, String>();
					map.put("image", c.getString("image"));
					map.put("shop_name", c.getString("shop_name"));
					map.put("shop_detail", c.getString("shop_detail"));
					MyArrList.add(map);
				}
				lstView1.setAdapter(new ImageAdapter(this, MyArrList));
				final LayoutInflater inflater = (LayoutInflater) this
						.getSystemService(LAYOUT_INFLATER_SERVICE);
				final AlertDialog.Builder imageDialog = new AlertDialog.Builder(
						this);
				// OnClick
				lstView1.setOnItemClickListener(new OnItemClickListener() {
					public void onItemClick(AdapterView<?> parent, View v,
							int position, long id) {
						Intent newActivity = new Intent(SearchActivity.this,
								ShopdetailActivity.class);
						String shopname = MyArrList.get(position).get(
								"shop_name");
						 String shopdetail =
						MyArrList.get(position).get("shop_detail");
						String image = MyArrList.get(position).get("image");
						newActivity.putExtra("Shopname", shopname);
						newActivity.putExtra("Shopdetail", shopdetail);
						newActivity.putExtra("Image", image);
						startActivity(newActivity);
					}
				});
			} else {
				Toast.makeText(getApplicationContext(),
						"Web Service not Response!", Toast.LENGTH_LONG).show();
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (XmlPullParserException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	
	}
 
 
 
อันนี้ตัวรับ 
Code (Android-Java) 
protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.shopdetail);
		if (android.os.Build.VERSION.SDK_INT > 9) {
			StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
					.permitAll().build();
			StrictMode.setThreadPolicy(policy);
		}
      
		Intent intent = getIntent();
		final String Shopname = intent.getStringExtra("Shopname");
		final String Shopdetail = intent.getStringExtra("Shopdetail");
		final String Image = intent.getStringExtra("Image");
		TextView txtShopname = (TextView) findViewById(R.id.txtshopname);
		
		
		
		TextViewEx txtViewEx = (TextViewEx) findViewById(R.id.txtShopdetail);
		ImageView imgProduct = (ImageView) findViewById(R.id.imgShop);
		txtShopname.setText(Shopname);
		txtViewEx.setText(Shopdetail, true);
		
		
		String url = Image;
		try {
		imgProduct.setImageDrawable(getResource(url));
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Button buttonIntent = (Button)findViewById(R.id.btnShare);
		buttonIntent.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				Intent intent = new Intent(Intent.ACTION_SEND);
				intent.setType("text/plain");
				intent.putExtra(Intent.EXTRA_TEXT, Shopname);
				startActivity(Intent.createChooser(intent, "Intent"));
			}
		});
		
		
	}
 
 
ตัวแปลทุกตัวมีค่าหมดนะครับ ตอนหน้า list ไม่มีปัญหา แต่พอกดที่ listview แล้วส่งจะมาปัญหา มันจะมีปัญหาเฉพาะ record ที่ 
 
มี text ยาวๆอะครับ text สั้นๆ ไม่เป็นไร ผมก็ไม่ทราบสาเหตุเหมือนกัน เพราะใน logcat ไม่แจ้ง error ใดๆเลย น้ำเงินหมด
 
 
  Tag : Mobile               
                        | 
           
          
            | 
			
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2014-02-20 17:54:59 | 
                      By :
                          kaisiamza | 
                      View :
                          1493 | 
                      Reply :
                          6 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  |