[android-developers] OnKeyListener is not working, why?
I have a fragment class, in the fragment class, I implement the onCreateView(...) callback in the following way: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View myView = inflater.inflate(R.layout.note, null); myView.setOnKeyListener( new OnKeyListener(){ @Override public boolean onKey( View v, int keyCode, KeyEvent event ){ if( keyCode == KeyEvent.KEYCODE_BACK ){ Log.v("CALL ME", "I am called"); return true; } return false; } }); return myView; } *** As you see above, I inflate a layout to this fragment, then I setOnKeyListener() to handle the back button press event. But when I run it on my phone, the back button press event is not handled, my Log message is not showing. Why my OnKeyListener is not working ??? -- 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 "printf" in android development
I just notice that in android app. development( I use Eclipse as my IDE), if I have a statement "System.out.printf("hello")", it wont show anywhere, either console or LogCat, How can I see the output of "printf" in android app. development?? -- 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 use 'SQLiteStatement' to insert a item ( with multiple columns)
I am new in Android development, I got a simple question to ask, I know the way how to implement item insert to DB table when there is only one id column and one "name" column in the table, which is: "CREATE TABLE myTable (id INTEGER PRIMARY KEY, name TEXT)" String INSERT = "insert into myTable (name) values(?)"; SQLiteStatement insertStmt = db.compileStatement(INSERT); insertStmt.bindString(1, name); Id = insertStmt.executeInsert(); But how about there are multiple columns (more than 2 columns) in the table, how to implement the insert function?? For example I have a TABLE (myTable) has the following columns: "CREATE TABLE myTable (id INTEGER PRIMARY KEY, date TEXT, time TEXT, cost DOUBLE)" Now, I want to use SQLiteStatement to insert a item to this table, how to 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] Why I can not open database in my service layer class
When I create a instance of the SQLiteOpenHelper, I always need a "Context" to be passed as its constructor's argument. To use this "Context", in my service layer class, I extends Activity class, though I do not display this activity on the screen because it is my service layer. I always get NullPointer exception when I open the SQLiteOpenHelper in my service layer class, Is it because my service layer class extends the Activity class but I did not show this activity on mobile screen? (That's there is no intent to my service layer class), if it is so, how to get rid of it if I wanna open a SQLiteOpenHelper in my service layer class which do not need to extends Activity, but need a Context object to pass to SQLiteOpenHelper? -- 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 inject view from a dialog layout xml file when using RoboGuice?
It seems that roboguice can only inject views from the contentView defined in onCreate(...) of the activity, outside onCreate(), for example, if I have my custom dialog, which has also a content view (e.g.dialog.setContentView(R.layout.dialog_layout);), the views inside the dialog_layout.xml can not be injected. How can I inject views from this dialog_layout in my activity when using RoboGuice?? -- 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 get a string from a website, and show the string on my android app. ?
I have made a service which extends Service in android, and running in the background of my android app. What I want from this background service is to get the euro to dollar exchange rate from a finance website, I have my service ready, it can periodically run a function, I am now need to implement the function to get the euro-dollar rate from a website, there are many this kind of website, my question is, how can I get the currency rate as a string from the website, and pass the string to my service ?? -- 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 can service return a string back to Activity?
I am new in Android . I encounter the following situation, I have a background running service, which will get a keep-updating string from a webpage, I need to show this keep-updating string in my UI through Activity, since this string is get from service, I am wondering, How can the service pass the string to Activity so that activity can render the string on UI. Anyone can 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 can service return a string back to Activity?
How to implement the "broadcast from service to activity"? It is too abstract concept for me, is there any tutorial or sample code? On Nov 11, 2:36 pm, Filip Havlicek wrote: > Hi, > > there are more ways to do this, one of them might be sending a broadcast > from service to activity with string in broadcast's intent as an extra. > > Best regards, > Filip Havlicek > > 2010/11/11 xi developer > > > > > > > > > I am new in Android . I encounter the following situation, > > > I have a background running service, which will get a keep-updating > > string from a webpage, I need to show this keep-updating string in my > > UI through Activity, since this string is get from service, I am > > wondering, How can the service pass the string to Activity so that > > activity can render the string on UI. Anyone can 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 > cr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en -- 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 increase camera resolution??
I run my application with camera functionality implemented in an android-powered phone, but the camera image I got always has small resolution. It seems by default, the android camera resolution is small (e.g. 640*410), how to increase the resolution (e.g. to 1024 * 768), I use the following code to implement the camera part: Intent i = new Intent("android.media.action.IMAGE_CAPTURE"); File photo=new File(Environment.getExternalStorageDirectory(), "123.jpg"); i.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo)); startActivityForResult(i, 1); any suggestions on this??? -- 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 implement Two line text with different colors on one button
In my android app development, I have one button, the button text is not a single color text, it is two lines text, with each line uses different color for line text. How to implement this? "Two lines" can be simply implemented by adding "\n" in the text, I don know how to set different colors for each line text on the button. Anyone can help (with details)? -- 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 startActivity() in a subclass of Dialog?
I have one subclass which extends Dialog class, it seems I can not use startActivity() function to start a new Activity in this subclass which extends Dialog class, how to resolve it? How to start a new Activity in a Dialog subclass? (In my customized dialog class, I have one button, when pressed, I would like to have a new Activity start). -- 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] After I added ACTION_SEND in my Activity intent-filter, how can I still use android build-in email app??
I know I can use android build in email app when I use the intent with ACTION_SEND, there is no problem for me. The problem comes after I defined the ACTION_SEND in my AndroidManifest.xml like follows: Since I would like to see my own app to be added in the share option list when user click "share" in the gallery, I have to define the above in my AndroidManifest.xml. After I defined the above configuration in AndroidManifest.xml, whenever I call "Intent emailIntent = new Intent(Intent.ACTION_SEND);", my android app will go to call "myActivity" instead of calling android build in email app. All of the above is understandable, my question is how to keep my configuration in AndroidManifest.xml as above (that's keep my app shown in the share option list when user click "share" in gallery), MEANWHILE, I can call the android default email 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] How to change the icon position on a tab
Where can I change my icon position on a tab to be in the center of the tab. Currently, my icon is located on top of the tab by default... -- 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 change the icon position on a tab
Hi, I use the following View to customize my icon & text position of the tab, but I failed, could you give some hint to me?? http://schemas.android.com/apk/res/ android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical" android:background="@color/row_bg_color"> On Oct 6, 4:31 pm, Mark Murphy wrote: > On Wed, Oct 6, 2010 at 9:30 AM, xi developer wrote: > > Where can I change my icon position on a tab to be in the center of > > the tab. Currently, my icon is located on top of the tab by default... > > Use the version of setIndicator() that takes a View as its parameter, > and you can make the tab look however you wish. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > _Android Programming Tutorials_ Version 3.0.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] Warning msg “No keyboard for id 0”????
I am new in Android app. development, now I have encountered a strange problem with the Menu button. Here is the thing: I have two activities, "ActivityOne" and "ActivityTwo", where "ActivityTwo" is the child Activity of "ActivityOne". In both activity, I have defined the menu button options like following: @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem insertMenuItem = menu.add(0, INSERT_ID, 0, R.string.menu_insert); insertMenuItem.setIcon(R.drawable.ic_menu_add); MenuItem settingMenuItem = menu.add(0, SETTING_ID, 0, R.string.menu_setting); settingMenuItem.setIcon(R.drawable.ic_menu_settings); MenuItem aboutMenuItem = menu.add(0, ABOUT_ID, 0, R.string.menu_about); aboutMenuItem.setIcon(R.drawable.ic_menu_about); logPrinter.println("creating menu options..."); return true; } @Override public boolean onMenuItemSelected(int featureId, MenuItem item) { switch(item.getItemId()) { case INSERT_ID: doInsert(); return true; case SETTING_ID: return true; case ABOUT_ID: showAbout(); return true; } return super.onMenuItemSelected(featureId, item); } I have defined the above functions in both Activities. In "ActivityOne", when I click the physical Menu button, there is no menu options pop up from screen bottom, when I checked the LogCat console, there are two warning messages, which are "No keyboard for id 0" and "Using default keyMap:/system/usr/keychars/qwerty.kcm.bin" . BUT, in "ActivityTwo", the menu button works fine, it shows me those menu options I defined. Why the menu button does not work in "ActivityOne" ?? What does the warning msg mean??? -- 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