Ray Zhang 12 жил өмнө
parent
commit
e2e7bbada6

+ 16 - 3
Apex/AndroidManifest.xml

@@ -36,6 +36,19 @@
             android:name="com.google.android.gms.version"
             android:value="@integer/google_play_services_version" />
 
+        <activity
+            android:name="com.usai.apex.DetailActivity"
+            android:label="@string/title_activity_detail" >
+            <meta-data
+                android:name="android.support.PARENT_ACTIVITY"
+                android:value="android.support.v4.app.FragmentActivity" />
+
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter> 
+        </activity>
         <activity
             android:name="com.usai.apex.ApexActivity"
             android:label="@string/title_activity_apex"
@@ -56,7 +69,7 @@
         <activity
             android:name="com.usai.apex.DirectTrackingFragment"
             android:label="@string/title_activity_direct_tracking" >
-        </activity>


+        </activity>




         -->
         <activity
             android:name="com.usai.apex.FunctionSelectActivity"
@@ -88,8 +101,8 @@
         </activity>
         <activity
             android:name="com.usai.apex.HelpActivity"
-            android:theme="@android:style/Theme.Holo.NoActionBar"
-            android:label="@string/title_activity_help" >
+            android:label="@string/title_activity_help"
+            android:theme="@android:style/Theme.Holo.NoActionBar" >
         </activity>
     </application>
 

+ 33 - 0
Apex/res/layout/activity_detail.xml

@@ -0,0 +1,33 @@
+<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/tabhost"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent" >
+
+    <RelativeLayout
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent" >
+
+        <HorizontalScrollView
+            android:id="@+id/hs_tabs"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:scrollbars="none" 
+            android:layout_alignParentBottom="true" >
+
+            <TabWidget
+                android:id="@android:id/tabs"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                 />
+        </HorizontalScrollView>
+
+        <FrameLayout
+            android:id="@android:id/tabcontent"
+            android:layout_width="fill_parent"
+            android:layout_height="fill_parent"
+            android:layout_above="@+id/hs_tabs"
+            android:layout_alignParentLeft="true" >
+        </FrameLayout>
+    </RelativeLayout>
+
+</TabHost>

+ 33 - 0
Apex/res/layout/detail_fragment.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" >
+
+    <TextView
+        android:id="@+id/textView1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentTop="true"
+        android:layout_marginLeft="97dp"
+        android:layout_marginTop="98dp"
+         />
+
+    <TextView
+        android:id="@+id/text2"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingBottom="8dp"
+        android:paddingTop="8dp"
+        android:text="@string/link_text_manual"
+        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+    <WebView
+        android:id="@+id/webView1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+      
+        android:layout_centerHorizontal="true" />
+
+</RelativeLayout>

+ 7 - 0
Apex/res/layout/tab_indicator.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" >
+    
+
+</RelativeLayout>

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

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@android:id/tabhost"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <LinearLayout
+        android:orientation="vertical"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:padding="5dp">
+        <HorizontalScrollView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:scrollbars="none">
+            <TabWidget
+                android:id="@android:id/tabs"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" />
+        </HorizontalScrollView>
+        <FrameLayout
+            android:id="@android:id/tabcontent"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:padding="5dp" />
+    </LinearLayout>
+</TabHost>

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

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

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

@@ -34,5 +34,12 @@
     <string name="error_incorrect_password">This password is incorrect</string>
     <string name="error_field_required">This field is required</string>
     <string name="title_activity_help">HelpActivity</string>
+    <string name="title_activity_detail">DetailActivity</string>
 
-</resources>
+    <!-- test -->
+    <string name="url"><a href='http://www.google.com'>A1401330351H.pdf</a></string>
+    <string name="link_text_manual"><b>text2: Explicit links using &lt;a&gt; markup.</b>      This has markup for a <a href="http://www.google.com">link</a> specified
+      via an &lt;a&gt; tag.  Use a \"tel:\" URL
+      to <a href="tel:4155551212">dial a phone number</a>.
</string>
+
+</resources>

