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. Sending a Image as a body of email

Hi All,
 I tried to send a image as a body of email.

sendIntent.putExtra(Intent.EXTRA_TEXT, "<HTML><BODY><b><IMG SRC=
\"data:image/jpeg;base64," + uPathYour1.getPath()+".jpg" + "\"  alt =
\"pleaseview this  image\"/></b></BODY></HTML>");

 However email was not received properly with the actual image.

Anybody have tried this??
I can send  image as attachment.I am trying to send multiple images in body
because I couldnt send multiple image attachments once.

Thanks  Regards,
Isuru

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

2. How can I start the ADB Deamon programatically ???

I want to communicate with the ADB Deamon service on device for get
some special data without using ADB server on development machine
(suggest that my application running on device and do not know about
ABD tools, except deamon). Can anyone show me how to do this ??? How
to start the deamon service ? what is its provided function/command ???

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

3. Focusing the spinner object

4. how do real-time monitor the state of SD card

5. Video Decoding Memory buffer

6. Kernels fail to boot on Rogers HTC Dream, but works on other Dream platforms (ADP1, T-Mo G1)

7. Couldn't get connection factory client