How to run a class in background

by subrat kumar panda » Fri, 23 Apr 2010 16:57:42 GMT


Sponsored Links
 Hello all,
i am working in a Gps app.
the Gps is working fine, but i don't know
when i am doing other operations in device
the Gps is keep tracking or not.

so, how to run the specified Gps class in
background,so that what ever i do with my device or
nothing the Gps should always keep running(keep tracking).

anyboby knows the solution to the above
problem please help me.

Thanks in advance,

Best Regards,
Subrat Kumar Panda.
India.

--



How to run a class in background

by XC He » Fri, 23 Apr 2010 17:07:57 GMT


 Service
 http://developer.android.com/reference/android/app/Service.html 

Write a service

2010/4/23 subrat kumar panda <evergreen.sub...@gmail.com>:
>


Sponsored Links


How to run a class in background

by subrat kumar panda » Fri, 23 Apr 2010 17:38:51 GMT


 This is ok, but i am not able to implement it.
would you please give me an example .
means, how to run a "Hello world" program in background.

in my app there are multiple packages & in one package there
are multiple classes.so, i am little bit confused.
nevermind but i have tried before to do it ,
but i get failed.

Thanks in advance,

Best Regards
Subrat Kumar Panda
India









>>



Other Threads

1. tanya: hp android buat ber gps ria

Para suhu sekalian mau tanya,

Hp droid value seperti samsung galaxy mini atau optimus me sudah cukup
mumpuni belum untuk keperluan ber gps ria ?? Prefer offline. Flash n kamera
bkn prioritas.

Atau Ada saran lain? Pengen-nya yg di range 1jt an..

Thx before,
Budi

-- 
"

2. Image gallery without memory error

I  made a image gallery but  getting a memory error when I slide
photos.
Then I added bitmapfactory but I can run the program because It shows
error in the bitmapdrawable.
can anybody tell me how to solve this problem.

ContentResolver cr=getContentResolver();
        Cursor c=cr.query(
            MediaStore.Images.Media.INTERNAL_CONTENT_URI,
            null,null,null,null);
        c.moveToFirst();
        for (int i=0;i<c.getCount();i++) {
            String path=c.getString(c.getColumnIndexOrThrow("_data"));
            photoList.add(file2bmp(path,480,480));
            for (String column:c.getColumnNames()) {//
                android.util.Log.e("",column+"="+
                    c.getString(c.getColumnIndexOrThrow(column)));
            }
            c.moveToNext();
        }


        Gallery gallery=new Gallery(this);
        gallery.setSpacing(2);
        gallery.setAdapter(new GalleryAdapter());
        gallery.setLayoutParams(new LinearLayout.LayoutParams(FP,FP));
        layout.addView(gallery);
    }


    private Bitmap file2bmp(String path,int maxW,int maxH) {
        BitmapFactory.Options options;
        InputStream in=null;
        try {

            options=new BitmapFactory.Options();
            options.inJustDecodeBounds=true;
            in=new FileInputStream(path);
            BitmapFactory.decodeStream(in,null,options);
            in.close();
            int scaleW=options.outWidth/maxW+1;
            int scaleH=options.outHeight/maxH+1;
            int scale =Math.max(scaleW,scaleH);


            options=new BitmapFactory.Options();
            options.inJustDecodeBounds=false;
            options.inSampleSize=scale;
            in=new FileInputStream(path);
            Bitmap bmp=BitmapFactory.decodeStream(in,null,options);
            in.close();
            return bmp;
        } catch (Exception e) {
            try {
                if (in!=null) in.close();
            } catch (Exception e2) {
            }
            return null;
        }
    }


    public class GalleryAdapter extends BaseAdapter {

        public int getCount() {
            return photoList.size();
        }


        public Object getItem(int position) {
            return position;
        }


        public long getItemId(int position) {
            return position;
        }


        public View getView(int position, View convertView, ViewGroup
parent) {
            ImageView imageView;
            if (convertView==null) {
                imageView=new ImageView(MainAct.this);
                imageView.setLayoutParams(new
Gallery.LayoutParams(240,240));
 
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
                imageView.setBackgroundColor(Color.BLACK);

                BitmapDrawable bd=new
BitmapDrawable(photoList.get(position));   //getting error
                imageView.setImageDrawable(bd);
            } else {
                imageView=(ImageView)convertView;
            }
            return imageView;
        }
    }


Thank you

-- 

3. Problem to fix image view to layout

4. RIL understanding

5. OutOfMemoryError

6. Need help on ftyp's..

7. Have to clean build to get app to install on phone