بروز خطا
[message]
اشتراک در سوال
رای ها
[dataList]
بچه خواهشا جواب بدید
ترو خدا یکی به سوالم جواب بده من با استفاده از اموزشی که استاد دادند (feed reader) تونستم خبر های سایت مثلا زومیت رو بخونم ولی نمیدونم چطوری میتونم عکس های اون خبر رو هم بگیرم .تو استک خیلی سرچ زدم اما هیچی که هیچی کمکم کنید .خواهش میکنم
0
0
اطلاعات دقیقی در این مورد ندارم < اما میتونید در مورد کتابخانه Jsoup تحقیق کنید < توی هیمن انجمن هم وجود داره < میتونید با استفاده از این کتابخانه مقدار لینک تصاویر موجود در یک لینک رو بگیرید < و استفاده کنید (10 سال پیش)
0
0
شما تگ رو تو webView نشون بدین درست میشه. (10 سال پیش)
0
0
ترو خدا بیشتر توضیح بدبد (10 سال پیش)
0
0
متن کامل به همراه عکس تو تگ description قرار داره. یعد از خوندن تگ می تونید برای نمایش محتوبات از webView استفاده کنید. جهت نمایش از لینکhttp://stackoverflow.com/questions/8987509/how-to-pass-html-string-to-webview-on-android استفاده کنید. (10 سال پیش)
0
0
متن کامل به همراه عکس تو تگ description قرار داره. یعد از خوندن تگ می تونید برای نمایش محتوبات از webView استفاده کنید. جهت نمایش از لینکhttp://stackoverflow.com/questions/8987509/how-to-pass-html-string-to-webview-on-android استفاده کنید. (10 سال پیش)
0
0
متن کامل به همراه عکس تو تگ description قرار داره. یعد از خوندن تگ می تونید برای نمایش محتوبات از webView استفاده کنید. جهت نمایش از لینکhttp://stackoverflow.com/questions/8987509/how-to-pass-html-string-to-webview-on-android استفاده کنید. (10 سال پیش)
0
0
نه نمیخوام از web view استفاده کنم اگه میشه طریقه استفاده از لایبرری jsoup رو بگید .خودم این کتابخونه برو دانلود کردم ولی نمیدونم چه طور از طریق اون عکس رو بگیرم (10 سال پیش)
0
0
لینک + لینک (10 سال پیش)
0
0
بچه اگه میشه بیشتر توضیح بدید ترو خدا. (10 سال پیش)
0
0
بچه ها هنوز مشکلم حل نشده این مثالی هم که گفتید خوب نبود و فقط برا هون ادرس که خودش داده کار میکرد و من مثلا زدم سایت زومیت هیچ عکسی نمیگیره.کمک کنید (10 سال پیش)
0
0
خود سایت زومیت رو زدی یا feed سایت رو؟ اگه feed رو می خوای باید ابتدا تگ Description رو با Xml Parser بخونی بعد محتویات تگ description رو با Jsoup بتونی parse کنی. (10 سال پیش)
0
0
نه feed رو زدم خواهش میکنم کمکم کنید سعی میکنم جبران کنم (10 سال پیش)
0
0
اگه در قالب یه پروژه بتونید کمکم کنید ممنون میشم .خواهش کمک کنید کارم گیره.خواش میکن خواهششششششششششششششششششش (10 سال پیش)
0
0
من خودم رفتم سراغش اگه اول با xml parser فیلد رو بگیرید و بعد بدین به jsoup مشکلی نداره. من قسمت Jsoup رو دارم که در واقع html می گیره و هر تگ رو که بخوای بر می گردونه. اگه می خواین بزارم. البته همین لینکی که Criss عزیز گذاشته کامل تره. ولی به هر حال پروژه رو تو Eclipse دارم. (10 سال پیش)
0
0
عیب نداره اگه پروژتون کامله یعنی عکس های feed زومیت رو میگیره برام ایمیل کنید.raminkarimi1378@gmail.com (10 سال پیش)
برای این سوال 2 پاسخ وجود دارد.
پاسخ به سوال
Vahid
10 سال پیش
+1
0
خیلی عذر می خوام که دیر شد.
من از لینک @Criss استفاده کردم. ولی بجای ادرس سایت بهش متن داخل تگ description فید زومیت رو دادم.
این کد اکتیوتی:
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import android.app.Activity;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends Activity {
// URL Address
String url = "<html><title>۸۰ درصد صاحبان اپل واچ از سیستم پرداخت اپلپِی استفاده میکنند</title><img src=\"http://zoomit.ir/media/k2/items/cache/2e5898737730df3b1c6dc0608a7c553e_XL.jpg\" alt=\"اپل واچ\"/></div><div class=\"K2FeedIntroText\"><p>بر اساس اطلاعات به دست آمده از وبسايت Wristly که معمولا آمار درآمد شرکت <a href=\"http://zoomit.ir//apple\" target=\"_blank\">اپل </a>را ثبت ميکند، بيش از ?? درصد از صاحبان اپل واچ در آمريکا و بريتانيا از سيستم پرداخت اپل پِي استفاده ميکنند.</p></html>";
ProgressDialog mProgressDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Locate the Buttons in activity_main.xml
Button titlebutton = (Button) findViewById(R.id.titlebutton);
Button descbutton = (Button) findViewById(R.id.descbutton);
Button logobutton = (Button) findViewById(R.id.logobutton);
// Capture button click
titlebutton.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// Execute Title AsyncTask
new Title().execute();
}
});
// Capture button click
descbutton.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// Execute Description AsyncTask
new Description().execute();
}
});
// Capture button click
logobutton.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// Execute Logo AsyncTask
new Logo().execute();
}
});
}
// Title AsyncTask
private class Title extends AsyncTask<Void, Void, Void> {
String title;
@Override
protected void onPreExecute() {
super.onPreExecute();
mProgressDialog = new ProgressDialog(MainActivity.this);
mProgressDialog.setTitle("Android Basic JSoup Tutorial");
mProgressDialog.setMessage("Loading...");
mProgressDialog.setIndeterminate(false);
mProgressDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
// Connect to the web site
Document document = Jsoup.parse(url, "UTF-8");
// Get the html document title
title = document.title();
return null;
}
@Override
protected void onPostExecute(Void result) {
// Set title into TextView
TextView txttitle = (TextView) findViewById(R.id.titletxt);
txttitle.setText(title);
mProgressDialog.dismiss();
}
}
// Description AsyncTask
private class Description extends AsyncTask<Void, Void, Void> {
String desc;
@Override
protected void onPreExecute() {
super.onPreExecute();
mProgressDialog = new ProgressDialog(MainActivity.this);
mProgressDialog.setTitle("Android Basic JSoup Tutorial");
mProgressDialog.setMessage("Loading...");
mProgressDialog.setIndeterminate(false);
mProgressDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
// Connect to the web site
Document document = Jsoup.parse(url, "UTF-8");
// Using Elements to get the Meta data
Elements descriptions = document.select("p");
// Locate the content attribute
for (Element description : descriptions) {
desc = description.ownText();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// Set description into TextView
TextView txtdesc = (TextView) findViewById(R.id.desctxt);
txtdesc.setText(desc);
mProgressDialog.dismiss();
}
}
// Logo AsyncTask
private class Logo extends AsyncTask<Void, Void, Void> {
Bitmap bitmap;
@Override
protected void onPreExecute() {
super.onPreExecute();
mProgressDialog = new ProgressDialog(MainActivity.this);
mProgressDialog.setTitle("Android Basic JSoup Tutorial");
mProgressDialog.setMessage("Loading...");
mProgressDialog.setIndeterminate(false);
mProgressDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
try {
Log.i("LOG", "Start Image");
// Connect to the web site
Document document = Jsoup.parse(url, "UTF-8");
// Using Elements to get the class data
Elements img = document.select("img");
// Locate the src attribute
String imgSrc = img.attr("src");
// Download image from URL
InputStream input;
input = new java.net.URL(imgSrc).openStream();
bitmap = BitmapFactory.decodeStream(input);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Decode Bitmap
return null;
}
@Override
protected void onPostExecute(Void result) {
// Set downloaded image into ImageView
ImageView logoimg = (ImageView) findViewById(R.id.logo);
logoimg.setImageBitmap(bitmap);
mProgressDialog.dismiss();
}
}
}
پاسخ به سوال
Vahid
10 سال پیش
0
0
این هم فایل Xml لایه اکتیویتی:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/titletxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" />
<Button
android:id="@+id/titlebutton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/titletxt"
android:text="@string/Title" />
<TextView
android:id="@+id/desctxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/titlebutton"
android:layout_centerInParent="true"
android:gravity="center" />
<Button
android:id="@+id/descbutton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/desctxt"
android:text="@string/Description" />
<ImageView
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/descbutton"
android:layout_centerInParent="true" />
<Button
android:id="@+id/logobutton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/logo"
android:text="@string/Logo" />
</RelativeLayout>
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .