Many thanks kalandar ,

yes , as you mentioned at first the,,, second listview in another
activity  that related to first see my xml :

<music>
    <item>
        <id>.......</id>
        <title>.....</title>
        <Description>...... </Description>
 <a1>..... </a1>
<duration>......</duration>
<duration2>........</duration2>
<thumb_url>..........</thumb_url>
        <shortcodeZ>........</shortcodeZ>
<commandZ>........</commandZ>

</music>



that when click in item in the first listview the go to aother listview
,,,how i can make this listview ?

thanks,,,







On Mon, Feb 27, 2012 at 8:45 AM, kalandar <kasimk...@gmail.com> wrote:

> hi hazim omies.
>      I understood your code. But still i didn't understand what is
> your need.
> If you want to pass the clicked HashMap  value to another activity
> means you can use this code
>
>  Intent in = new Intent(getApplicationContext(),
> SingleMenuItemActivity.class);
>   in.putExtra("mapvalue", map );
>
> map is the object name of your HashMap.
>
> or else you want to create another listview in the same activity means
> let me know the xml values.
> better explain your need clearly...
>
> regards
> kalandar....
>
> On Feb 25, 6:09 am, hazem omies <hazem.om...@gmail.com> wrote:
> > hi kalandar ,
> >
> > i make the first listview using HashMap but i cant make the seconed
> > list because i need to pass value from one list to another related to
> > one ,,,plz see my code below
> > package test.packag;
> >
> > import java.io.InputStream;
> > import java.util.ArrayList;
> > import java.util.HashMap;
> >
> > import org.w3c.dom.Document;
> > import org.w3c.dom.Element;
> > import org.w3c.dom.NodeList;
> >
> > import aljamal.packag.R;
> > import aljamal.packag.XMLParser;
> > import android.app.Activity;
> > import android.content.Intent;
> > import android.os.Bundle;
> > import android.view.View;
> > import android.widget.AdapterView;
> > import android.widget.TextView;
> > import android.widget.AdapterView.OnItemClickListener;
> > import android.widget.ListView;
> >
> > public class test extends Activity {
> >         // All static variables
> >         static final String URL = "http://192.168.0.197/test.xml";;
> >         // XML node keys
> >         static final String KEY_SONG = "song"; // parent node
> >         static final String KEY_ID = "id";
> >         static final String KEY_TITLE = "title";
> >         static final String KEY_ARTIST = "artist";
> >         static final String KEY_DURATION = "duration";
> >         static final String KEY_DURATION2 = "duration2";
> >         static final String KEY_A1 = "a1";
> >         static final String KEY_THUMB_URL = "thumb_url";
> >         static final String KEY_SCZ = "shortcodeZ";
> >         static final String KEY_CMZ = "commandZ";
> >
> > ListView list;
> >     LazyAdapter adapter;
> >
> >         @Override
> >         public void onCreate(Bundle savedInstanceState) {
> >                 super.onCreate(savedInstanceState);
> >                 setContentView(R.layout.main2);
> >
> >                 ArrayList<HashMap<String, String>> songsList = new
> > ArrayList<HashMap<String, String>>();
> >
> >                 XMLParser parser = new XMLParser();
> >                 InputStream is= parser.getStream(URL); // getting XML
> >                 Document doc = parser.getDomElement(is); // getting DOM
> element
> >
> >                 NodeList nl = doc.getElementsByTagName(KEY_SONG);
> >                 // looping through all song nodes <song>
> >                 for (int i = 0; i < nl.getLength(); i++) {
> >                         // creating new HashMap
> >                         HashMap<String, String> map = new
> HashMap<String, String>();
> >                         Element e = (Element) nl.item(i);
> >                         // adding each child node to HashMap key => value
> >                         map.put(KEY_ID, parser.getValue(e, KEY_ID));
> >                         map.put(KEY_TITLE, parser.getValue(e,
> KEY_TITLE));
> >                         map.put(KEY_ARTIST, parser.getValue(e,
> KEY_ARTIST));
> >                         map.put(KEY_DURATION, parser.getValue(e,
> KEY_DURATION));
> >                         map.put(KEY_DURATION2, parser.getValue(e,
> KEY_DURATION2));
> >                         map.put(KEY_THUMB_URL, parser.getValue(e,
> KEY_THUMB_URL));
> >                         map.put(KEY_SCZ, parser.getValue(e, KEY_SCZ));
> >                         map.put(KEY_CMZ, parser.getValue(e, KEY_CMZ));
> >                         map.put(KEY_A1, parser.getValue(e, KEY_A1));
> >
> >                         // adding HashList to ArrayList
> >                         songsList.add(map);
> >                 }
> >
> >                 list=(ListView)findViewById(R.id.list);
> >
> >                 // Getting adapter by passing xml data ArrayList
> >         adapter=new LazyAdapter(this, songsList);
> >         list.setAdapter(adapter);
> >
> >         // Click event for single list row
> >
> >         list.setOnItemClickListener(new OnItemClickListener() {
> >
> >                         public void onItemClick(AdapterView<?> parent,
> View view,
> >                                         int position, long id) {
> >
> >                                 String title = ((TextView)
> > view.findViewById(R.id.title)).getText().toString();
> >                                 String artist =((TextView)
> > view.findViewById(R.id.artist)).getText().toString();
> >                                 String duration =((TextView)
> > view.findViewById(R.id.duration)).getText().toString();
> >                                 String du2 =((TextView)
> > view.findViewById(R.id.du2)).getText().toString();
> >                                 String A1 =((TextView)
> > view.findViewById(R.id.A1)).getText().toString();
> >                                 String SCZ =((TextView)
> > view.findViewById(R.id.SCZ)).getText().toString();
> >                                 String CMZ =((TextView)
> > view.findViewById(R.id.CMZ)).getText().toString();
> >
> >                                 Intent in = new
> Intent(getApplicationContext(),
> > SingleMenuItemActivity.class);
> >
> >                                 in.putExtra("firstVariableToPass",
> "Passing a string");
> >                                 in.putExtra(KEY_TITLE, title);
> >                                 in.putExtra(KEY_ARTIST, artist);
> >                                 in.putExtra(KEY_A1, A1);
> >                                 in.putExtra(KEY_DURATION, duration);
> >                                 in.putExtra(KEY_DURATION2, du2);
> >                                 in.putExtra(KEY_SCZ, SCZ);
> >                                 in.putExtra(KEY_CMZ, CMZ);
> >
> >                                 in.putExtra("secondVariableToPass", 65);
> >                                 startActivity(in);
> >
> >                                 //String name = ((TextView)
> > view.findViewById(R.id.title)).getText().toString();
> >
> >                                 //in.putExtra(KEY_TITLE, name);
> >                                 //in.putExtra(KEY_ARTIST, cost);
> >                                 //in.putExtra(KEY_DURATION, description);
> >                                 //in.putExtra(key_Summ1, summary1);
> >                                 //in.putExtra(key_Summ2, summary2);
> >                                 //in.putExtra(key_Summ3, summary3);
> >                                 //in.putExtra(key_Summ4, summary4);
> >
> >                         }
> >                 });
> >         }
> >
> > }
> >
> > On Feb 24, 8:21 am, kalandar <kasimk...@gmail.com> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > hi....
> > > It is very easy. you can use java collection classes.
> > > I think HashMap will help you to do this work.
> > > If you explain your process clearly then i can say the solution....
> >
> > > On Feb 23, 7:20 pm,hazemomies <hazem.om...@gmail.com> wrote:
> >
> > > > hi.....
> >
> > > > i have xml file that read remotely from server and put the data in
> > > > listview  i need a way that this lisview on click item pass this
> value
> > > > to another related listview  ,,,,
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to