Ray Zhang 12 ani în urmă
părinte
comite
774a484495

+ 5 - 0
Apex/AndroidManifest.xml

@@ -38,6 +38,7 @@
         <activity
             android:name="com.usai.apex.ApexActivity"
             android:label="@string/title_activity_apex"
+            android:screenOrientation="portrait"
             android:windowSoftInputMode="adjustPan" >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -71,6 +72,10 @@
             android:name="com.usai.apex.CustomizeFieldsActivity"
             android:label="@string/title_activity_customize_fields" >
         </activity>
+        <activity
+            android:name="com.usai.apex.ResultActivity"
+            android:label="@string/title_activity_result" >
+        </activity>
     </application>
 
 </manifest>

+ 41 - 0
Apex/res/layout/activity_result.xml

@@ -0,0 +1,41 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".ResultActivity" >
+
+    <HorizontalScrollView
+        android:id="@+id/horizontalScrollView1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        >
+
+        <TableLayout
+            android:layout_width="wrap_content"
+            android:layout_height="fill_parent"
+             >
+
+            <TableRow
+                android:id="@+id/tr_count"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_horizontal" >
+
+                <TextView
+                    android:id="@+id/textView1"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Large Text"
+                    android:textAppearance="?android:attr/textAppearanceLarge" />
+            </TableRow>
+
+            <TableRow
+                android:id="@+id/tr_header"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content" >
+            </TableRow>
+        </TableLayout>
+
+    </HorizontalScrollView>
+
+</RelativeLayout>

+ 1 - 1
Apex/res/layout/activity_search.xml

@@ -40,7 +40,7 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
-                android:text="@android:string/ok" />
+                android:text="Search" />
         </LinearLayout>
     </LinearLayout>
 

+ 3 - 3
Apex/res/layout/drag_list_item.xml

@@ -7,17 +7,17 @@
     <TextView
         android:id="@+id/drag_list_item_text"
         android:layout_width="wrap_content"
-        android:layout_height="32dp"
+        android:layout_height="wrap_content"
         android:layout_alignParentLeft="true"
         android:layout_centerVertical="true"
-       
+       android:textAppearance="?android:attr/textAppearanceMedium"
         android:gravity="center_vertical"
         android:paddingLeft="5dip" />
 
     <ImageView
         android:id="@+id/drag_list_item_image"
         android:layout_width="wrap_content"
-        android:layout_height="32dp"
+        android:layout_height="wrap_content"
         android:layout_alignParentRight="true"
         android:layout_centerVertical="true"
         android:src="@drawable/ic_launcher" />

+ 8 - 4
Apex/res/layout/drag_list_item_tag.xml

@@ -2,13 +2,17 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
     android:layout_width="fill_parent"  
     android:layout_height="wrap_content"  
-    android:background="#555555"  
+    android:background="#55555555"  
     android:padding="5dip"  
     android:paddingLeft="10dip">  
     <TextView  
        android:id="@+id/drag_list_item_text"  
        android:layout_width="wrap_content"  
-       android:layout_height="20dip"  
-       android:textColor="#ffffff"  
-       android:gravity="center_vertical"/>  
+       android:layout_height="wrap_content"  
+       android:textColor="#ffffffff"  
+       android:gravity="center_vertical"
+       android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+
+  
 </LinearLayout>  

+ 9 - 0
Apex/res/menu/result.xml

@@ -0,0 +1,9 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item
+        android:id="@+id/action_custom_fields"
+        android:orderInCategory="100"
+        android:showAsAction="never"
+        android:title="@string/action_custom_fields"/>
+
+</menu>

+ 1 - 0
Apex/res/values/strings.xml

@@ -14,5 +14,6 @@
     <string name="title_activity_test">TestActivity</string>
     <string name="title_activity_search">SearchActivity</string>
     <string name="title_activity_customize_fields">CustomizeFieldsActivity</string>
+    <string name="title_activity_result">ResultActivity</string>
 
 </resources>

+ 142 - 47
Apex/src/com/usai/apex/CustomizeFieldsActivity.java

