Estoy tratando que mediante una dirección web me descargue una imagen y que me la acople en un layoutlayout
. Por ejemplo si quiero obtener esta imagen: https://www.google.es/images/branding/googleg/1x/googleg_standard_color_128dp.pngesta imagen y que a su vez la acople en un layoutlayout
.
Código XMLXML:
Código JavaJava:
public class intelActivity extends FragmentActivity {
/**
* The pager widget, which handles animation and allows swiping horizontally
* to access previous and next pages.
*/
ViewPager pager = null;
/**
* The pager adapter, which provides the pages to the view pager widget.
*/
MyFragmentPagerAdapter pagerAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_intel);
// StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
//StrictMode.setThreadPolicy(policy);
ImageView graph = (ImageView) findViewById(R.id.graphImageView);
//graph.setImageResource(R.drawable.graph);
Picasso.with(this).load("http://chart.finance.yahoo.com/z?s=GOOG").into(graph);
// Instantiate a ViewPager
this.pager = (ViewPager) this.findViewById(R.id.viewPager);
// Create an adapter with the fragments we show on the ViewPager
MyFragmentPagerAdapter adapter = new MyFragmentPagerAdapter(
getSupportFragmentManager());
adapter.addFragment(ScreenSlidePageFragment.newInstance(getResources()
.getColor(R.color.positivo), 0));
adapter.addFragment(ScreenSlidePageFragment.newInstance(getResources()
.getColor(R.color.negativo), 1));
adapter.addFragment(ScreenSlidePageFragment.newInstance(getResources()
.getColor(R.color.positivo), 2));
adapter.addFragment(ScreenSlidePageFragment.newInstance(getResources()
.getColor(R.color.negativo), 3));
adapter.addFragment(ScreenSlidePageFragment.newInstance(getResources()
.getColor(R.color.positivo), 4));
this.pager.setAdapter(adapter);
new Thread()
{
public void run()
{
while (true) {
try {
Thread.sleep(3000);
Stock stock = null;
try {
stock = YahooFinance.get("bz=f");
} catch (IOException e) {
e.printStackTrace();
}
BigDecimal PRUEBA = stock.getQuote().getChange();
BigDecimal price = stock.getQuote().getPrice();
BigDecimal change = stock.getQuote().getChangeInPercent();
BigDecimal peg = stock.getStats().getPeg();
BigDecimal dividend = stock.getDividend().getAnnualYieldPercent();
System.out.println(price);
System.out.println("----------------------------------");
// stock.print();
}
catch(Exception ex)
{
}
}
}
}.start();
}
}