How to execute a application automatically after android booting?

by stater » Thu, 30 Apr 2009 14:48:05 GMT


Sponsored Links
 Hi all,

I have a application and it need be executed after android booting
automatically.
Does someone have a suggestion that how to do it?
Thanks for your reply.
--~--~---------~--~----~------------~-------~--~----~

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



Other Threads

1. Custom View donot Draw in ListView

Hello,

I have a query, When I try to use a customview in the listview, the
custom view donot display. All other views are displayed except the
custom view.
When I try to display the view like a normal layout (not in a list),
it displays fine.

Can anyone please help me to draw the customview in the list?

the main.xml file - layout that contains the custom view
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    >
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello"
    />
    <CheckBox android:id="@+id/check2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="checkbox_2" />
             <app.customise.tab.CustomBackground
android:id="@android:id/list"
    android:layout_width="wrap_content"
                android:layout_height="wrap_content"/>

</LinearLayout>

the list.xml file - the list view file
<LinearLayout    >
       <FrameLayout>
       <ListView android:id="@android:id/android:list"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"/>

               </FrameLayout>
               </LinearLayout>

the CustomBackground.java - class that extends the View class and
draws a rounded rectangle

public class CustomBackground extends View{

        public CustomBackground(Context context, AttributeSet attrs) {
                super(context, attrs);
                // TODO Auto-generated constructor stub
                mRect = new Rect(40, 0, 310, 90);

        mDrawable = new GradientDrawable
(GradientDrawable.Orientation.TOP_BOTTOM,
                                         new int[] { 0xFFA5C3E9,
                                             0xFF548DD4 });
        mDrawable.setShape(GradientDrawable.RECTANGLE);
        mDrawable.setGradientRadius((float)(Math.sqrt(2) * 60));
        }

        private Rect    mRect;
    private GradientDrawable mDrawable;
        public CustomBackground(Context context) {
                super(context);
                // TODO Auto-generated constructor stub

                mRect = new Rect(40, 0, 310, 90);

        mDrawable = new GradientDrawable
(GradientDrawable.Orientation.TOP_BOTTOM,
                                         new int[] { 0xFFA5C3E9,
                                             0xFF548DD4 });
        mDrawable.setShape(GradientDrawable.RECTANGLE);
        mDrawable.setGradientRadius((float)(Math.sqrt(2) * 60));
                        }

        void setCornerRadii(GradientDrawable drawable, float r0,
            float r1, float r2, float r3) {
                                drawable.setCornerRadii(new float[] { r0, r0, 
r1, r1, r2, r2, r3,
r3 });
                        }

        @Override
        protected void onDraw(Canvas canvas) {
                // TODO Auto-generated method stub
                //super.onDraw(canvas);

                System.out.println("ON DRAW CALLED");

                 mDrawable.setBounds(mRect);

         float r = 10;
         canvas.translate(10, 10);
         mDrawable.setGradientType(GradientDrawable.LINEAR_GRADIENT);
         setCornerRadii(mDrawable, r, r, r, r);
         mDrawable.draw(canvas);

                                invalidate();
        }


the DummyActivity.class extends ListActivity

public class DummyActivity extends ListActivity {
       @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        /**
         * Display layout of main.xml with custom view.
         * Works fine. Displays one checkbox, two radio buttons and
one rounded rectangle
         * Class extends Activity
         */
       // setContentView(R.layout.main);
        /**
         * The above display in list.
         * Displays one checkbox, two radio buttons. Rounded rectangle
not displayed
         */
        setContentView(R.layout.list);
        mAdapter ma = new mAdapter(this);
        for(int i=0;i<5;i++)
        {
                ma.add(i);
        }
        this.setListAdapter(ma);

    }

    public class mAdapter extends BaseAdapter {

        private Context ctx;

        List<Integer>count = new ArrayList<Integer>();
        public mAdapter(Context c)
        {
                ctx=c;
        }
        public void add(int i)
        {
                count.add(i);
        }
                @Override
                public int getCount() {
                        // TODO Auto-generated method stub
                        return count.size();
                }

                @Override
                public Object getItem(int position) {
                        // TODO Auto-generated method stub
                        return count.get(position);
                }

                @Override
                public long getItemId(int position) {
                        // TODO Auto-generated method stub
                        return 0;
                }

                @Override
                public View getView(int position, View convertView, ViewGroup
parent) {
                        // TODO Auto-generated method stub
                        //Inflate the view of main.xml
                        LayoutInflater linf = 
(LayoutInflater)ctx.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
                        View v = linf.inflate( R.layout.main, parent, false);
                                           // Draw the customview in
new canvas for each list cell
                        Canvas c = new Canvas();
                        (v.findViewById(android.R.id.list)).draw(c);

                        Log.d("LAYOUT", "TIME "+ 
(v.findViewById(android.R.id.list)).getId
());


                        return v;
                }


    }

Can anyone help me to find what I am doing wrong?

Thanks.
Regards,
Purvi

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

2. Custom translucent theme

Hi,

I have 2 activities and need the second one to be translucent when
started by and over the first one.

When I set my activity theme to @android:style/Theme.Translucent, it
works.

I however want to customize alpha. So, following the example in
ApiDemos - app - TranslucentActivity, I write:

in styles.xml:

    <style name="Theme" parent="android:Theme">
    <style name="Theme.Translucent" parent="android:style/
Theme.Translucent">
        <item name="android:windowBackground">@drawable/
translucent_background</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:colorForeground">#fff</item>
    </style>

and in colors.xml:

    <drawable name="translucent_background">#80000000</drawable>

and set my activity theme to @style/Theme.Translucent

But it doesn't work any more, the second activity is black and opaque.

I also tried with (notice the @) :
<style name="Theme.Translucent" parent="@android:style/
Theme.Translucent">

What's wrong ?
--~--~---------~--~----~------------~-------~--~----~

3. How to specify the maxWidth of a TextView as a percentage of screen width?

4. Reading/Decoding bar code stored in resources

5. Android Developers - Don't miss your chance to regisetr for upcoming Sprint dev conf Oct 26 in Santa Clara

6. PendingIntent.getService Returns an existing or new PendingIntent matching the given parameters

7. Big problem with extra data in intent