@@ -3,22 +3,25 @@ package com.usai.apex;
 import java.util.ArrayList;
 import java.util.List;
 
-import com.usai.util.Network;
 import com.usai.util.dbUtil;
 
 import android.os.Bundle;
 import android.app.Activity;
+import android.app.AlertDialog;
 import android.content.Context;
+import android.content.DialogInterface;
+//import android.content.DialogInterface.OnClickListener;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
 import android.view.LayoutInflater;
-import android.view.Menu;
 import android.view.View;
+import android.view.View.OnClickListener;
 import android.view.ViewGroup;
 import android.widget.ArrayAdapter;
+import android.widget.Button;
 import android.widget.TextView;
 
-public class CustomizeFieldsActivity extends Activity
+public class CustomizeFieldsActivity extends Activity implements OnClickListener
 {
 	//
 	// @Override
@@ -36,36 +39,45 @@ public class CustomizeFieldsActivity extends Activity
 	// return true;
 	// }
 
+
+
 	private static List<fieldedit> list = null;
 	private DragListAdapter adapter = null;
 
-	public static List<fieldedit> groupKey = new ArrayList<fieldedit>();
+	// public static List<String> groupKey = new ArrayList<String>();
 	private List<fieldedit> showList = new ArrayList<fieldedit>();
-	private List<fieldedit> notshowList = new ArrayList<fieldedit>();
-	private String user/*,password*/,function_name;
+	private List<fieldedit> hideList = new ArrayList<fieldedit>();
+	private String user/* ,password */, function_name;
 	private int behavior;
 
 	public class fieldedit
 	{
-		public String name=null;
-		public int _id=-1;
-		public fieldedit(String str,int i)
+		public String name = null;
+		public int _id = -1;
+
+		public fieldedit(String str, int i)
 		{
-			name=str;
-			_id=i;
-			
+			name = str;
+			_id = i;
+
 		}
 	}
+
 	@Override
 	public void onCreate(Bundle savedInstanceState)
 	{
 		super.onCreate(savedInstanceState);
-		
+
 		user = getIntent().getStringExtra("user");
-//		password = getIntent().getStringExtra("password");
+		// password = getIntent().getStringExtra("password");
 		function_name = getIntent().getStringExtra("function_name");
 		behavior = getIntent().getIntExtra("behavior", -1);
 		setContentView(R.layout.activity_customize_fields);
+		Button btnok= (Button)findViewById(R.id.btnok);
+		btnok.setOnClickListener(this);
+		Button btncancel= (Button)findViewById(R.id.btncancel);
+		btncancel.setOnClickListener(this);
+		
 
 		initData();
 
@@ -77,40 +89,43 @@ public class CustomizeFieldsActivity extends Activity
 	public void initData()
 	{
 		SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-		Cursor cursor = db.query("fields_info",
-				new String[] { "aname","show", "_id" },
-				"function_name='"+function_name+"' and user='"+user+"' and behavior="+behavior,
-				 null, null, null, "priority , aname", null);
-		while(cursor.moveToNext())
+		Cursor cursor = db.query("fields_info", new String[] { "aname", "show",
+				"_id" }, "function_name='" + function_name + "' and user='"
+				+ user + "' and behavior=" + behavior, null, null, null,
+				"priority , aname", null);
+		while (cursor.moveToNext())
 		{
 			int show = cursor.getInt(1);
-			if(show==1)
-				showList.add(new fieldedit(cursor.getString(0),cursor.getInt(2)));
-			else {
-				notshowList.add(new fieldedit(cursor.getString(0),cursor.getInt(2)));
-				
+			if (show == 1)
+				showList.add(new fieldedit(cursor.getString(0), cursor
+						.getInt(2)));
+			else
+			{
+				hideList.add(new fieldedit(cursor.getString(0), cursor
+						.getInt(2)));
+
 			}
 		}
 		// 数据结果
 		list = new ArrayList<fieldedit>();
 
 		// groupKey存放的是分组标签
-		groupKey.add(new fieldedit("Display fields",-1));
-		groupKey.add(new fieldedit("Hide fields",-1));
-
-//		for (int i = 0; i < 5; i++)
-//		{
-//			navList.add("A选项" + i);
-//		}
-		list.add(new fieldedit("Display fields",-1));
+		// groupKey.add("Display fields");
+		// groupKey.add("Hide fields");
+
+		// for (int i = 0; i < 5; i++)
+		// {
+		// navList.add("A选项" + i);
+		// }
+		list.add(new fieldedit("Display fields", -1));
 		list.addAll(showList);
 
-//		for (int i = 0; i <18; i++)
-//		{
-//			moreList.add("B选项" + i);
-//		}
-		list.add(new fieldedit("Hide fields",-1));
-		list.addAll(notshowList);
+		// for (int i = 0; i <18; i++)
+		// {
+		// moreList.add("B选项" + i);
+		// }
+		list.add(new fieldedit("Hide fields", -2));
+		list.addAll(hideList);
 		dbUtil.CloseCursor(cursor);
 		dbUtil.CloseDB(db);
 	}
@@ -118,12 +133,12 @@ public class CustomizeFieldsActivity extends Activity
 	public static class DragListAdapter extends ArrayAdapter<fieldedit>
 	{
 
-//		private Context mContext;
+		// private Context mContext;
 
 		public DragListAdapter(Context context, List<fieldedit> objects)
 		{
 			super(context, 0, objects);
-//			this.mContext = context;
+			// this.mContext = context;
 		}
 
 		public List<fieldedit> getList()
@@ -134,11 +149,13 @@ public class CustomizeFieldsActivity extends Activity
 		@Override
 		public boolean isEnabled(int position)
 		{
-			if (groupKey.contains(getItem(position)))
-			{
-				// 如果是分组标签,返回false,不能选中,不能点击
+			if (getItem(position)._id < 0) //_id<0 means a group key
 				return false;
-			}
+			// if (groupKey.contains(getItem(position).name))
+			// {
+			// // 如果是分组标签,返回false,不能选中,不能点击
+			// return false;
+			// }
 			return super.isEnabled(position);
 		}
 
@@ -147,12 +164,17 @@ public class CustomizeFieldsActivity extends Activity
 		{
 
 			View view = convertView;
-			if (groupKey.contains(getItem(position)))
+			if(getItem(position)._id<0) //_id<0 means a group key
 			{
-				// 如果是分组标签,就加载分组标签的布局文件,两个布局文件显示效果不同
 				view = LayoutInflater.from(getContext()).inflate(
-						R.layout.drag_list_item_tag, null);
+				R.layout.drag_list_item_tag, null);
 			}
+//			if (groupKey.contains(getItem(position).name))
+//			{
+//				// 如果是分组标签,就加载分组标签的布局文件,两个布局文件显示效果不同
+//				view = LayoutInflater.from(getContext()).inflate(
+//						R.layout.drag_list_item_tag, null);
+//			}
 			else
 			{
 				// 如果是正常数据项标签,就加在正常数据项的布局文件
@@ -168,4 +190,77 @@ public class CustomizeFieldsActivity extends Activity
 		}
 	}
 
+	@Override
+	public void onClick(View v)
+	{
+		switch (v.getId())
+		{
+		case R.id.btnok:
+		{
+//			DragListView dragListView = (DragListView) findViewById(R.id.drag_list);
+			int count=0;
+			for(int i=0;i<adapter.getCount();i++)
+			{
+				fieldedit fe=adapter.getItem(i);
+				if(fe._id==-2||count>0)
+					break;
+				if(fe._id>=0)
+					count++;
+				
+			}
+			if(count==0)
+			{
+				new AlertDialog.Builder(CustomizeFieldsActivity.this)
+				.setIcon(android.R.drawable.ic_dialog_info)
+				.setTitle("Error!")
+				.setMessage("You must set at least 1 field visiable!")
+				.setPositiveButton("OK",
+						new DialogInterface.OnClickListener()
+						{
+							public void onClick(
+									DialogInterface dialog,
+									int whichButton)
+							{
+
+//								finish();
+								/* User clicked OK so do some stuff */
+							}
+						}).show();
+				break;
+				
+			}
+			
+			int show = 1;
+			SQLiteDatabase db= dbUtil.OpenDB(this, null, true);
+			db.beginTransaction();
+			for(int i=0;i<adapter.getCount();i++)
+			{
+				fieldedit fe=adapter.getItem(i);
+				if(fe._id==-2)//hide group begin
+				{
+					show = 0;
+				}
+				if(show==1)
+					db.execSQL("update fields_info set show="+show+" ,priority="+i+" where _id="+fe._id);
+				else
+					db.execSQL("update fields_info set show="+show+" where _id="+fe._id);
+					
+			}
+			db.setTransactionSuccessful();
+			db.endTransaction();
+			dbUtil.CloseDB(db);
+			finish();
+//			Log.d("fields",);
+			break;
+		}
+		case R.id.btncancel:
+			finish();
+			break;
+		default:
+			break;
+		}
+		// TODO Auto-generated method stub
+		
+	}
+
 }

+ 78 - 0
Apex/src/com/usai/apex/ResultActivity.java

@@ -0,0 +1,78 @@
+package com.usai.apex;
+
+import com.usai.util.Network;
+import com.usai.util.dbUtil;
+
+import android.os.Bundle;
+import android.app.Activity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.Button;
+import android.widget.TableRow;
+
+public class ResultActivity extends Activity
+{
+	String user = null;
+	String password = null;
+	String function_name=null;
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		user = getIntent().getStringExtra("user");
+		password = getIntent().getStringExtra("password");
+		function_name = getIntent().getStringExtra("function_name");
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_result);
+		initTable();
+
+	}
+	void initTable()
+	{
+		SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
+		Cursor cursor = db.query("fields_info",
+				new String[] { "aname", "_id" },
+				"function_name='"+function_name+"' and user='"+user+"' and behavior="+Network.BEHAVIOR_RESULT+" and show = 1",
+				 null, null, null, "priority , aname", null);
+		TableRow headerRow= (TableRow)findViewById(R.id.tr_header);
+		while (cursor.moveToNext())
+		{
+			cursor.getString(0);
+			Button btn = new Button(this);
+			btn.setText(cursor.getString(0));
+			headerRow.addView(btn);
+		}
+		dbUtil.CloseCursor(cursor);
+		dbUtil.CloseDB(db);		
+	}
+
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu)
+	{
+		// Inflate the menu; this adds items to the action bar if it is present.
+		getMenuInflater().inflate(R.menu.result, menu);
+		return true;
+	}
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item)
+	{
+		switch (item.getItemId())
+		{
+		case R.id.action_custom_fields:
+			Intent intent = new Intent();
+			intent.setClass(this, CustomizeFieldsActivity.class);
+			intent.putExtra("user", user);
+//			intent.putExtra("password", password);
+			intent.putExtra("function_name", function_name);
+			intent.putExtra("behavior", Network.BEHAVIOR_RESULT);
+			startActivity(intent);		
+			break;
+
+		default:
+			break;
+		}
+		return super.onOptionsItemSelected(item);
+	}
+}

