Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>try the following:</p> <pre><code> public class ImageURL extends ListActivity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (android.os.Build.VERSION.SDK_INT &gt; 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(policy); } try { URL url = new URL( "http://devcms.barcodo.com/Images/ProductImages/ThumbnailImages100/EG-BIRT-ST-JA_th.jpg"); HttpGet httpRequest = null; httpRequest = new HttpGet(url.toURI()); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = (HttpResponse) httpclient .execute(httpRequest); HttpEntity entity = response.getEntity(); BufferedHttpEntity b_entity = new BufferedHttpEntity(entity); InputStream input = b_entity.getContent(); bitmap = BitmapFactory.decodeStream(input); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedURLException e) { Log.e("log", "bad url"); } catch (IOException e) { Log.e("log", "io error"); } setListAdapter(new StudentListAdapter(this)); } private class StudentListAdapter extends BaseAdapter { private Context mContext; private String[] mStudents = { "DurgaPrasad", "Raghu", "Vivek", "Satish", "Naga Jyothi", "Vardhika", "Nikhil" }; private String[] mDetailsStudent = { "Details of DurgaPrasad", "Details of Raghu This row is not created using java", "Details of Vivek", "Details of Satish", "Details of Naga Jyothi", "Details of Vardhika", "Details of Nikhil" }; public StudentListAdapter(Context context) { mContext = context; } public int getCount() { return mStudents.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { System.out.println("111111111111 : " + position); LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); /* * if (position == 0) { * System.out.println("111111111111 : "+position); v = * vi.inflate(R.layout.studentdetailsrow, null); * System.out.println("111111111111 : "+position); } else */ v = vi.inflate(R.layout.list_item, null); } ImageView iv = (ImageView) v.findViewById(R.id.icon); ImageView iv2 = (ImageView) v.findViewById(R.id.icon2); if (position == 0) { iv.setImageBitmap(bitmap); // iv2.setImageResource(R.drawable.icon); } else { iv.setImageBitmap(bitmap); // iv2.setImageResource(R.drawable.icon); } TextView tvname = (TextView) v.findViewById(R.id.stuname); TextView tvdetail = (TextView) v.findViewById(R.id.studetail); tvname.setText(mStudents[position]); tvdetail.setText(mDetailsStudent[position]); return v; } }; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload