protected void onListItemClick(ListView list, View view, int position, long id)
{
super.onListItemClick(list, view, position, id);
fname=r.get(position);
fid=s1.get(position);
if(tid!=null)
{
try{
//http post
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://192.168.0.5/staging/android/add_playlist_songs.php?uid="+uid+"&tid="+tid+"&fid="+fid+"&action=add");
System.out.println("addsongurl==="+ur);
System.out.println(httppost);
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
}
catch(Exception e){
Toast.makeText(getBaseContext(),e.toString() ,Toast.LENGTH_LONG).show();
}
//Convert response to string
try
{
BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null)
{
sb.append(line + "\n");
}
is.close();
result = sb.toString();
// Toast.makeText(getBaseContext(),"Song successfully added.",Toast.LENGTH_LONG).show();
}
catch(Exception e)
{
Toast.makeText(getBaseContext(),e.toString() ,Toast.LENGTH_LONG).show();
}
Toast.makeText(this, "Song Added",Toast.LENGTH_SHORT).show();
当我单击列表值时,意味着 url 被击中,当时我想退出此活动并返回 ho?