+ 8 - 0
Apex/src/com/usai/apex/CBPFragment.java

@@ -0,0 +1,8 @@
+package com.usai.apex;
+
+import android.support.v4.app.ListFragment;
+
+public class CBPFragment extends ListFragment
+{
+
+}

+ 271 - 0
Apex/src/com/usai/apex/DetailActivity.java

@@ -0,0 +1,271 @@
+package com.usai.apex;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import com.usai.util.commonUtil;
+
+import android.os.Bundle;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.TabHost;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v4.app.NavUtils;
+
+public class DetailActivity extends FragmentActivity implements
+		TabHost.TabContentFactory
+{
+	// int radomid = 1 + (int) (Math.random() * 15);
+	TabHost mTabHost;
+	HashMap<String, Integer> tabmap = new HashMap<String, Integer>();
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+
+		setContentView(R.layout.activity_detail);
+
+		if (getIntent().getBooleanExtra("Detail", true))
+			tabmap.put("Detail", commonUtil.generateViewId());
+		if (getIntent().getBooleanExtra("Tracking", false))
+			tabmap.put("Tracking", commonUtil.generateViewId());
+		if (getIntent().getBooleanExtra("AMS LOG", false))
+			tabmap.put("AMS LOG", commonUtil.generateViewId());
+		if (getIntent().getBooleanExtra("ISF LOG", false))
+			tabmap.put("ISF LOG", commonUtil.generateViewId());
+
+		// final TabHost tabHost = getTabHost();
+		// mTabHost = (TabHost) findViewById(R.id.tabhost);
+
+		setupTabs();
+
+	}
+
+	/** {@inheritDoc} */
+	public View createTabContent(String tag)
+	{
+		// final TextView tv = new TextView(this);
+		// tv.setText("Content for tab with tag " + tag);
+		FrameLayout fl = new FrameLayout(this);
+		fl.setId(tabmap.get(tag));
+
+		Fragment f;
+		Bundle bundle = new Bundle();
+		bundle.putSerializable("type", "tag");
+		
+		if (tag.equals("Detail"))
+			f = new DetailFragment();
+		else
+			if (tag.equals("Tracking"))
+				f = new StatusFragment();
+			else
+				if (tag.equals("AMS LOG"))
+				{
+					f = new CBPFragment();
+
+				}
+				else
+					/* if(tag.equals("AMS LOG")) */
+					f = new CBPFragment();
+
+		f.setArguments(bundle);
+		// Fragment loginFragment = new LoginFragment();
+		// Fragment dtFragement = new DirectTrackingFragment();
+		// Fragment slFragment = new ServiceLocationFragment();
+		// Add the fragment to the activity, pushing this transaction
+		// on to the back stack.
+
+		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
+		ft.replace(fl.getId(), f);
+		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
+		ft.addToBackStack(tag);
+		ft.commit();
+		return fl;
+	}
+
+	// TabHost mTabHost;
+	// private FrameLayout mTabContent;
+	@Override
+	public boolean onKeyDown(int keyCode, KeyEvent event)
+	{
+		if (keyCode == KeyEvent.KEYCODE_BACK)
+		{
+			// Intent myIntent = new Intent();
+			// myIntent = new Intent(EditActivity.this, tabActivity.class);
+			// startActivity(myIntent);
+			finish();
+			return true;
+		}
+		return super.onKeyDown(keyCode, event);
+	}
+
+	//
+	// @Override
+	// protected void onCreate(Bundle savedInstanceState)
+	// {
+	// super.onCreate(savedInstanceState);
+	// setContentView(R.layout.activity_detail);
+	// // Show the Up button in the action bar.
+	// setupActionBar();
+	// setupTabs();
+	// }
+	//
+	// /**
+	// * Set up the {@link android.app.ActionBar}.
+	// */
+	// private void setupActionBar()
+	// {
+	//
+	// getActionBar().setDisplayHomeAsUpEnabled(true);
+	//
+	// }
+	//
+	// // private View createTabIndicatorView(ViewGroup parent, CharSequence
+	// label, Drawable icon) {
+	// // final LayoutInflater inflater = LayoutInflater.from(this);
+	// // final View tabIndicator = inflater.inflate(R.layout.tab_indicator,
+	// parent, false);
+	// //
+	// //// final TextView tv = (TextView)
+	// tabIndicator.findViewById(R.id.tab_title);
+	// //// tv.setText(label);
+	// ////
+	// //// final ImageView iconView = (ImageView)
+	// tabIndicator.findViewById(R.id.tab_icon);
+	// //// iconView.setImageDrawable(icon);
+	// //
+	// // return tabIndicator;
+	// // }
+	//
+	// @Override
+	// public View createTabContent(String tag)
+	// {
+	// final TextView tv = new TextView(this);
+	// tv.setText("Content for tab with tag " + tag);
+	// return tv;
+	// }
+	private void setupTabs()
+	{
+		mTabHost = (TabHost) findViewById(R.id.tabhost);
+		// mTabContent = (FrameLayout) findViewById(android.R.id.tabcontent);
+		// FrameLayout tab1 = new FrameLayout(this);
+		mTabHost.setup();
+
+		Iterator iter = tabmap.keySet().iterator();
+		while (iter.hasNext())
+		{
+			String name = (String) iter.next();
+			mTabHost.addTab(mTabHost.newTabSpec(name).setIndicator(name)
+					.setContent(this));
+			// String val = (String) tabmap.get(field);
+			// parms.putString(field, val);
+			// // Cursor c = (Cursor) m_listadapter.getItem(key);
+			// Log.d("@@@@@@@@@", field + " : " + val);
+		}
+
+		// for (int i=1; i <= tabmap.size(); i++) {
+		// String name = tabmap.keySet().iterator().;
+		// mTabHost.addTab(mTabHost.newTabSpec(name)
+		// .setIndicator(name)
+		// .setContent(this));
+		// }
+		// // if(true)
+		// // return;
+		//
+		// // View tab1 = createTabIndicatorView(mTabHost.getTabWidget(),
+		// // "Login",null);
+		// // tabhost.addTab(
+		// // tabhost.newTabSpec("tab" + i).setIndicator(tab)
+		// // .setContent(Mytabfirst.this)); tabhost.setCurrentTab(i);
+		// // i++; tab = null;
+		//
+		// // // 生成底部自定义样式的按钮
+		// // String[] title = new String[] { "Login", "Not login" };
+		// // int[] tabIds = new int[] { R.id.tab1, R.id.tab2 };
+		// mTabHost.addTab(mTabHost.newTabSpec("Login").setIndicator("Login")
+		// .setContent(this));
+		// //
+		// mTabHost.addTab(mTabHost.newTabSpec("Direct Tracking").setIndicator("Direct Tracking").setContent(R.id.tab2));
+		// mTabHost.addTab(mTabHost.newTabSpec("Service Location")
+		// .setIndicator("Service Location").setContent(this));
+
+		// FragmentManager manager = this.getFragmentManager();
+
+		// Instantiate a new fragment.
+		// Fragment loginFragment = new LoginFragment();
+		// // Fragment dtFragement = new DirectTrackingFragment();
+		// Fragment slFragment = new ServiceLocationFragment();
+		// // Add the fragment to the activity, pushing this transaction
+		// // on to the back stack.
+		//
+		// FragmentTransaction ft =
+		// getSupportFragmentManager().beginTransaction();
+		// ft.replace(mTabHost.getTabContentView().getChildAt(0).getId(),
+		// loginFragment);
+		// ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
+		// ft.addToBackStack("Login");
+		//
+		// // ft.replace(R.id.tab2, dtFragement);
+		// // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
+		// // ft.addToBackStack("Tracking");
+		//
+		// ft.replace(R.id.tab3, (Fragment) slFragment);
+		// ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
+		// ft.addToBackStack("Location");
+		//
+		// ft.commit();
+
+		// if (manager.findFragmentByTag(tabId) == null)
+		// {
+		// FragmentTransaction trans = manager.beginTransaction();
+		// trans.replace(contentViewID, frag, tabId);
+		// trans.commit();
+		// }
+		// for (int i = 0; i < title.length; i++) {
+		// Button button = new Button(this);
+		// button.setText(title[i]);
+		// button.setBackgroundDrawable(this.getResources().getDrawable(
+		// R.drawable.tab_lable)); //自定义按钮样式
+		// mTabHost.addTab(mTabHost.newTabSpec(title[i]).setIndicator(button)
+		// .setContent(tabIds[i]));
+		// }
+
+		// mTabHost.setOnTabChangedListener(this);
+	}
+
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu)
+	{
+		// Inflate the menu; this adds items to the action bar if it is present.
+		getMenuInflater().inflate(R.menu.detail, menu);
+		return true;
+	}
+
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item)
+	{
+		switch (item.getItemId())
+		{
+		case android.R.id.home:
+			// This ID represents the Home or Up button. In the case of this
+			// activity, the Up button is shown. Use NavUtils to allow users
+			// to navigate up one level in the application structure. For
+			// more details, see the Navigation pattern on Android Design:
+			//
+			//
+			// http: //
+			// developer.android.com/design/patterns/navigation.html#up-vs-back
+			//
+			NavUtils.navigateUpFromSameTask(this);
+			return true;
+		}
+		return super.onOptionsItemSelected(item);
+	}
+
+}

