I have a Rss feed that I am parsing into a list view. What I am trying to do with it is when the user first loads the app, it saves the date or something like that and then only shows Day One of the list. Then when the user logs in the second day it remembers that date from the preference and adds one to it and shows Day One and Day Two in the list view and so forth and so forth. Also, if the user doesn't open the app for a few days it needs to show the days that the user missed as well. For Example, user opens app day one, and day two and sees those articles, then doesn't open the app till day 5, they would still need to see days 1-5 in the list. I am thinking that I can do all this with Shared Preference, however I haven't worked with shared preferences any and haven't found any tutorials that would cover anything I am trying to do here. I will list my code here that I am using. If anyone is willing to work through this issue with me I would greatly appreciate it.
xml parsing activity and listview
public class AndroidXMLParsingActivity extends ListActivity {
// All static variables
static final String URL = "http://www.cpcofc.org/devoapp.xml";
// XML node keys
static final String KEY_ITEM = "item"; // parent node
static final String KEY_ID = "item";
static final String KEY_NAME = "title";
static final String KEY_COST = "description";
static final String KEY_DESC = "description";
static final String KEY_GUID = "guid";
static final String KEY_LINK = "link";
ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();
XMLParser parser = new XMLParser();
String xml = parser.getXmlFromUrl(URL); // getting XML
Document doc = parser.getDomElement(xml); // getting DOM element
NodeList nl = doc.getElementsByTagName(KEY_ITEM);
// looping through all item nodes <item>
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_NAME, parser.getValue(e, KEY_NAME));
map.put(KEY_COST, parser.getValue(e, KEY_COST));
map.put(KEY_DESC, parser.getValue(e, KEY_DESC));
map.put(KEY_GUID, parser.getValue(e, KEY_GUID));
map.put(KEY_LINK, parser.getValue(e,KEY_LINK));
// adding HashList to ArrayList
menuItems.add(map);
}
// Adding menuItems to ListView
ListAdapter adapter = new SimpleAdapter(this, menuItems,
R.layout.list_item,
new String[] { KEY_DESC, KEY_NAME, KEY_COST, KEY_GUID}, new int[] {
R.id.desciption, R.id.name, R.id.cost});
setListAdapter(adapter);
Collections.reverse(menuItems);
// selecting single ListView item
ListView lv = getListView();
lv.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// getting values from selected ListItem
String name = ((TextView) view.findViewById(R.id.name)).getText().toString();
String cost = ((TextView) view.findViewById(R.id.cost)).getText().toString();
Uri uriUrl = Uri.parse(menuItems.get(position).get(KEY_GUID));
// Starting new intent
Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class);
in.putExtra(KEY_NAME, name);
in.putExtra(KEY_COST, cost);
// **NEED TO PASS STRING OBJECT NOT URI OBJECT**
in.putExtra(KEY_GUID, uriUrl.toString());
startActivity(in);
}
});
}
}
and here is a view of what it looks like now
Check the document of SharedPreferences, http://developer.android.com/reference/android/content/SharedPreferences.html, i think what you need in this case is simply get/put values to SharedPreferences, e.g.
public static String getPreference(Application application, String key) {
try {
SharedPreferences preference = PreferenceManager.getDefaultSharedPreferences(application);
return preference.getString(key, "");
} catch (Exception e) {
return ""
}
}
public static void putPreference(Application application, String key, String value) {
try {
SharedPreferences preference = PreferenceManager.getDefaultSharedPreferences(application);
preference.edit().putString(key, value).commit();
} catch (Exception e) {
Log.d("...", e.getMessage());
}
}
Manipulate SharedPreference is simple, but to implement your requirement you need to think how to design the key of SharedPreferences.
A quick thought is that the key can be formed as 'post-20130101', 'post-20130102', etc. In this case, you can put the date string into key, when you want to fetch rss data within a period, you can then build corresponding keys. And you can try SharedPreferences.getAll() to fetch all data and then filter based on date in memory.
However, i think another choice is to use sqlite database. Using sql to filter on date column is more suitable for this kind of requirement in my opinion.
Related
This question already has answers here:
How can I fix 'android.os.NetworkOnMainThreadException'?
(66 answers)
Closed 9 years ago.
My android app with json part in Mainactivity is not working on 4.2(api 17)
(Unfortunately app has stopped) dialogbox appears .
but is working properly in 2.2(api 8),2.3.5(api 10) .
Is there any problem with "android versions" with same code on different devices. ?
private static String url = "http://api.androidhive.info/contacts/";
// JSON Node names
private static final String TAG_CONTACTS = "contacts";
private static final String TAG_ID = "id";
private static final String TAG_NAME = "name";
private static final String TAG_EMAIL = "email";
private static final String TAG_PHONE = "phone";
private static final String TAG_PHONE_MOBILE = "mobile";
// contacts JSONArray
JSONArray contacts = null;
Button login_btn,other;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);// Hashmap for ListView
ArrayList<HashMap<String, String>> contactList = new ArrayList<HashMap<String, String>>();
// Creating JSON Parser instance
JSONParser jParser = new JSONParser();
// getting JSON string from URL
JSONObject json = jParser.getJSONFromUrl(url);
try {
// Getting Array of Contacts
contacts = json.getJSONArray(TAG_CONTACTS);
// looping through All Contacts
for(int i = 0; i < contacts.length(); i++){
JSONObject c = contacts.getJSONObject(i);
// Storing each json item in variable
String id = c.getString(TAG_ID);
String name = c.getString(TAG_NAME);
String email = c.getString(TAG_EMAIL);
// Phone number is agin JSON Object
JSONObject phone = c.getJSONObject(TAG_PHONE);
String mobile = phone.getString(TAG_PHONE_MOBILE);
// 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_EMAIL, email);
map.put(TAG_PHONE_MOBILE, mobile);
// adding HashList to ArrayList
contactList.add(map);
}
} catch (JSONException e) {
e.printStackTrace();
}
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(this, contactList,
R.layout.list_item,
new String[] { TAG_NAME, TAG_EMAIL, TAG_PHONE_MOBILE }, new int[] {
R.id.name, R.id.email, R.id.mobile });
setListAdapter(adapter);
// selecting single ListView item
ListView lv = getListView();
// Launching new screen on Selecting Single ListItem
lv.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// getting values from selected ListItem
String name = ((TextView) view.findViewById(R.id.name)).getText().toString();
String cost = ((TextView) view.findViewById(R.id.email)).getText().toString();
String description = ((TextView) view.findViewById(R.id.mobile)).getText().toString();
// Starting new intent
Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class);
in.putExtra(TAG_NAME, name);
in.putExtra(TAG_EMAIL, cost);
in.putExtra(TAG_PHONE_MOBILE, description);
startActivity(in);
}
});
Recent android versions do not allow you to do activities such as network operations, in your main thread as they could result in ANR. So, the recommended and correct way to download your json would be through an AsyncTask.
It's androidhive not bothering to update their tutorials again. If you look at
public JSONObject getJSONFromUrl,
then you will see that they do indeed do their networking on the main thread as battery as suggested. Also they don't even catch the NetworkOnMainThreadException which your code will undoubtedly throw. You need to move your networking off the UI thread.
I wanna ask something about android programming..
I create a class that return display from rss xml file to android but i get some error
04-08 14:37:19.162: E/AndroidRuntime(381):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.xmlreader/com.example.xmlreader.MainActivity}:
java.lang.NullPointerException
Code:
static final String URL = "http://api.androidhive.info/pizza/?format=xml";
// XML node keys
static final String KEY_ITEM = "item"; // parent node
static final String KEY_ID = "id";
static final String KEY_NAME = "name";
static final String KEY_COST = "cost";
static final String KEY_DESC = "description";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();
XMLParser parser = new XMLParser();
String xml = parser.getXMLFromURL(URL); // getting XML
Document doc = parser.getDomElem(xml); // getting DOM element
(*) NodeList nl = doc.getElementsByTagName(KEY_ITEM);
// looping through all item nodes <item>
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_NAME, parser.getValue(e, KEY_NAME));
map.put(KEY_COST, "Rs." + parser.getValue(e, KEY_COST));
map.put(KEY_DESC, parser.getValue(e, KEY_DESC));
// adding HashList to ArrayList
menuItems.add(map);
}
// Adding menuItems to ListView
ListAdapter adapter = new SimpleAdapter(this, menuItems,
R.layout.list_item,
new String[] { KEY_NAME, KEY_DESC, KEY_COST }, new int[] {
R.id.name, R.id.desciption, R.id.cost });
setListAdapter(adapter);
// selecting single ListView item
ListView lv = getListView();
lv.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// getting values from selected ListItem
String name = ((TextView) view.findViewById(R.id.name)).getText().toString();
String cost = ((TextView) view.findViewById(R.id.cost)).getText().toString();
String description = ((TextView) view.findViewById(R.id.desciption)).getText().toString();
// Starting new intent
Intent in = new Intent(getApplicationContext(), SingleActivity.class);
in.putExtra(KEY_NAME, name);
in.putExtra(KEY_COST, cost);
in.putExtra(KEY_DESC, description);
startActivity(in);
}
});
}
the error in line 38 or line i was give (*) this mark...
pleas help me...
If the nullpointer is coming up on below line (with *):
(*) NodeList nl = doc.getElementsByTagName(KEY_ITEM); //i reckon the nullpointer is coming up on the doc object...
Then I reckon to check whether the xml which is being retrieved from the getXMLFromURL method
is correct?:
XMLParser parser = new XMLParser();
String xml = parser.getXMLFromURL(URL); // getting XML (Is this correctly retreived?
Document doc = parser.getDomElem(xml); // getting DOM element (This is returning null)
For more help share your XMLParser class
You need to use a Thread or AsyncTask to perform the "Networking Operations". Otherwise you will get NetworkOnMainThreadException. read this
Add permission to AndroidManifest.xml.
<uses-permission android:name="android.permission.INTERNET"/>
An example using a Thread
menuItems = new ArrayList<HashMap<String, String>>();
final XMLParser parser = new XMLParser();
Thread th = new Thread(new Runnable() {
#Override
public void run() {
xml = parser.getXmlFromUrl(URL);
handler.post(new Runnable() { //create an object of Handler class in onCreate() - (android.os.Handler)
#Override
public void run() {
Document doc = parser.getDomElement(xml);
nl =doc.getElementsByTagName(KEY_ITEM);
//other code inside onCreate() - for loop
}
});
}
}
th.start();
SimpleAdapter adapter = new SimpleAdapter(this, menuItems, R.layout.list_item,
new String[]{KEY_NAME, KEY_COST, KEY_DESCRIPTION}, new int[]{R.id.name, R.id.cost, R.id.description});
setListAdapter(adapter);
I have a big xml file(Around 100+ Items), how do you filter the download according to "String KEY_ID = "id";" in an XML? Below is the sample of my XML code. Example, I want to list out the item "String KEY_ID = "id";" from 1 - 20 to show in my gridview. My objective is to limit the xmlparsing. Currently my codes just downloads everything in my xml and shows them in gridview.
myXML.xml
<song>
<id>1</id>
<title>1</title>
<artist>Blabla</artist>
<duration>0</duration>
<thumb_url>https://jpg</thumb_url>
<big_url>https://jpg</big_url>
</song>
<song>
<id>2</id>
<title>2</title>
<artist>Nature</artist>
<duration>0</duration>
<thumb_url>https://jpg</thumb_url>
<big_url>https://jpg</big_url>
</song>
<song>
<id>3</id>
<title>3</title>
<artist>Nature</artist>
<duration>0</duration>
<thumb_url>https://jpg</thumb_url>
<big_url>https://jpg</big_url>
</song>
</music>
MainGridView.class
public class MainGridView extends Activity {
private ProgressDialog pDialog;
ArrayList<HashMap<String, String>> songsList;
static final String KEY_SONG = "song";
static final String KEY_ID = "id";
static final String KEY_TITLE = "title";
static final String KEY_ARTIST = "artist";
static final String KEY_CAT_ARTIST = "artistcat";
static final String KEY_DURATION = "duration";
static final String KEY_THUMB_URL = "thumb_url";
static final String KEY_BIG_URL = "big_url";
static final String KEY_CAT_URL = "cat_url";
static String IMAGE_POSITION;
GridView grid;
MainGridViewLazyAdapter adapter;
String cat_url;
String artist_url;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gridview_main);
new loadGridView().execute();
grid = (GridView) findViewById(R.id.grid_view);
public class loadGridView extends AsyncTask<Integer, String, String> {
#Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(MainGridView.this);
pDialog.setTitle("Connect to Server");
pDialog.setMessage("This process can take a few seconds to a few minutes, depending on your Internet Connection Speed.");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
}
#Override
protected String doInBackground(Integer... args) {
// updating UI from Background Thread
Intent in = getIntent();
songsList = new ArrayList<HashMap<String, String>>();
cat_url = in.getStringExtra(KEY_CAT_URL);
artist_url = in.getStringExtra(KEY_CAT_ARTIST);
XMLParser parser = new XMLParser();
String xml = parser.getXmlFromUrl(cat_url); // getting XML from URL
Document doc = parser.getDomElement(xml); // 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_THUMB_URL, parser.getValue(e, KEY_THUMB_URL));
map.put(KEY_BIG_URL, parser.getValue(e, KEY_BIG_URL));
// adding HashList to ArrayList
songsList.add(map);
}
return null;
}
#Override
protected void onPostExecute(String args) {
adapter=new MainGridViewLazyAdapter(MainGridView.this, songsList);
grid.setAdapter(adapter);
pDialog.dismiss();
}
}
XML parsing is actually usually pretty fast (faster than JSON in some phones). But to display just some of the document you might want to look into XPath (java.xml.xpath) - e.g.:
/music/song[id <= 20]
See http://developer.android.com/reference/javax/xml/xpath/package-summary.html
Hi i wrote one xml parsing example.here i have to get the data information from mysql database and display it in android emulator successfully.
this is my code:
public class CustomizedListView extends Activity {
// All static variables
static final String URL = "http://192.168.1.168/xcart432pro/orderdetails.xml";
// XML node keys
static final String KEY_SONG = "Order"; // parent node
static final String KEY_ID = "orderid";
static final String KEY_TITLE = "orderid";
static final String KEY_ARTIST = "payment_method";
static final String KEY_DURATION = "total";
ListView list;
LazyAdapter adapter;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>();
XMLParser parser = new XMLParser();
String xml = parser.getXmlFromUrl(URL); // getting XML from URL
Document doc = parser.getDomElement(xml); // 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));
// 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() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
String Orderid= ((TextView) view.findViewById(R.id.title)).getText().toString();
String Price = ((TextView) view.findViewById(R.id.duration)).getText().toString();
String Description = ((TextView) view.findViewById(R.id.artist)).getText().toString();
// Starting new intent
Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class);
in.putExtra(KEY_TITLE, Orderid);
in.putExtra(KEY_DURATION, Price);
in.putExtra(KEY_ARTIST, Description);
startActivity(in);
}
});
}
}
dis is my singlemenuitem.java class is:
public class SingleMenuItemActivity extends Activity {
// XML node keys
static final String KEY_TITLE = "orderid";
static final String KEY_ARTIST = "payment_method";
static final String KEY_DURATION = "total";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.single_list_item);
// getting intent data
Intent in = getIntent();
// Get XML values from previous intent
String product = in.getStringExtra(KEY_DURATION);
String login = in.getStringExtra(KEY_TITLE);
String description = in.getStringExtra(KEY_ARTIST);
// Displaying all values on the screen
TextView lblName = (TextView) findViewById(R.id.name_label);
TextView lblPName = (TextView) findViewById(R.id.cost_label);
TextView lblDesc = (TextView) findViewById(R.id.description_label);
lblName.setText(login);
lblPName.setText(product);
lblDesc.setText(description);
}
}
Here i have to successfully displayed on android emulator.
but i wish to display on first page orderid and payment_method only.then it is move to next page means have to display total for that particular id.please give me solutions.how can i to do.i wish to my output is :
if i clicked 13 means that particular order total only displayed on next activity.
How is to do.please help me.
i got the answer.if u need hide the "description" field by adding andorid:visibility="gone" to description label in your xml file. So that the description filed will be present in listview but it won't be visible.
Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class);
in.putExtra("KEY_TITLE", Orderid);
in.putExtra("KEY_DURATION", Price);
in.putExtra("KEY_ARTIST", Description);
startActivity(in);
singlemenuitem.java
product = getIntent().getExtras().getString("KEY_TITLE");
login = getIntent().getExtras().getString("KEY_DURATION");
description = getIntent().getExtras().getInt("KEY_ARTIST");
My list view is parsed from a online resource, but i cant get the listview to pass the image src to the single list item
SingleMenuItemActivity
static final String KEY_SONG = "song";
static final String KEY_ARTIST = "artist";
static final String KEY_THUMB_URL = "thumb_url";
static final String KEY_DURATION = "duration";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.libraryonclick);
// getting intent data
Intent in = getIntent();
// Get XML values from previous intent
String song = in.getStringExtra(KEY_SONG);
String artist = in.getStringExtra(KEY_ARTIST);
String thumb_url = in.getStringExtra(KEY_THUMB_URL);
String duration = in.getStringExtra(KEY_DURATION);
// Displaying all values on the screen
TextView lblSong = (TextView) findViewById(R.id.textView1);
TextView lblArtist = (TextView) findViewById(R.id.textView2);
Drawable imgThumb = ((ImageView)findViewById(R.id.onclickthumb)).getDrawable(); // thumb image
TextView lblDuration = (TextView) findViewById(R.id.textView3);
Button link3Btn = (Button)findViewById( R.id.button1 );
link3Btn.setOnClickListener( new View.OnClickListener()
{
public void onClick(View v)
{
Uri uri = Uri.parse("http://google.com");
startActivity( new Intent( Intent.ACTION_VIEW, uri ) );
}
});
lblSong.setText(song);
lblArtist.setText(artist);
lblDuration.setText(duration);
imgThumb.setImageResource(thumb_url);
//Maybe more code here?
}
ListViewActivity
public class CustomizedListView extends Activity {
// All static variables
static final String URL = "http://dl.dropbox.com/u/48258247/music.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_THUMB_URL = "thumb_url";
ListView list;
LazyAdapter adapter;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.library);
ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>();
XMLParser parser = new XMLParser();
String xml = parser.getXmlFromUrl(URL); // getting XML from URL
Document doc = parser.getDomElement(xml); // 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_THUMB_URL, parser.getValue(e, KEY_THUMB_URL));
// 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) {
// getting values from selected ListItem
String song = ((TextView) view.findViewById(R.id.title)).getText().toString();
String artist = ((TextView) view.findViewById(R.id.artist)).getText().toString();
String thumb_url = ((TextView) view.findViewById(R.id.list_image)).getText().toString();
String duration = ((TextView) view.findViewById(R.id.duration)).getText().toString();
// Starting new intent
Intent in = new Intent(CustomizedListView.this, org.scouts.library.SingleMenuItem.class);
in.putExtra(KEY_SONG, song);
in.putExtra(KEY_ARTIST, artist);
in.putExtra(KEY_THUMB_URL, thumb_url);
in.putExtra(KEY_DURATION, duration);
startActivity(in);
}
});
}
i think i need to parse through the imageloader class maybe
You can simply try this one -
URL url = new URL("http://image10.bizrate-images.com/resize?sq=60&uid=2216744464");
Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
imageView.setImageBitmap(bmp);
Create one ImageView in your CustomizedListView class and oncreate() method receive url path from the calling file through intent. And paste it in below code and try it.
And, have a look this example