Can anyone post a source code so that the image can help me in the image creatively on Android How does my code apply in this dynamic way? Edit: Variables: Get all the image URL strings from one Jeremy file in an array list Load single images in an image view Load an image from the web Get JasonRere from web URL Public static JSONArray getJSONfromURL (string url) {InputStream = Tap; String result = ""; JSONArray jArray = null; HTTP Client HTTP Client = New DefaultHttpClient (); HttpGet httpget = New HttpGet (url); HttpResponse response = null; Try {feedback = httpclient.execute (httpget); } Catch (Client Protocol E) {// Todo Auto-Generated Catch Block e.printStackTrace (); } Grip (IOException E) {// TODO Auto-Generated Catch Block e.printStackTrace (); } {HttpEntity unit = response. try] (); Is = entity.getContent (); Buffer Reader = Faucet; Reader = New BufferedReader (New InputStreamRadder ("ISO-885 9-1"), 8); Stringbilder sb = new stringbiller (); String line = null; While ((line = reader. Readline ())! = Null () {sb.append (row + "\ n"); } is close(); Result = sb.toString (); JArray = New JSONArray (results); } Grip (Exception E) {// TODO Auto generated blocking block e.printStackTrace (); } Return Jarre; } I hope this is what you want ...... Jai Mata Di ..... Secure vs. Create (Bundle Saved InstantState) {super.onCreate (SavedInstanceState); SetContentView (R.layout.activity_main); Textview label = new text view (this); Label.setText (R.string.my_text_label); Label.setTextSize (20); Label.setGravity (Gravity.CENTER_HORIZONTAL); ImageView Images = New Image View (this); Images.setImageResource (R.drawable.raise); // images.SettleoutPar (new layoutprimm (layout perm. WRAP_CONTENT, layout para. WRAP_CONTENT)); Images.setAdjustViewBounds (true); Images.setScaleType (ScaleType.FIT_XY); Images.setMaxHeight (250); Images.setMaxWidth (250); LinearLayout ll = new LinearLayout (this); Ll.setOrientation (LinearLayout.VERTICAL); // ll.setLayoutParams (new layoutprim (layout parama.philagant, layout parama.philpaint)); Ll.setGravity (Gravity.CENTER); Ll.addView (label); Ll.addView (image); SetContentView (LL);
private arraylists & lt; Hashmap & lt; String, string & gt; & Gt; IMAGE_LIST; Private reference mContext; Private Array List & lt; String & gt; Image_name; Private static final string TAG_Image_Name = "name of your image tag in Jason file"; Public static string url_single_image = "your single image URL string"; Public static string text card_url = "url for your jason file";
public zero getallthumbimages () {image_list = New ArrayList & lt; Hashmap & lt; String, string & gt; & Gt; (); Image_name = New Arrestist & lt; String & gt; (); JSONArray json = getJSONfromURL (general.textcard_url); Try (for {ii = 0; i & lt; json.length (); i ++) {JSONObject c = json.getJSONObject (i); String full_izeb_url = cgst string (TAG_Image_Name); Common.Text_card_name.add (full_Image_Url); Hashmap & lt; String, string & gt; Map = new hashmap & lt; String, string & gt; (); Map.put (TAG_Image_Name, full_Image_Url); Image_list.add (map); }} Hold (JasonX Express E) {e.printStackTrace (); }}
public view Load_Image_from_Url (int position) {ImageView imageView = New ImageView (mContext); String url_image_string = url_single_image + "/" + image_name.get (status); ImageView .setImageDrawable (LoadImageFromWebOperations (url_image_string)); ImageView.setScaleType (ImageView.ScaleType.CENTER_CROP); See return image; }
public static disk load imagedframe webpages (string url) {try {InputStream = ( InputStream) New URL (url) .getContent (); Drawable d = Drawable.createFromStream (is, "src name"); Return D; } Hold (exception e) {return tap; }}
No comments:
Post a Comment