[android-developers] How to startup one application programmatically from other application
Say I have app A, in app A i want to set a schedule to startup the app B and C at specific time? Is it possible to do that? if yes how? Just need to know the code to fire the outside app. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to startup one application programmatically from other application
I should made it more clear, i intent to let user specific the time to fire the chosen app. Which approach is better? notification or call intent from AlarmManger? Please be noted that the app B or C will be the existence third part application, i may not know which activity is the entry point. On Jul 15, 3:28 pm, Jonas Petersson jonas.peters...@xms.se wrote: On 07/15/2010 09:05 AM, Jeruliu wrote: Say I have app A, in app A i want to set a schedule to startup the app B and C at specific time? Is it possible to do that? if yes how? Are you sure your user will appreciate this? You can for instance use the AlarmManager and then just fire a suitable Intent, but the user might be in the middle of (say) enter a password or similar when you happen to pop up app B/C, so this app had better be as important as a phone call or similar. A better approach might be to use a notification. Best / Jonas -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: how to deal with button clickevent in a listview?
Well, that will be similar with handling the checkbox in the item. I handled it in my customized adapter with a dirty approach. On Jul 12, 4:55 pm, 苗忠良 mzl...@gmail.com wrote: hi,Jeruliu: I need not that how to handle the item, in my code, I wrote it , I want to know is that how to handle the button in the item. but still thank you! 2010/7/12 Jeruliu jeru@gmail.com Please find my working code snippet below: // get a reference to the ListView listView = (ListView) findViewById(android.R.id.list); ... // single click event listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView? arg0, View arg1, int arg2, long arg3) { My list view works with the customized adapter. On Jul 11, 9:18 pm, 苗忠良 mzl...@gmail.com wrote: hi,all: I write a listactivty,the item including a textview and a button,the data came from a sqlite。but in handling the clickevent , i meet some problem, in the CursorAdapter's bindView() function,i cann't get the current position。in log,i find position of Cursor is the position I last click the item of listview. the code as follows: package miaozl.hello; import android.app.ListActivity; import android.content.Context; import android.database.Cursor; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.Button; import android.widget.CursorAdapter; import android.widget.ImageButton; import android.widget.ListView; import android.widget.SimpleCursorAdapter; import android.widget.TextView; public class helloActivity extends ListActivity{ private helloAdapter mDbHelper; private final static String TAG =helloActivity; private static LayoutInflater mFactory; ListView lv; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDbHelper = new helloAdapter(this); mDbHelper.open(); mFactory = LayoutInflater.from(this); lv= getListView(); lv.setChoiceMode(1); lv.setOnItemClickListener(new AdapterView.OnItemClickListener(){ @Override public void onItemClick(AdapterView? arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub Log.d(TAG,onItemClick===arg3 is ===+arg3); } }); fillData(); } private void fillData() { // TODO Auto-generated method stub Cursor c = mDbHelper.fetchAllNotes(); startManagingCursor(c); String[] from = new String[] { helloAdapter.KEY_WORD,helloAdapter.KEY_ID}; int[] to = new int[] { R.id.word,R.id.button}; lv.setAdapter(new ListAdapter(this, c)); } private static class ListAdapter extends CursorAdapter { public ListAdapter(Context context, Cursor c) { super(context, c); // TODO Auto-generated constructor stub } @Override public void bindView(View view, Context context, final Cursor cursor) { // TODO Auto-generated method stub Button onButton=(Button)view.findViewById(R.id.button); onButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub Log.d(TAG, =cursor.getPosition()=+cursor.getPosition()); } }); } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { // TODO Auto-generated method stub View ret= mFactory.inflate(R.layout.list_item,parent,false); TextView word=(TextView)ret.findViewById(R.id.word); Button onButton=(Button)ret.findViewById(R.id.button); onButton.setFocusable(false); word.setText(cursor.getString(cursor.getColumnIndex(helloAdapter.KEY_WORD))); onButton.setBackgroundResource(R.drawable.icon); return ret; } } } the ListAdapter as fallows: package miaozl.hello; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class helloAdapter{ public static final String KEY_WORD = word; public static
[android-developers] Re: how to deal with button clickevent in a listview?
Please find my working code snippet below: // get a reference to the ListView listView = (ListView) findViewById(android.R.id.list); ... // single click event listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView? arg0, View arg1, int arg2, long arg3) { My list view works with the customized adapter. On Jul 11, 9:18 pm, 苗忠良 mzl...@gmail.com wrote: hi,all: I write a listactivty,the item including a textview and a button,the data came from a sqlite。but in handling the clickevent , i meet some problem, in the CursorAdapter's bindView() function,i cann't get the current position。in log,i find position of Cursor is the position I last click the item of listview. the code as follows: package miaozl.hello; import android.app.ListActivity; import android.content.Context; import android.database.Cursor; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.Button; import android.widget.CursorAdapter; import android.widget.ImageButton; import android.widget.ListView; import android.widget.SimpleCursorAdapter; import android.widget.TextView; public class helloActivity extends ListActivity{ private helloAdapter mDbHelper; private final static String TAG =helloActivity; private static LayoutInflater mFactory; ListView lv; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDbHelper = new helloAdapter(this); mDbHelper.open(); mFactory = LayoutInflater.from(this); lv= getListView(); lv.setChoiceMode(1); lv.setOnItemClickListener(new AdapterView.OnItemClickListener(){ @Override public void onItemClick(AdapterView? arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub Log.d(TAG,onItemClick===arg3 is ===+arg3); } }); fillData(); } private void fillData() { // TODO Auto-generated method stub Cursor c = mDbHelper.fetchAllNotes(); startManagingCursor(c); String[] from = new String[] { helloAdapter.KEY_WORD,helloAdapter.KEY_ID}; int[] to = new int[] { R.id.word,R.id.button}; lv.setAdapter(new ListAdapter(this, c)); } private static class ListAdapter extends CursorAdapter { public ListAdapter(Context context, Cursor c) { super(context, c); // TODO Auto-generated constructor stub } @Override public void bindView(View view, Context context, final Cursor cursor) { // TODO Auto-generated method stub Button onButton=(Button)view.findViewById(R.id.button); onButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub Log.d(TAG, =cursor.getPosition()=+cursor.getPosition()); } }); } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { // TODO Auto-generated method stub View ret= mFactory.inflate(R.layout.list_item,parent,false); TextView word=(TextView)ret.findViewById(R.id.word); Button onButton=(Button)ret.findViewById(R.id.button); onButton.setFocusable(false); word.setText(cursor.getString(cursor.getColumnIndex(helloAdapter.KEY_WORD))); onButton.setBackgroundResource(R.drawable.icon); return ret; } } } the ListAdapter as fallows: package miaozl.hello; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class helloAdapter{ public static final String KEY_WORD = word; public static final String KEY_ID = _id; private static final String TAG = helloAdapter; private DatabaseHelper mDbHelper; private SQLiteDatabase mDb; private static final String DATABASE_CREATE = create table notes (_id integer primary key autoincrement, + word text not null);; private static final String DATABASE_NAME = list; private static final String DATABASE_TABLE = notes; private static final int DATABASE_VERSION = 1; private final Context mCtx; private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context) {
[android-developers] Android paid apps in China
Hi I'm going to publish my first app as paid one, but sadly i realized that i may have problems to get paid from China. Before I paid that $25 dollars i just need to make sure: Can i provide my Chinese bank account detail with my Chinese billing/ posting address? China is excluded from the country list in the google checkout application form. Also, I have an Australian bank account, will that help? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to access shared preference outside of Activity
Thanks, you solved my problem, again. On Jul 9, 7:40 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Jul 9, 2010 at 5:03 AM, Jeruliu jeru@gmail.com wrote: Thanks, actually i need to access the shared preference in a class that extends from BroadcastReceiver, how can i call the context then? PreferenceManager.getDefaultSharedPreferences(), passing in the Context supplied to you in onReceive() of your BroadcastReceiver. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to define some smart layout?
Matty's sample works, thanks. On Jul 9, 11:14 pm, Matty busbus...@gmail.com wrote: This simple layout seems to work for me: ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/android; android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical android:gravity=center ListView android:id=@+id/ListView01 android:layout_width=fill_parent android:layout_height=fill_parent android:layout_weight=1 / Button android:text=@+id/Button01 android:id=@+id/Button01 android:layout_width=wrap_content android:layout_height=wrap_content / /LinearLayout On Jul 9, 5:35 am, Jeruliu jeru@gmail.com wrote: I will have a list view on the top and a button on the bottom in the view. Regardless the height of the list view i would like to fix the button position on the bottom all the time. If the list view is too long then make it scrollable. How to do this? thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to access shared preference outside of Activity
Dear all, I need to access the shared preference in a background service instead of activity on phone boot up. But getSharedPreferences function is define in the activity, so how can i access the data without creating the activity? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to access shared preference outside of Activity
Thanks, actually i need to access the shared preference in a class that extends from BroadcastReceiver, how can i call the context then? On Jul 9, 4:21 pm, Mika mika.ristim...@gmail.com wrote: getSharedPreferences is defined in Context. Service is a Context also. On Jul 9, 9:08 am, Jeruliu jeru@gmail.com wrote: Dear all, I need to access the shared preference in a background service instead of activity on phone boot up. But getSharedPreferences function is define in the activity, so how can i access the data without creating the activity? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to define some smart layout?
I will have a list view on the top and a button on the bottom in the view. Regardless the height of the list view i would like to fix the button position on the bottom all the time. If the list view is too long then make it scrollable. How to do this? thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to set current tab in the sub activity pop up dialog
Hi, The problem is i don't have the reference of TabActivity so there is no way to call getTabHost() from sub activity. But however I've figured out the solution myself by passing the screen parameter to intent, then in TabActivity call setCurrentTab(screen) On Jul 6, 4:50 pm, grace grace.a...@wipro.com wrote: HI, Try using getTabHost().setCurrentTab(1/*tab2*/); once you enter/leave the tab2 activity On Jul 1, 9:01 pm, Jeruliu jeru@gmail.com wrote: I have a TabActivity class A with 2 tabs, a sub activity class B in tab 2. Now a dialog pops up from the UI in B, once i click the save button in this dialog it goes back to the TabActivity but the tab is set to 1, however i want to set the current tab to 2 once the dialog box closed. In short i need to acquire the tabHost reference in the diaglo when clicking on the save button. Please let me know how to do that thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] I can't change the checkbox state due to multiple getView call in custom adapter
After researched in this group, I have a conclusion that the number of calling getView function in adapter is not guaranteed, normally this function will be called 3 times. It's causing issue to my app. I have a custom list view, 2 text and 1 check box in each row. I also defined my own adapter extends from simple adapter. Now i just want to catch the onclick event to change the checkbox state, but after i called setChecked function the getView function will be called again and again which will overwrite my settings. Any propose? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Set current tab from a dialog box?
Hi all, I have a main TabActivity contains 2 tabs, each tab is an activity. By default the TabActivity will display the content of the first tab. From the second tab, a edit form will be pop up as dialog box. Now in this dialog box, once i click the save button, i would like to 1. close the dialog 2. navigate back to the TabActivity 3. set current tab to the second tab My problem is i can't get the reference of TabActivity to call setCurrentTab function from the pop up dialog. I spent a lot of time to google but don't have an answer till now, can someone kindly help me on this? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Set current tab from a dialog box?
I just found my own solution: passing a parameter into intent to specify which tab screen to display. On Jul 5, 3:45 pm, Jeruliu jeru@gmail.com wrote: Hi all, I have a main TabActivity contains 2 tabs, each tab is an activity. By default the TabActivity will display the content of the first tab. From the second tab, a edit form will be pop up as dialog box. Now in this dialog box, once i click the save button, i would like to 1. close the dialog 2. navigate back to the TabActivity 3. set current tab to the second tab My problem is i can't get the reference of TabActivity to call setCurrentTab function from the pop up dialog. I spent a lot of time to google but don't have an answer till now, can someone kindly help me on this? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to set current tab in the sub activity pop up dialog
I have a TabActivity class A with 2 tabs, a sub activity class B in tab 2. Now a dialog pops up from the UI in B, once i click the save button in this dialog it goes back to the TabActivity but the tab is set to 1, however i want to set the current tab to 2 once the dialog box closed. In short i need to acquire the tabHost reference in the diaglo when clicking on the save button. Please let me know how to do that thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to detect if the PendingIntent already exists or not
Dear all, I used AlarmManager to set the pending intent. I need to find out the state of the pending intent, in other word, is this pending intent working or not. Boz i may need to cancel this pending intent, but before canceling it i want to make sure it's active. But i see no function in AlarmManager can read this status. Can anyone advice how to do that? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to detect if the PendingIntent already exists or not
Maybe i didn't make myself clearly. I have no problem to set multiple PendingIntent into the AlarmManager, my solution is to set a dummy action: intent.setAction(DUMMY); But the question in this post is: I need to know if the specific PendingIntent is active or not I wish to display the PendingIntent status on my screen as active / inactive On Jun 22, 2:56 pm, reda reda.a...@gmail.com wrote: Hi , I've faced this problem and what I did is just creating the intent and the pendingIntent the same manner I did the first time and now I can cancel it. Intent intentToFire = new Intent(Main.ACTION_GET_NEW_EGGS); PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intentToFire, PendingIntent.FLAG_UPDATE_CURRENT); alarmPendingIntent.cancel(); It just works for me but I want to hear from other if this will not fail one day. ++ Reda On 22 juin, 08:08, Jeruliu jeru@gmail.com wrote: Dear all, I used AlarmManager to set the pending intent. I need to find out the state of the pending intent, in other word, is this pending intent working or not. Boz i may need to cancel this pending intent, but before canceling it i want to make sure it's active. But i see no function in AlarmManager can read this status. Can anyone advice how to do that? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to detect if the PendingIntent already exists or not
Thanks for the reply. 1. Ok, i will try too keep track myself, whenever the phone reboot, i will set all pending intents into the alarm manager, then remember the active/inactive status. 2. Sometimes i have to create multiple pending intents, for instance i need to trigger some operation at 8am, 12pm and 3pm everyday. In this case is it possible to set only a single alarm? On Jun 22, 4:35 pm, Dianne Hackborn hack...@android.com wrote: There isn't a way to do this; you will need to keep track of it yourself. Also I would recommend keeping track of which item you have enabled in your app, and only setting a single alarm for the next item in time, instead of having multiple in the alarm manager. See the alarm clock app for an example. On Tue, Jun 22, 2010 at 1:30 AM, Jeruliu jeru@gmail.com wrote: Maybe i didn't make myself clearly. I have no problem to set multiple PendingIntent into the AlarmManager, my solution is to set a dummy action: intent.setAction(DUMMY); But the question in this post is: I need to know if the specific PendingIntent is active or not I wish to display the PendingIntent status on my screen as active / inactive On Jun 22, 2:56 pm, reda reda.a...@gmail.com wrote: Hi , I've faced this problem and what I did is just creating the intent and the pendingIntent the same manner I did the first time and now I can cancel it. Intent intentToFire = new Intent(Main.ACTION_GET_NEW_EGGS); PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intentToFire, PendingIntent.FLAG_UPDATE_CURRENT); alarmPendingIntent.cancel(); It just works for me but I want to hear from other if this will not fail one day. ++ Reda On 22 juin, 08:08, Jeruliu jeru@gmail.com wrote: Dear all, I used AlarmManager to set the pending intent. I need to find out the state of the pending intent, in other word, is this pending intent working or not. Boz i may need to cancel this pending intent, but before canceling it i want to make sure it's active. But i see no function in AlarmManager can read this status. Can anyone advice how to do that? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to detect if the PendingIntent already exists or not
Hi Mark, Good hint, but how do you know a alarm goes off? BTW, may i know where is your tutorials version 2.1? On Jun 22, 7:13 pm, Mark Murphy mmur...@commonsware.com wrote: On Tue, Jun 22, 2010 at 5:29 AM, Jeruliu jeru@gmail.com wrote: 2. Sometimes i have to create multiple pending intents, for instance i need to trigger some operation at 8am, 12pm and 3pm everyday. In this case is it possible to set only a single alarm? Sure. Set an alarm for 8am. When it goes off, set an alarm for 12pm. When it goes off, set an alarm for 3pm. When it goes off, set an alarm for 8am. Etc. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 2.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to autostart a service instead of activity?
Hi, I can managed to autostart my activiy when reboot. But however I realized that what should i autostart is not the activiy with UI but a one time function call in background. I used to define the receiver in manifest xml to autostart the activity, this is working good. receiver android:enabled=true android:name=.BootUpReceiver android:permission=android.permission.RECEIVE_BOOT_COMPLETED intent-filter action android:name=android.intent.action.BOOT_COMPLETED / category android:name=android.intent.category.DEFAULT / /intent-filter /receiver Say my application has the main acticity class A as entry point and another class B with just a funtion called fireSomeAction. Now after android reboot, i want to call the fireSomeAction function in class B for only once, how can i do that? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to autostart a service instead of activity?
Oh yes, too stupid a question, i forgot that BootUpREceiver is my own class, thought it was a system class. Thanks a lot. On Jun 23, 3:57 am, Mark Murphy mmur...@commonsware.com wrote: On Tue, Jun 22, 2010 at 3:55 PM, Jeruliu jeru@gmail.com wrote: Hi, I can managed to autostart my activiy when reboot. But however I realized that what should i autostart is not the activiy with UI but a one time function call in background. I used to define the receiver in manifest xml to autostart the activity, this is working good. receiver android:enabled=true android:name=.BootUpReceiver android:permission=android.permission.RECEIVE_BOOT_COMPLETED intent-filter action android:name=android.intent.action.BOOT_COMPLETED / category android:name=android.intent.category.DEFAULT / /intent-filter /receiver Say my application has the main acticity class A as entry point and another class B with just a funtion called fireSomeAction. Now after android reboot, i want to call the fireSomeAction function in class B for only once, how can i do that? Move fireSomeAction() into BootUpReceiver and call it from there. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to detect if the PendingIntent already exists or not
got it, thanks. You are the man. On Jun 23, 3:56 am, Mark Murphy mmur...@commonsware.com wrote: On Tue, Jun 22, 2010 at 3:47 PM, Jeruliu jeru@gmail.com wrote: Good hint, but how do you know a alarm goes off? Your PendingIntent is run. Whatever component is started via that PendingIntent has the responsibility of scheduling the next alarm. BTW, may i know where is your tutorials version 2.1? http://commonsware.com/AndTutorials -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] TableRow Layout issue on ImageView
This should be a very simple one but i can never feel comfortable after tried so many options. I've defined a text view in left and a image view in right in a TableRow, no matter what i tried, the image always aligns to the right side. I found out that it's because the text view occupies most of the width in the line that leaves no more space for the image, but just don't know how to correct it. TableRow LinearLayout android:orientation=horizontal android:layout_width=fill_parent TextView android:textSize=20sp android:textStyle=bold android:id=@+id/my_title android:text=abc android:layout_height=wrap_content android:layout_width=fill_parent android:layout_weight=1 /TextView ImageView android:id=@+id/phone_mode_icon android:src=@drawable/ ic_airplane android:layout_width=wrap_content android:layout_height=wrap_content android:layout_gravity=center_vertical / /LinearLayout /TableRow Please help me out, thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Not able to place the custom view to dialog
Thanks, just solved myself, i don't actually need to use that SeekBarPreference. For instead, i should just define the standard component SeekBar in my custom dialog. It works that way. On May 28, 7:49 pm, Paweł Zięba pawzi...@gmail.com wrote: Try this LayoutInflater inflater = LayoutInflater.from(context); View view = inflater.inflate(R.layout.brightness, null); setView(view); -- Paweł Zięba dziobas.blogspot.com On 28 Maj, 02:47, Jeruliu jeru@gmail.com wrote: I'm suffering from this for a week, i was trying to use the famous SeekBarPreference in a dialog -http://android.hlidskialf.com/blog/code/android-seekbar-preference I copied the class from above link into my project. Then created the xml as brightness.xml: ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/layout_root android:orientation=horizontal android:layout_width=fill_parent android:layout_height=fill_parent android:padding=10dp com.yoomap.anymode.SeekBarPreference android:key=brightness android:title=Brightness android:summary=Adjust your android Brightness android:dialogMessage=Brightness android:defaultValue=120 android:text= android:max=255 / /LinearLayout Finally I try to integrate it as custom dialog: Dialog dialog = new Dialog(mContext); dialog.setContentView(R.layout.brightness); dialog.setTitle(Custom Dialog); dialog.show(); But always getting error: Error inflating class java.lang.reflect.Constructor at this line com.yoomap.anymode.SeekBarPreference in the xml Root cause: ClassCastException on SeekBarPreference Can anyone point out why? thanks a million -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Couldn't get the seekbar by findViewById
I'm building a dialog including seekbar but i can't locate the seekbar by findViewById, it only returns nullpoint. My code: Context mContext = this; LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.brightness, (ViewGroup) findViewById(R.id.layout_root)); builder = new AlertDialog.Builder(mContext); builder.setView(layout); builder.setTitle(Brightness); builder.setPositiveButton(Ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /// The seekBar here is a null point however? SeekBar seekBar = (SeekBar) findViewById(R.id.seekbar); int progress = seekBar.getProgress(); Log.v(TAG, = progress is : + progress); } }); And my layouy brightness.xml ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/layout_root android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:gravity=center ImageView android:id=@+id/brightness_level_icon android:layout_width=fill_parent android:layout_height=fill_parent android:src=@drawable/ brightness_level_icon / SeekBar android:id=@+id/seekbar android:layout_width=fill_parent android:layout_height=wrap_content android:max=255 android:progress=125 / /LinearLayout Any hints from your experts?thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Couldn't get the seekbar by findViewById
Wow, thanks Mark, you are absolutely not just a common guy!!! On May 29, 2:09 am, Mark Murphy mmur...@commonsware.com wrote: Jeruliu wrote: I'm building a dialog including seekbar but i can't locate the seekbar by findViewById, it only returns nullpoint. My code: Context mContext = this; LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.brightness, (ViewGroup) findViewById(R.id.layout_root)); builder = new AlertDialog.Builder(mContext); builder.setView(layout); builder.setTitle(Brightness); builder.setPositiveButton(Ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /// The seekBar here is a null point however? SeekBar seekBar = (SeekBar) findViewById(R.id.seekbar); int progress = seekBar.getProgress(); Log.v(TAG, = progress is : + progress); } }); And my layouy brightness.xml ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/layout_root android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:gravity=center ImageView android:id=@+id/brightness_level_icon android:layout_width=fill_parent android:layout_height=fill_parent android:src=@drawable/ brightness_level_icon / SeekBar android:id=@+id/seekbar android:layout_width=fill_parent android:layout_height=wrap_content android:max=255 android:progress=125 / /LinearLayout Any hints from your experts?thanks. You are calling findViewById() on your activity. Your activity presumably does not have a SeekBar named R.id.seekbar. Try calling layout.findViewById(R.id.seekbar) instead. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android App Developer Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] SeekBarPreference ClassCastException why?
Hi All, I'm suffering from this for a week, i was trying to use the famous SeekBarPreference in a dialog - http://android.hlidskialf.com/blog/code/android-seekbar-preference I copied the class from above link into my project. Then created the xml as brightness.xml: ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/layout_root android:orientation=horizontal android:layout_width=fill_parent android:layout_height=fill_parent android:padding=10dp com.yoomap.anymode.SeekBarPreference android:key=brightness android:title=Brightness android:summary=Adjust your android Brightness android:dialogMessage=Brightness android:defaultValue=120 android:text= android:max=255 / /LinearLayout Finally I try to integrate it as custom dialog: Dialog dialog = new Dialog(mContext); dialog.setContentView(R.layout.brightness); dialog.setTitle(Custom Dialog); dialog.show(); But always getting error: Error inflating class java.lang.reflect.Constructor at this line com.yoomap.anymode.SeekBarPreference in the xml Root cause: ClassCastException on SeekBarPreference Can anyone point out why? thanks a million -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] SeekBarPreference ClassCastException why?
Hi All, I'm suffering from this for a week, i was trying to use the famous SeekBarPreference in a dialog - http://android.hlidskialf.com/blog/code/android-seekbar-preference I copied the class from above link into my project. Then created the xml as brightness.xml: ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/layout_root android:orientation=horizontal android:layout_width=fill_parent android:layout_height=fill_parent android:padding=10dp com.yoomap.anymode.SeekBarPreference android:key=brightness android:title=Brightness android:summary=Adjust your android Brightness android:dialogMessage=Brightness android:defaultValue=120 android:text= android:max=255 / /LinearLayout Finally I try to integrate it as custom dialog: Dialog dialog = new Dialog(mContext); dialog.setContentView(R.layout.brightness); dialog.setTitle(Custom Dialog); dialog.show(); But always getting error: Error inflating class java.lang.reflect.Constructor at this line com.yoomap.anymode.SeekBarPreference in the xml Root cause: ClassCastException on SeekBarPreference Can anyone point out why? thanks a million -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Not able to place the custom view to dialog
I'm suffering from this for a week, i was trying to use the famous SeekBarPreference in a dialog - http://android.hlidskialf.com/blog/code/android-seekbar-preference I copied the class from above link into my project. Then created the xml as brightness.xml: ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/layout_root android:orientation=horizontal android:layout_width=fill_parent android:layout_height=fill_parent android:padding=10dp com.yoomap.anymode.SeekBarPreference android:key=brightness android:title=Brightness android:summary=Adjust your android Brightness android:dialogMessage=Brightness android:defaultValue=120 android:text= android:max=255 / /LinearLayout Finally I try to integrate it as custom dialog: Dialog dialog = new Dialog(mContext); dialog.setContentView(R.layout.brightness); dialog.setTitle(Custom Dialog); dialog.show(); But always getting error: Error inflating class java.lang.reflect.Constructor at this line com.yoomap.anymode.SeekBarPreference in the xml Root cause: ClassCastException on SeekBarPreference Can anyone point out why? thanks a million -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Frustrated with CheckBox/CheckedListView in listview
Dear all, I've tried my every effort to fight with this issue for two days but no any luck. What I want to do is: Display a list view with 3 elements: title, subtitle and a checkbox. It will be ideal that the event handler only fires when user click on the CheckBox but not the list item. I start with the CheckedListView first but it seems this component didn't provide a good interface to populate two properties as one component. Then I was think if it's possible to directly use the checkbox and catch the onlick event? I then created a customized View Adapter: public class ProfileAdapter extends SimpleAdapter { ... @Override public View getView(int position, View convertView, ViewGroup parent) { View row = this.mContext.getLayoutInflater().inflate(R.layout.list_profile, null); row.setTag(R.id.profile_title, row.findViewById(R.id.profile_title)); row.setTag(R.id.profile_value, row.findViewById(R.id.profile_value)); row.setTag(R.id.cb_switch, row.findViewById(R.id.cb_switch)); row.setTag(R.id.id, row.findViewById(R.id.id)); TextView profileTitle = (TextView) row.getTag(R.id.profile_title); TextView profileValue = (TextView) row.getTag(R.id.profile_value); cb = (CheckBox) row.getTag(R.id.cb_switch); TextView id = (TextView) row.getTag(R.id.id); // this map was filled in my list activity class which contains key: title, value, enable and id MapString, String temp = (MapString, String) ((AdapterView?) parent).getItemAtPosition(position); profileTitle.setText(temp.get(title)); profileValue.setText(temp.get(value)); profileValue.setText(temp.get(value)); String sid = (String)temp.get(id); id.setText(sid); cb.setChecked(isEnable(temp.get(enable))); cb.setFocusable(false); cb.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Log.v(test, ** sid is: + sid); //mProfileDao.updateEnable(mId, isChecked); //Toast.makeText(mContext, getToastMessage(isChecked), Toast.LENGTH_SHORT).show(); } }); I tried to use onCheckedChanged to capture the CheckBox click event but there is way to detect the position of the item clicked??? I doubt if is this the right place or right way to do it. Please kindly help... thanks millions -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en