+ 91 - 2
Apex/src/com/usai/apex/SearchActivity.java

@@ -1,11 +1,14 @@
 package com.usai.apex;
 
+import com.usai.apex.CustomizeFieldsActivity.fieldedit;
 import com.usai.util.Network;
 import com.usai.util.dbUtil;
 
 import android.os.Bundle;
+import android.app.AlertDialog;
 import android.app.ListActivity;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
@@ -14,12 +17,14 @@ import android.util.Log;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
 import android.widget.EditText;
 import android.widget.ListView;
 import android.widget.SimpleCursorAdapter;
 import android.widget.Switch;
 
-public class SearchActivity extends ListActivity
+public class SearchActivity extends ListActivity implements OnClickListener
 {
 	private SQLiteDatabase m_db = null;
 	private Cursor m_cursor = null;
@@ -122,7 +127,10 @@ public class SearchActivity extends ListActivity
 				// The "text1" view defined in the XML template
 				new int[] {R.id.aliasName, R.id.tv_type });
 		setListAdapter(m_listadapter);	
-		
+		Button btnok= (Button)findViewById(R.id.btnok);
+		btnok.setOnClickListener(this);
+		Button btncancel= (Button)findViewById(R.id.btncancel);
+		btncancel.setOnClickListener(this);		
 //		initlist();
 
 		// m_ListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
