Új hozzászólás Aktív témák
-
Sziasztok! Valamit nagyon rosszul csinálhatok mert sem a Picassoval sem az Universal Image Loaderrel nem jutok dűlőre.
Eclipset használok, bemásoltam az Universal Image Loader jar-t a libs folderbe, majd hozzáadtam a build path-hoz. Importok rendben, manifest elvileg rendben, legegyszerűbb műveletre (képbetöltés sima imageviewba) is lefagy.
MainActivity class
package com.picturetest;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;public class MainActivity extends Activity {
ImageView img;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);img = (ImageView) findViewById(R.id.imageView1);
// Create default options which will be used for every
// displayImage(...) call if no options will be passed to this method
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(true).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.defaultDisplayImageOptions(defaultOptions).build();
ImageLoader.getInstance().init(config); // Do it on Application startString imageUri = "file://mnt/sdcard/default.png";
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.displayImage(imageUri, img);
}
}activity_main.xml
<RelativeLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
tools:context="com.picturetest.MainActivity"><ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/ic_launcher" /></RelativeLayout>
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.picturetest"
android:versionCode="1"
android:versionName="1.0" ><uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" /><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Include following permission if you load images from Internet -->
<uses-permission android:name="android.permission.INTERNET" /><application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.picturetest.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>Az eclipse projektem feltöltöttem ide.
A fordítás hiba nélkül lefut, de ha elindítom az appot azonnal fagy. A default.png is a helyén van. Nexus 5
Mit csinálok rosszul?
Új hozzászólás Aktív témák
- Gigabyte RX 6700 XT EAGLE 12G Szép állapotban 1. tulajtól, 2026.04.14-ig garanciális
- Microsoft Surface Book 3 15 i7 / 32GB / 512GB SSD / Windows 11 Pro
- Macbook air M4 15col, éjfekete, magyar
- ASUS ROG Strix OLED XG27AQDMGR (1440p,240Hz,TrueBlack Glossy,G-Sync) 3év garanciával!
- Tamron SP 150-600mm f/5-6.3 Di VC USD G2 ( Canon ) - Újszerű -
- Lenovo ThinkPad L13 Gen 3 i5-1245U FHD+ 16GB 512GB 1 év teljeskörű garancia
- HP Elite x2 1012 G1,12",FHD+ ,m5-6Y54,8GB,256GB,WIN10, LTE
- ÚJ Lenovo Yoga 7 - 14" WUXGA OLED - Intel Ultra 5 226V - 16GB - 512GB - Win11 -3 év gari - HUN - PEN
- ÁRGARANCIA! Épített KomPhone i5 12400F 16/32/64GB RAM RTX 3060 12GB GAMER PC termékbeszámítással
- BESZÁMÍTÁS! HP Elitebook 745 G6 14 üzleti notebook - R5 3500U 16GB DDR4 256GB SSD Vega 8 IGP WIN11
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest

