Displaying Images

by JavaAndroid » Wed, 15 Oct 2008 14:40:45 GMT


Sponsored Links
 Hi All,
Can anyone direct me to some links / tutorials that will help me to
start experimenting on displaying images in Android . Is there any way
to add Servlet/JSP API in Android Application. Can i refer image that
is residing in a web server.

Thanks in Advance

Thanks
JavaAndroid
--~--~---------~--~----~------------~-------~--~----~



Displaying Images

by shailesh prakash » Wed, 15 Oct 2008 14:45:52 GMT


 Hi,
you may like to try this :
 http://code.google.com/p/apps-for-android/source/browse/trunk/Photostream/src/com/google/android/photostream/?r=73 




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Displaying Images

by JavaAndroid » Wed, 15 Oct 2008 14:55:57 GMT


 Hi Shailesh,
Thanks a lot for ur Help. Let me try that...Thanks again.




--~--~---------~--~----~------------~-------~--~----~



Displaying Images

by JavaAndroid » Fri, 17 Oct 2008 19:57:01 GMT


 i All,
I tried displaying a small image in ContentView. But when i run the
application It says ImageApplication closed unexpectedly....

This is my Activity Class...

public class ImageApplication extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
((Gallery) findViewById(R.id.gallery))
.setAdapter(new ImageAdapter(this));
}
}

And my Image Adapter class is this
public class ImageAdapter extends BaseAdapter {
/** The parent context */
private Context myContext;

/** All images to be displayed.
* Put some images to project-folder:
* '/res/drawable/uvw.xyz' .*/
private int[] myImageIds = {
R.drawable.image1


};
/** Simple Constructor saving the 'parent' context. */
public ImageAdapter(Context c) { this.myContext = c; }

/** Returns the amount of images we have defined. */
public int getCount() { return this.myImageIds.length; }

/* Use the array-Positions as unique IDs */
public Object getItem(int position) { return position; }
public long getItemId(int position) { return position; }

/** Returns a new ImageView to
* be displayed, depending on
* the position passed. */
public View getView(int position, View convertView, ViewGroup
parent) {
ImageView i = new ImageView(this.myContext);

i.setImageResource(this.myImageIds[position]);
/* Image should be scaled as width/height are set. */
i.setScaleType(ImageView.ScaleType.FIT_XY);
/* Set the Width/Height of the ImageView. */
i.setLayoutParams(new Gallery.LayoutParams(150, 150));
return i;
}

/** Returns the size (0.0f to 1.0f) of the views
* depending on the 'offset' to the center. */
public float getScale(boolean focused, int offset) {
/* Formula: 1 / (2 ^ offset) */
return Math.max(0, 1.0f / (float)Math.pow(2,
Math.abs(offset)));
}

}

When i run the appliction i m getting this Exception in console...
10-17 17:14:09.864: ERROR/AndroidRuntime(203):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.dreamapp.imageapplication.activity/
com.dreamapp.imageapplication.activity.ImageApplication}:
java.lang.NullPointerException
10-17 17:14:09.864: ERROR/AndroidRuntime(203): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2140)
10-17 17:14:09.864: ERROR/AndroidRuntime(203): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2156)
10-17 17:14:09.864: ERROR/AndroidRuntime(203): at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
10-17 17:14:09.864: ERROR/AndroidRuntime(203): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580)
10-17 17:14:09.864: ERROR/AndroidRuntime(203): at
android.os.Handler.dispatchMessage(Handler.java:88)
10-17 17:14:09.864: ERROR/AndroidRuntime(203): at
android.os.Looper.loop(Looper.java:123)
10-17 17:14:09.864: ERROR/AndroidRuntime(203): at
android.app.ActivityThread.main(ActivityThread.java:3742)
10-17 17:14:09.864: ERROR/AndroidRuntime(203): at
java.lang.reflect.Method.invokeNative(Native Method)
10-17 17:14:09.864: ERROR/AndroidRuntime(203): at
java.lang.refl



Displaying Images

by JavaAndroid » Sun, 19 Oct 2008 02:32:20 GMT


 i All,
I figured out the problem....the problem is with main.xml....
Earlier it was
<Gallery d="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
/>
i changed it to
this
<Gallery android:id="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
/>
this resolved the error...
Thanks
JavaAndroid

On Oct 17, 4:56pm, JavaAndroid <[EMAIL PROTECTED]> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Level-List

trying to utilize the level-list drawable class

example showed is:

<level-list xmlns:android="http://schemas.android.com/apk/res/
android">
  <item android:maxLevel="0" android:drawable="@drawable/
ic_wifi_signal_1" />
  <item android:maxLevel="1" android:drawable="@drawable/
ic_wifi_signal_2" />
  <item android:maxLevel="2" android:drawable="@drawable/
ic_wifi_signal_3" />
  <item android:maxLevel="3" android:drawable="@drawable/
ic_wifi_signal_4" />
 </level-list>

However, eclipse keeps giving me and error of invalid start tag level-
list.
Anyone know how I can fix this?

--

2. Buying your apps/games (also hiring)

Hi, I'm really very interested in buying a license of some great
Android apps and games - please email d...@dominicreeves.com

Also, with a number of projects that need to be built, I'm hiring!

Thank you
Dominic

-- 

3. Keeping notification at the status bar after the service that spawned stops

4. Windows Phone and XNA. Nightmare is real. What we do with that ?

5. Best practice to test what happens when my application is killed

6. reading serial data from the USB port.

7. Question about creating a thumbnail (more than one thumbnail for one image, avoiding problems with other Gallery-like apps)