@@ -200,6 +208,87 @@ public class SearchActivity extends ListActivity
 		return super.onOptionsItemSelected(item);
 	}
 
+	@Override
+	public void onClick(View v)
+	{
+		switch (v.getId())
+		{
+		case R.id.btnok:
+		{
+			Intent intent = new Intent();
+			intent.setClass(this, ResultActivity.class);
+			intent.putExtra("user", user);
+			intent.putExtra("password", password);
+			intent.putExtra("function_name", function_name);
+//			intent.putExtra("behavior", Network.be);
+			startActivity(intent);		
+//			DragListView dragListView = (DragListView) findViewById(R.id.drag_list);
+//			int count=0;
+//			for(int i=0;i<adapter.getCount();i++)
+//			{
+//				fieldedit fe=adapter.getItem(i);
+//				if(fe._id==-2||count>0)
+//					break;
+//				if(fe._id>=0)
+//					count++;
+//				
+//			}
+//			if(count==0)
+//			{
+//				new AlertDialog.Builder(CustomizeFieldsActivity.this)
+//				.setIcon(android.R.drawable.ic_dialog_info)
+//				.setTitle("Error!")
+//				.setMessage("You must set at least 1 field visiable!")
+//				.setPositiveButton("OK",
+//						new DialogInterface.OnClickListener()
+//						{
+//							public void onClick(
+//									DialogInterface dialog,
+//									int whichButton)
+//							{
+//
+////								finish();
+//								/* User clicked OK so do some stuff */
+//							}
+//						}).show();
+//				break;
+//				
+//			}
+//			
+//			int show = 1;
+//			SQLiteDatabase db= dbUtil.OpenDB(this, null, true);
+//			db.beginTransaction();
+//			for(int i=0;i<adapter.getCount();i++)
+//			{
+//				fieldedit fe=adapter.getItem(i);
+//				if(fe._id==-2)//hide group begin
+//				{
+//					show = 0;
+//				}
+//				if(show==1)
+//					db.execSQL("update fields_info set show="+show+" ,priority="+i+" where _id="+fe._id);
+//				else
+//					db.execSQL("update fields_info set show="+show+" where _id="+fe._id);
+//					
+//			}
+//			db.setTransactionSuccessful();
+//			db.endTransaction();
+//			dbUtil.CloseDB(db);
+//			finish();
+////			Log.d("fields",);
+			break;
+		}
+		case R.id.btncancel:
+			finish();
+			break;
+		default:
+			break;
+		}
+
+		
+		
+	}
+
 	// class FieldsAdapter extends SimpleAdapter
 	// {
 	//

+ 93 - 72
Apex/src/com/usai/util/Network.java

@@ -103,85 +103,87 @@ public class Network
 	// "http://192.168.1.10/xampp/save_upload_file.php";
 //	public static String URL_VERIFY_USER = "https://ra.apexshipping.com/login.php";
 	public static String URL_UPDATE_AUTH = "https://ra.apexshipping.com/login.php";
+	public static String URL_REQUEST_COUNT = "https://ra.apexshipping.com/main.php";
 //	public static String FAKE_URL_UPDATE_AUTH = "https://192.168.23.1/xampp/auth.json";
 //	public static String FAKE_SEARCH = "https://192.168.23.1/xampp/recordset.json";
 
 	// static String URL_UPLOAD_PHOTO =
 	// "http://192.168.23.1/xampp/save_upload_file.php";
 	//
-	 private static String fakegetJson(String url)
-	 {
-	 return download(url, 10000);
-	 // return null;
+//	 private static String fakegetJson(String url)
+//	 {
+//	 return download(url, 10000);
+//	 // return null;
+//	
+//	 }
+//
+//	public static String download(String urlStr, int timeout)
+//	{
+//		String TAG = "net_dbg@download";
+//
+//		Log.d(TAG, urlStr);
+//
+//		StringBuffer sb = new StringBuffer();
+//		String line = null;
+//		BufferedReader buffer = null;
+//		HttpURLConnection urlConn = null;
+//		try
+//		{
+//			// 创建一个URL对象
+//			URL url = new URL(urlStr);
+//			// 创建一个Http连接
+//			urlConn = (HttpURLConnection) url.openConnection();
+//
+//			urlConn.setConnectTimeout(timeout);
+//			urlConn.setReadTimeout(timeout);
+//			// urlConn.connect();
+//
+//			int irespon = urlConn.getResponseCode();
+//			if (irespon != HttpURLConnection.HTTP_OK)
+//			{
+//				Log.e(TAG, "HTTP ERROR CODE " + irespon + " url: " + urlStr);
+//				urlConn.disconnect();
+//				return null;
+//			}
+//
+//			// 使用IO流读取数据
+//			buffer = new BufferedReader(new InputStreamReader(
+//					urlConn.getInputStream()));
+//			while ((line = buffer.readLine()) != null)
+//			{
+//				sb.append(line);
+//			}
+//			Log.d(TAG, "download success @" + urlStr);
+//		}
+//		catch (MalformedURLException e)
+//		{
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+//		catch (IOException e)
+//		{
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+//
+//		finally
+//		{
+//			try
+//			{
+//				if (urlConn != null)
+//					urlConn.disconnect();
+//				if (buffer != null)
+//					buffer.close();
+//			}
+//			catch (Exception e)
+//			{
+//				e.printStackTrace();
+//			}
+//
+//		}
+//		return sb.toString();
+//	}
 	
-	 }
-
-	public static String download(String urlStr, int timeout)
-	{
-		String TAG = "net_dbg@download";
-
-		Log.d(TAG, urlStr);
-
-		StringBuffer sb = new StringBuffer();
-		String line = null;
-		BufferedReader buffer = null;
-		HttpURLConnection urlConn = null;
-		try
-		{
-			// 创建一个URL对象
-			URL url = new URL(urlStr);
-			// 创建一个Http连接
-			urlConn = (HttpURLConnection) url.openConnection();
-
-			urlConn.setConnectTimeout(timeout);
-			urlConn.setReadTimeout(timeout);
-			// urlConn.connect();
-
-			int irespon = urlConn.getResponseCode();
-			if (irespon != HttpURLConnection.HTTP_OK)
-			{
-				Log.e(TAG, "HTTP ERROR CODE " + irespon + " url: " + urlStr);
-				urlConn.disconnect();
-				return null;
-			}
-
-			// 使用IO流读取数据
-			buffer = new BufferedReader(new InputStreamReader(
-					urlConn.getInputStream()));
-			while ((line = buffer.readLine()) != null)
-			{
-				sb.append(line);
-			}
-			Log.d(TAG, "download success @" + urlStr);
-		}
-		catch (MalformedURLException e)
-		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		catch (IOException e)
-		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-
-		finally
-		{
-			try
-			{
-				if (urlConn != null)
-					urlConn.disconnect();
-				if (buffer != null)
-					buffer.close();
-			}
-			catch (Exception e)
-			{
-				e.printStackTrace();
-			}
-
-		}
-		return sb.toString();
-	}
 
 	private static HttpClient getNewHttpClient()
 	{
@@ -823,6 +825,25 @@ public class Network
 	// // }
 	// // return 0;
 	// }
+	public static String get_count(String name,String password,Bundle parms)
+	{
+		String TAG = "net_dbg@get_count";
+//		parms.putString("user", name);
+//		parms.putString("password", password);
+		if (!Network.NetworkIsAvailable())
+		{
+			Log.d(TAG, "network not available!");
+			return "Network.RESULT_NET_NOTAVAILABLE"; // network not available
+		}		
+		parms.putString("action", "handset_search_count");
+		String jstr = getJson(Network.URL_REQUEST_COUNT, parms);
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			return "Network.RESULT_NET_ERROR";
+		}
+		return jstr;
+	}
 	public static int get_Auth(String name, String password)
 	{