thanks for the help i will tell u after i successfully run that code.
On Aug 7, 12:10 pm, Aki <[email protected]> wrote:
> this is mythumbnailtest code,i hope it help you.
>
> public void printThumbnails(){
> Uri uri=MediaStore.Images.Thumbnails.getContentUri("external");
>
> Cursor cursor=MediaStore.Images.Thumbnails.queryMiniThumbnails
> (getContentResolver(), uri, MediaStore.Images.Thumbnails.MINI_KIND,
> null);
> int count=cursor.getColumnCount();
>
> for(int i=0;i<count;i++){
> System.out.print(cursor.getColumnName(i)+",");
> }
> System.out.println("");
>
> cursor.moveToFirst();
> while(true){
> for(int i=0;i<count;i++){
> System.out.print(cursor.getString(i)+",");
>
> }
> System.out.println("");
> if(cursor.isLast()){
> break;
> }else{
> cursor.moveToNext();
> }
> }
>
> }
>
> On 8月7日, 午後3:48, jaimin <[email protected]> wrote:
>
> > i put somethumbnailimages into sdcard but same result no images
> > display in emulator
>
> > On Aug 7, 11:30 am, Aki <[email protected]> wrote:
>
> > > Maybe There are no thumbnails.
> > > Open Gallery App and it will make thumbnails.
>
> > > On 8月7日, 午後2:00, jaimin <[email protected]> wrote:
>
> > > > hi thanx for the reply
> > > > you suggest me to specify the sdcardimagebut i don't know how to
> > > > specify sdcard images.
>
> > > > On Jul 28, 9:53 pm, Jack Ha <[email protected]> wrote:
>
> > > > > Your code seems to work fine. Did you see any errors in the logcat
> > > > > output? Did you specify the sdcardimage?
>
> > > > > --
> > > > > Jack Ha
> > > > > Open Source Development Center
> > > > > ・T・ ・ ・Mobile・ stick together
>
> > > > > The views, opinions and statements in this email are those of
> > > > > the author solely in their individual capacity, and do not
> > > > > necessarily represent those of T-Mobile USA, Inc.
>
> > > > > On Jul 28, 3:45 am, jaimin <[email protected]> wrote:
>
> > > > > > hi.
>
> > > > > > i can not view anyimagein my emulator screen
> > > > > > can anyone please tell me where i am doing wrong in my code.
>
> > > > > > this is my code
>
> > > > > > <?xml version="1.0" encoding="utf-8"?>
> > > > > > < manifest
> > > > > > xmlns:android="http://schemas.android.com/apk/res/android"
> > > > > > package="image.Thumbnails" android:versionCode="1"
> > > > > > android:versionName="1.0.0">
> > > > > > < uses-permission
> > > > > > android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
> > > > > > < application android:icon="@drawable/icon"
> > > > > > android:label="@string/app_name">
> > > > > > < activity android:name=".ImageThumbnailsActivity"
> > > > > > android:label="@string/app_name">
> > > > > > < intent-filter>
> > > > > > < action
> > > > > > android:name="android.intent.action.MAIN" />
> > > > > > < category
> > > > > > android:name="android.intent.category.LAUNCHER"/>
> > > > > > </intent-filter>
> > > > > > </activity>
> > > > > > < activity android:name=".ViewImage">
> > > > > > < intent-filter>
> > > > > > < action
> > > > > > android:name="android.intent.action.VIEW" />
> > > > > > < category
> > > > > > android:name="android.intent.category.DEFAULT" />
> > > > > > </intent-filter>
> > > > > > </activity>
> > > > > > </application>
> > > > > > </manifest>
>
> > > > > > packageimage.Thumbnails;
>
> > > > > > import android.app.Activity;
> > > > > > import android.content.Context;
> > > > > > import android.content.Intent;
> > > > > > import android.database.Cursor;
> > > > > > import android.net.Uri;
> > > > > > import android.os.Bundle;
> > > > > > import android.provider.MediaStore;
> > > > > > import android.view.View;
> > > > > > import android.view.ViewGroup;
> > > > > > import android.widget.AdapterView;
> > > > > > import android.widget.BaseAdapter;
> > > > > > import android.widget.GridView;
> > > > > > import android.widget.ImageView;
> > > > > > import android.widget.AdapterView.OnItemClickListener;
>
> > > > > > public class ImageThumbnailsActivity extends Activity {
> > > > > > /** Called when the activity is first created. */
> > > > > > private Cursor imagecursor, actualimagecursor;
> > > > > > private int image_column_index, actual_image_column_index;
> > > > > > GridView imagegrid;
> > > > > > private int count;
> > > > > > @Override
> > > > > > public void onCreate(Bundle savedInstanceState) {
> > > > > > super.onCreate(savedInstanceState);
> > > > > > setContentView(R.layout.main);
> > > > > > init_phone_image_grid();
> > > > > > }
> > > > > > private void init_phone_image_grid() {
> > > > > > String[] img = { MediaStore.Images.Thumbnails._ID };
> > > > > > imagecursor = managedQuery(
> > > > > > MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, img, null,
> > > > > > null, MediaStore.Images.Thumbnails.IMAGE_ID + "");
> > > > > > image_column_index = imagecursor
> > > > > > .getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);
> > > > > > count = imagecursor.getCount();
> > > > > > imagegrid = (GridView)
> > > > > > findViewById(R.id.PhoneImageGrid);
> > > > > > imagegrid.setAdapter(new
> > > > > > ImageAdapter(getApplicationContext
> > > > > > ()));
> > > > > > imagegrid.setOnItemClickListener(new
> > > > > > OnItemClickListener()
> > > > > > {
> > > > > > public void onItemClick(AdapterView parent, View
> > > > > > v,
> > > > > > int position, long id) {
> > > > > > System.gc();
> > > > > > String[] proj =
> > > > > > { MediaStore.Images.Media.DATA };
> > > > > > actualimagecursor = managedQuery(
> > > > > > MediaStore.Images.Media.EXTERNAL_CONTENT_URI, proj,
> > > > > > null, null, null);
> > > > > > actual_image_column_index =
> > > > > > actualimagecursor
> > > > > > .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
> > > > > > actualimagecursor.moveToPosition(position);
> > > > > > String i = actualimagecursor.getString
> > > > > > (actual_image_column_index);
> > > > > > System.gc();
> > > > > > Intent intent = new Intent
> > > > > > (getApplicationContext(), ViewImage.class);
> > > > > > intent.putExtra("filename", i);
> > > > > > startActivity(intent);
> > > > > > }
> > > > > > });
> > > > > > }
>
> > > > > > public class ImageAdapter extends BaseAdapter {
> > > > > > private Context mContext;
> > > > > > public ImageAdapter(Context c) {
> > > > > > mContext = c;
> > > > > > }
> > > > > > public int getCount() {
> > > > > > return count;
> > > > > > }
> > > > > > public Object getItem(int position) {
> > > > > > return position;
> > > > > > }
> > > > > > public long getItemId(int position) {
> > > > > > return position;
> > > > > > }
> > > > > > public View getView(int position,View
> > > > > > convertView,ViewGroup parent) {
> > > > > > System.gc();
> > > > > > ImageView i = new ImageView
> > > > > > (mContext.getApplicationContext());
> > > > > > if (convertView == null) {
> > > > > > imagecursor.moveToPosition(position);
> > > > > > int id = imagecursor.getInt
> > > > > > (image_column_index);
> > > > > > i.setImageURI(Uri.withAppendedPath(
> > > > > > MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, ""
> > > > > > + id));
> > > > > > i.setScaleType
> > > > > > (ImageView.ScaleType.CENTER_CROP);
> > > > > > i.setLayoutParams(new GridView.LayoutParams
> > > > > > (92, 92));
> > > > > > }
> > > > > > else {
> > > > > > i = (ImageView) convertView;
> > > > > > }
> > > > > > return i;
> > > > > > }
> > > > > > }
>
> > > > > > }
>
> > > > > > // By selecting the thumbnails user can view the actualimage.
> > > > > > packageimage.Thumbnails;
>
> > > > > > import android.os.Bundle;
> > > > > > import android.widget.ImageView;
> > > > > > import android.app.Activity;
> > > > > > import android.content.Intent;
> > > > > > import android.graphics.Bitmap;
> > > > > > import android.graphics.BitmapFactory;
>
> > > > > > public class ViewImage extends Activity {
> > > > > > private String filename;
> > > > > > @Override
> > > > > > public void onCreate(Bundle savedInstanceState) {
> > > > > > super.onCreate(savedInstanceState);
> > > > > > System.gc();
> > > > > > Intent i = getIntent();
> > > > > > Bundle extras = i.getExtras();
> > > > > > BitmapFactory.Options bfo = new BitmapFactory.Options();
> > > > > > bfo.inSampleSize = 2;
> > > > > > filename =
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---