+ 42 - 0
Apex/src/com/usai/apex/DetailFragment.java

@@ -0,0 +1,42 @@
+package com.usai.apex;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.text.Html;
+import android.text.method.LinkMovementMethod;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.webkit.WebView;
+import android.widget.TextView;
+
+public class DetailFragment extends Fragment
+{
+
+	@Override
+	public View onCreateView(LayoutInflater inflater, ViewGroup container,
+			Bundle savedInstanceState)
+	{
+		View view = inflater.inflate(R.layout.detail_fragment, null);
+		String url = "<a href='http://www.google.com'>A1401330351H.pdf</a>";
+		
+		
+		String url1="<table border=1><tr><th>Test A</th><th>Test b</th></tr><tr><td>a</td><td>b</td></tr></table>";
+        TextView t2 = (TextView) view.findViewById(R.id.text2);
+        t2.setMovementMethod(LinkMovementMethod.getInstance());
+        TextView t1 = (TextView) view.findViewById(R.id.textView1);
+        
+        t1.setText(Html.fromHtml(url1));
+        t1.setMovementMethod(LinkMovementMethod.getInstance());
+        
+        
+        final String mimeType = "text/html";	
+        WebView wv;
+        
+        wv = (WebView) view.findViewById(R.id.webView1);
+        wv.loadData(url1, mimeType, null);
+
+		return view;
+	}
+
+}

