Just one row in my listview should be sticky .Not sections or section with alphabets in stickyheaders.I really appreciate any help w.r.t listview sticky one row within activity and not fragment.How do I do that ? I really appreciate any help.Thanks in Advance. Using code like :
class MyAsyncTask extends
AsyncTask<String, Integer, ArrayList<HashMap<String, String>>> {
// Hashmap for ListView
ArrayList<HashMap<String, String>> UploadsList = new ArrayList<HashMap<String, String>>();
@Override
protected void onPreExecute() {
// Showing progress dialog before sending http request
pDialog = new ProgressDialog(this);
pDialog.setMessage("Please wait..");
pDialog.setIndeterminate(true);
pDialog.setCancelable(false);
pDialog.show(); }
@Override
protected ArrayList<HashMap<String, String>> doInBackground(
String... params) {
// Creating JSON Parser instance
JSONParser jParser = new JSONParser();
// getting JSON string from URL
JSONObject json = jParser.getJSONFromUrl(url);
try {
// Getting Array of Uploads
uploads = json.getJSONArray(TAG_UPLOADS);
// looping through All Uploads
for (int i = 0; i < uploads.length(); i++) {
JSONObject c = uploads.getJSONObject(i);
// Storing each json item in variable
String id = c.getString(TAG_ID);
String name = c.getString(TAG_NAME);
String date = c.getString(TAG_DATE);
// creating new HashMap
HashMap<String, String> map = new HashMap<String, String>();
// adding each child node to HashMap key => value
map.put(TAG_ID, id);
map.put(TAG_NAME, name);
map.put(TAG_DATE, date);
// adding HashList to ArrayList
UploadsList.add(map);
}
} catch (JSONException e) {
e.printStackTrace();
}
return UploadsList;
}
@Override
protected void onPostExecute(ArrayList<HashMap<String, String>> result) {
pDialog.dismiss();
ListAdapter adapter = new SimpleAdapter(this, result,
R.layout.list_item,
new String[] { TAG_NAME, TAG_ID, TAG_DATE }, new int[] {
R.id.name, R.id.id, R.id.date });
setListAdapter(adapter);
}
}
I wrote this code for Json... Hope this will solve your puzzle.. And you like this...
Its not possible with only ListView.
If I would be in your position I would have used same single item layout (which is going to be used in single item of ListView) as fixed layout, below that I would have my ListView.
Layout1 and Layout2 could be Relative or Linear layout
ItemView1 is the same layout which is going to be used in ListView item layout.
As my first row is going to be constant I will set the values once the view is invoked and the rest will work as usual.