+ 10 - 1
Apex/src/com/usai/apex/ResultActivity.java

@@ -140,6 +140,14 @@ public class ResultActivity extends Activity
 		AdapterContextMenuInfo menuInfo;
 //		menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
 		Log.d("table row select", sel+ "");
+		
+	
+		Intent intent = new Intent();
+		intent.setClass(this, DetailActivity.class);
+		intent.putExtra("Detail", true);
+		intent.putExtra("Tracking", true);
+		intent.putExtra("AMS LOG", true);
+		startActivity(intent);
 		// Cursor cursor = (Cursor) m_ListView
 		// .getItemAtPosition(menuInfo.position);
 		//
@@ -541,6 +549,7 @@ public class ResultActivity extends Activity
 					for (int j = 0; j < showfieldmap.size(); j++)
 					{
 						TextView field1 = new TextView(ResultActivity.this);
+						Log.d("onPostExecute",showfieldmap.get(j));
 						String str = record.get(showfieldmap.get(j));
 						field1.setBackgroundResource(R.drawable.tableitem);
 						if (str.toLowerCase().trim().equals("null"))
@@ -656,7 +665,7 @@ public class ResultActivity extends Activity
 					while (it.hasNext()) // loop for each function
 					{
 						String field_name = (String) it.next();
-						String val = rec.getString(field_name);
+						String val = rec.getString(field_name).replace("\n", "");
 						record.put(field_name, val);
 					}
 					records.add(record);

+ 1 - 0
Apex/src/com/usai/apex/SearchActivity.java

@@ -373,6 +373,7 @@ public class SearchActivity extends ListActivity implements OnClickListener
 			intent.putExtra("function_name", function_name);
 			Bundle parms = new Bundle();
 			parms.putString("module_name",function_name);
+			parms.putString("columns", dbUtil.get_fields(user, function_name));
 			Iterator iter = hashMap.keySet().iterator();
 			while (iter.hasNext())
 			{

+ 8 - 0
Apex/src/com/usai/apex/StatusFragment.java

@@ -0,0 +1,8 @@
+package com.usai.apex;
+
+import android.support.v4.app.Fragment;
+
+public class StatusFragment extends Fragment
+{
+
+}

+ 26 - 0
Apex/src/com/usai/util/commonUtil.java

@@ -0,0 +1,26 @@
+package com.usai.util;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class commonUtil
+{
+	private static final AtomicInteger sNextGeneratedId = new AtomicInteger(1);
+
+	/**
+	 * Generate a value suitable for use in {@link #setId(int)}.
+	 * This value will not collide with ID values generated at build time by aapt for R.id.
+	 *
+	 * @return a generated ID value
+	 */
+	public static int generateViewId() {
+	    for (;;) {
+	        final int result = sNextGeneratedId.get();
+	        // aapt-generated IDs have the high byte nonzero; clamp to the range under that.
+	        int newValue = result + 1;
+	        if (newValue > 0x00FFFFFF) newValue = 1; // Roll over to 1, not 0.
+	        if (sNextGeneratedId.compareAndSet(result, newValue)) {
+	            return result;
+	        }
+	    }
+	}
+}

+ 53 - 39
Apex/src/com/usai/util/dbUtil.java

@@ -1,5 +1,7 @@
 package com.usai.util;
 
+import com.usai.apex.ApexTrackingApplication;
+
 import android.content.ContentValues;
 import android.content.Context;
 import android.database.Cursor;
@@ -14,7 +16,8 @@ import android.util.Log;
 public class dbUtil
 {
 
-	private static final String[] FIELD_ID={ "_id" };
+	private static final String[] FIELD_ID = { "_id" };
+
 	// public static final String ZONECODE
 	// public static final int FILTER_TYPE_MSG = 0;
 	// public static final int FILTER_TYPE_BOTH = 1;
@@ -354,40 +357,29 @@ public class dbUtil
 			boolean writable)
 	{
 
-		SqlOpenHelper dbHelper = new SqlOpenHelper(context, "apex.db",
-				factory, 1);
+		SqlOpenHelper dbHelper = new SqlOpenHelper(context, "apex.db", factory,
+				1);
 		dbHelper.addInitSQL("create table users (" + "_id INTEGER PRIMARY KEY,"
 				+ "name varchar(20)," + "pass varchar(20))");
 
 		// dbHelper.addInitSQL("create table scan_records ("
 		// + "_id INTEGER PRIMARY KEY," + "submit BOOLEAN DEFAULT (0),"
 		// + "picker VARCHAR(20)," + "pid varchar(20))");
-		
-		
+
 		/*
 		 * 
-		 * name : field name
-		 * aname: alias name for display
-		 * field_type: int,bool,varchar...
-		 * function_name: Ocean Booking , Ocean B/L Info., ...
-		 * behavior: search / result
-		 * priority: display order
-		 * show: whether show this field
-		 * abandon: true/false , uses for update auth_info
-		 * user: record owner
-		 * 
-		 * */
-		dbHelper.addInitSQL("CREATE TABLE fields_info (" +
-				"_id INTEGER PRIMARY KEY," +
-				"name VARCHAR(20)," +
-				"aname VARCHAR(20)," +
-				"field_type INTEGER," +
-				"function_name VARCHAR(20)," +
-				"behavior INTEGER," +
-				"priority INTEGER," +
-				"show BOOLEAN," +
-				"abandon BOOLEAN," +
-				"user VARCHAR(20))");
+		 * name : field name aname: alias name for display field_type:
+		 * int,bool,varchar... function_name: Ocean Booking , Ocean B/L Info.,
+		 * ... behavior: search / result priority: display order show: whether
+		 * show this field abandon: true/false , uses for update auth_info user:
+		 * record owner
+		 */
+		dbHelper.addInitSQL("CREATE TABLE fields_info ("
+				+ "_id INTEGER PRIMARY KEY," + "name VARCHAR(20),"
+				+ "aname VARCHAR(20)," + "field_type INTEGER,"
+				+ "function_name VARCHAR(20)," + "behavior INTEGER,"
+				+ "priority INTEGER," + "show BOOLEAN," + "abandon BOOLEAN,"
+				+ "user VARCHAR(20))");
 
 		// dbHelper.addInitSQL("create table pics (" +
 		// "_id INTEGER PRIMARY KEY,"
@@ -471,8 +463,8 @@ public class dbUtil
 		try
 		{
 
-			cursor = db.query(table, FIELD_ID, null, null, null,
-					null, null, "1");
+			cursor = db.query(table, FIELD_ID, null, null, null, null, null,
+					"1");
 			if (cursor.moveToNext())
 			{
 				// cursor.close();
@@ -500,8 +492,8 @@ public class dbUtil
 		try
 		{
 
-			cursor = db.query(table, FIELD_ID, where, null, null,
-					null, null, null);
+			cursor = db.query(table, FIELD_ID, where, null, null, null, null,
+					null);
 			if (cursor.moveToNext())
 				ret = true;
 			else
@@ -520,16 +512,38 @@ public class dbUtil
 		return ret;
 
 	}
-	public static int get_recordid(SQLiteDatabase db, String table,
-			String where)
+
+	public static String get_fields(String user, String module)
+	{
+		SQLiteDatabase db = OpenDB(ApexTrackingApplication.get_instance()
+				.getApplicationContext(), null, false);
+		Cursor cursor = db.query("fields_info", new String[] { "name" },
+				"function_name='" + module + "' and user='" + user
+						+ "' and behavior=" + Network.BEHAVIOR_SEARCH
+						, null, null, null,
+				null, null);
+		String ret="";
+		while (cursor.moveToNext())
+		{
+			ret +=cursor.getString(0);
+			ret +=",";
+			
+		}
+		ret = ret.substring(0,ret.length()-1);
+		CloseCursor(cursor);
+		CloseDB(db);
+		return ret;
+	}
+
+	public static int get_recordid(SQLiteDatabase db, String table, String where)
 	{
 		int ret = -1;
 		Cursor cursor = null;
 		try
 		{
-			
-			cursor = db.query(table, FIELD_ID, where, null, null,
-					null, null, null);
+
+			cursor = db.query(table, FIELD_ID, where, null, null, null, null,
+					null);
 			if (cursor.moveToNext())
 				ret = cursor.getInt(0);
 			else
@@ -538,15 +552,15 @@ public class dbUtil
 		catch (SQLiteException e)
 		{
 			Log.e("sql_err", e.toString());
-			
+
 		}
 		finally
 		{
-			
+
 			dbUtil.CloseCursor(cursor);
 		}
 		return ret;
-		
+
 	}
 
 	// if(isTableEmpty(db,"block_records"))