[android-developers] Re: Will a notification still work if the device once shut down.
I think AlarmManager can not keep running in case the device has once turned off. This is an explanation extracted from http://developer.android.com/intl/zh-CN/reference/android/app/AlarmManager.html and it told me AlarmManager isn't what I want: Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted. On 8月7日, 下午6时50分, Pradeep Kaushik pra...@gmail.com wrote: Hi, You can use the AlarmManager for such tasks. Sample Code: == AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE); PendingIntent pi = PendingIntent.*getBroadcast*(getApplicationContext(), REQUEST_CODE, intent, PendingIntent.FLAG_CANCEL_CURRENT); am.set(AlarmManager.RTC_WAKEUP, SOME_TIME_IN_FUTURE, operation); The flag AlarmManager.RTC_WAKEUP will cause the device to wake up. You can also try the AlarmManager.ELAPSED_REALTIME_WAKEUP flag. Best Regards, Pradeep Kaushik On Fri, Aug 7, 2009 at 10:50 AM, guishenl...@gmail.com guishenl...@gmail.com wrote: Maybe I was misunderstood. What I want is to continue my notification effect even the device has once shut down, just like an alarm clock. If you really get it, please explain it for in detail? Thanks a lot! On 8月6日, 下午4时52分, peter heywoodpres...@gmail.com wrote: Set flag of Notification, there have sort of flag to let your notification show like this:Notification.flag = Notification.FLAG_AUTO_CANCEL On Aug 6, 4:42 pm, guishenl...@gmail.com guishenl...@gmail.com wrote: Hi all, I have an application with notification. I want to keep the notification working even if the device once shut down just like an alarm. Could anyone give me some sample code to help me? Thank you in advance!- 隐藏被引用文字 - - 显示引用的文字 -- 隐藏被引用文字 - - 显示引用的文字 - --~--~-~--~~~---~--~~ 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 wake up the device by Code?
Hi all, I have an application with notification. I want my notification can wake the device up when it goes off but the device is asleep. Could anybody tell me how to do by some code? Thank you in advance! --~--~-~--~~~---~--~~ 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] Will a notification still work if the device once shut down.
Hi all, I have an application with notification. I want to keep the notification working even if the device once shut down just like an alarm. Could anyone give me some sample code to help me? Thank you in advance! --~--~-~--~~~---~--~~ 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: Will a notification still work if the device once shut down.
Maybe I was misunderstood. What I want is to continue my notification effect even the device has once shut down, just like an alarm clock. If you really get it, please explain it for in detail? Thanks a lot! On 8月6日, 下午4时52分, peter heywoodpres...@gmail.com wrote: Set flag of Notification, there have sort of flag to let your notification show like this:Notification.flag = Notification.FLAG_AUTO_CANCEL On Aug 6, 4:42 pm, guishenl...@gmail.com guishenl...@gmail.com wrote: Hi all, I have an application with notification. I want to keep the notification working even if the device once shut down just like an alarm. Could anyone give me some sample code to help me? Thank you in advance!- 隐藏被引用文字 - - 显示引用的文字 - --~--~-~--~~~---~--~~ 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 does setTextFilterEnabled(true) not work?
Hi all, I want to design a ListView with auto filter fuction, that is, when the user press a key all the items who matches this key will be filtered and form a new list. I selected the method setTextFilterEnabled(true) to implement my function, but it didn't work in fact. Could anyone tell me where my mistacke exists? Thank you in advance! Here is my code: package com.example.android.apis.view; import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; /** * A list view example where the * data for the list comes from an array of strings. */ public class List1 extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Use an existing ListAdapter that will map an array // of strings to TextViews setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_1, mStrings)); getListView().setTextFilterEnabled(true); } private String[] mStrings = { Action, Adventure, Animation, Children, Comedy, Documentary, Drama, Foreign, History, Independent, Romance, Sci-Fi, Television, Thriller } --~--~-~--~~~---~--~~ 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 does TextFilter not work?
Hi all, I want to design a ListView with auto filter fuction, that is, when the user press a key all the items who matches this key will be filtered and form a new list. I selected the method setTextFilterEnabled(true) to implement my function, but it didn't work in fact. Could anyone tell me where my mistacke exists? Thank you in advance! Here is my code: package com.example.android.apis.view; import android.app.ListActivity; import android.database.Cursor; import android.os.Bundle; import android.provider.Contacts.Phones; import android.widget.ListAdapter; import android.widget.SimpleCursorAdapter; /** * A list view example where the * data comes from a cursor, and a * SimpleCursorListAdapter is used to map each item to a two-line * display. */ public class List3 extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get a cursor with all phones Cursor c = getContentResolver().query(Phones.CONTENT_URI, null, null, null, null); startManagingCursor(c); // Map Cursor columns to views defined in simple_list_item_2.xml ListAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_2, c, new String[] { Phones.NAME, Phones.NUMBER }, new int[] { android.R.id.text1, android.R.id.text2 }); setListAdapter(adapter); //My code begins getListView().setTextFilterEnabled(true); //My code ends } } --~--~-~--~~~---~--~~ 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 get all table names in SQL database
Thank you for answering! But I didn't catch your real meaning. Could you give me some exact code to show your point? On 7月28日, 下午3时25分, Sujay Krishna Suresh sujay.coold...@gmail.com wrote: .tables is the sql instruction to retrieve all the tables in the db. try executing it asa sql statement with rawQuery. On Tue, Jul 28, 2009 at 12:45 PM, guishenl...@gmail.com guishenl...@gmail.com wrote: Hi all, I'm working at an application about SQLite database. I have inserted some table in an database file. But I don't know how to get all the tables' name using code. For example, I defined a database object SQLiteDatabase dataBase = SQLiteDatabase.openOrCreateDatabase( getDatabasePath(Mydatabase), null); and how can I get all the table names stored in the database file Mydatabase. Counld anyone give me some code to help me? Thank you in advance! -- Regards, Sujay Joan Crawfordhttp://www.brainyquote.com/quotes/authors/j/joan_crawford.html - I, Joan Crawford, I believe in the dollar. Everything I earn, I spend. --~--~-~--~~~---~--~~ 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 get all table names in SQL database
I want to get the tables programmatically not in the command line. And the database is created by myself not the contact database. Could you give me some example code? Thank you very much in advance! On 7月28日, 下午9时46分, Yusuf T. Mobile yusuf.s...@t-mobile.com wrote: It depends if you want all the tables programmatically or if you can do it in the command line. Sujay's answer was from the command line. So starting a few steps back, you type: adb shell # cd /data/data # cd com.android.providers.contacts # cd databases # sqlite3 contacts.db SQLite version 3.5.9 Enter .help for instructions sqlite .tables That will get you all the tables in the contacts database, for example. If that doesn't answer your question, let me know more about what you need and I'll try to help. Yusuf Saib Android ·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, 12:59 am, guishenl...@gmail.com guishenl...@gmail.com wrote: Thank you for answering! But I didn't catch your real meaning. Could you give me some exact code to show your point? On 7月28日, 下午3时25分, Sujay Krishna Suresh sujay.coold...@gmail.com wrote: .tables is the sql instruction to retrieve all the tables in the db. try executing it asa sql statement with rawQuery. On Tue, Jul 28, 2009 at 12:45 PM, guishenl...@gmail.com guishenl...@gmail.com wrote: Hi all, I'm working at an application about SQLite database. I have inserted some table in an database file. But I don't know how to get all the tables' name using code. For example, I defined a database object SQLiteDatabase dataBase = SQLiteDatabase.openOrCreateDatabase( getDatabasePath(Mydatabase), null); and how can I get all the table names stored in the database file Mydatabase. Counld anyone give me some code to help me? Thank you in advance! -- Regards, Sujay Joan Crawfordhttp://www.brainyquote.com/quotes/authors/j/joan_crawford.html - I, Joan Crawford, I believe in the dollar. Everything I earn, I spend.- 隐藏被引用文字 - - 显示引用的文字 - --~--~-~--~~~---~--~~ 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 get all table names in SQL database
I have tried the method given by Mark in the following way: public final static String SQL_GET_ALL_TABLES = SELECT name FROM + sqlite_master WHERE type='table' ORDER BY name; dataBase.execSQL(this.SQL_GET_ALL_TABLES, tablenames); But I got exception while running dataBase.execSQL. I don't know where the mistake exists. Could anyone tell me? On 7月29日, 上午9时25分, Mark Murphy mmur...@commonsware.com wrote: guishenl...@gmail.com wrote: I want to get the tables programmatically not in the command line. And the database is created by myself not the contact database. http://www.sqlite.org/faq.html#q7 So to get a list of all tables in the database, use the following SELECT command: SELECT name FROM sqlite_master WHERE type='table' ORDER BY name; If you have questions on SQLite in general, use SQLite resources, like sqlite.org. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android Development Wiki:http://wiki.andmob.org --~--~-~--~~~---~--~~ 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 show the search bar
Hi all, I want to add the search function in my application just as the example given in ApiDemos. But I can't find out how the example add the search bar in the top of the view. Could anyone tell me how to add a search bar to my application by some code? Thank you in advance! reference code SearchInvoke.java: /* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.apis.app; import com.example.android.apis.R; import android.app.Activity; import android.app.AlertDialog; import android.app.SearchManager; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.AdapterView.OnItemSelectedListener; public class SearchInvoke extends Activity { // UI elements Button mStartSearch; Spinner mMenuMode; EditText mQueryPrefill; EditText mQueryAppData; // Menu mode spinner choices // This list must match the list found in samples/ApiDemos/res/ values/arrays.xml final static int MENUMODE_SEARCH_KEY = 0; final static int MENUMODE_MENU_ITEM = 1; final static int MENUMODE_TYPE_TO_SEARCH = 2; final static int MENUMODE_DISABLED = 3; /** * Called with the activity is first created. * * We aren't doing anything special in this implementation, other than * the usual activity setup code. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Inflate our UI from its XML layout description. setContentView(R.layout.search_invoke); // Get display items for later interaction mStartSearch = (Button) findViewById(R.id.btn_start_search); mMenuMode = (Spinner) findViewById(R.id.spinner_menu_mode); mQueryPrefill = (EditText) findViewById (R.id.txt_query_prefill); mQueryAppData = (EditText) findViewById (R.id.txt_query_appdata); // Populate items ArrayAdapterCharSequence adapter = ArrayAdapter.createFromResource( this, R.array.search_menuModes, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource (android.R.layout.simple_spinner_dropdown_item); mMenuMode.setAdapter(adapter); // Create listener for the menu mode dropdown. We use this to demonstrate control // of the default keys handler in every Activity. More typically, you will simply set // the default key mode in your activity's onCreate() handler. mMenuMode.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected( AdapterView? parent, View view, int position, long id) { if (position == MENUMODE_TYPE_TO_SEARCH) { setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); } else { setDefaultKeyMode(DEFAULT_KEYS_DISABLE); } } public void onNothingSelected(AdapterView? parent) { setDefaultKeyMode(DEFAULT_KEYS_DISABLE); } }); // Attach actions to buttons mStartSearch.setOnClickListener( new OnClickListener() { public void onClick(View v) { onSearchRequested(); } }); } /** * Called when your activity's options menu needs to be updated. */ @Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); MenuItem item; // first, get rid of our menus (if any) menu.removeItem(0); // next, add back item(s) based on current menu mode switch (mMenuMode.getSelectedItemPosition()) { case MENUMODE_SEARCH_KEY: item = menu.add( 0, 0, 0, (Search Key)); break; case MENUMODE_MENU_ITEM: item = menu.add( 0, 0, 0, Search); item.setAlphabeticShortcut(SearchManager.MENU_KEY); break; case MENUMODE_TYPE_TO_SEARCH: item = menu.add( 0, 0, 0, (Type-To-Search));
[android-developers] NullPointerException when adding an ExpandableListView
Hi all, I want to add an ExpandableListView in a LinearLayout defined in main.xml. But I met NullPointerException:null when I added it to the xml file. I don't know what's wrong with it. Could anyone help me to solve this problem? Thank you in advance! Here is the code of main.xml: ?xml version=1.0 encoding=utf-8? LinearLayout android:id=@+id/LinearLayout01 android:layout_width=wrap_content android:layout_height=wrap_content xmlns:android=http:// schemas.android.com/apk/res/androidButton android:id=@+id/ Button01 android:layout_width=wrap_content android:layout_height=wrap_content/Button ExpandableListView android:id=@+id/ExpandableListView01 android:layout_width=wrap_content android:layout_height=wrap_content/ExpandableListView /LinearLayout --~--~-~--~~~---~--~~ 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] Can I calculate the user's moving speed by phone?
Hi all, I want to develope an application to calculate the user's moving speed by an Android phone like G1(Is it feasible on hardware?). But I don't know whether similar software exists already. If anyone know such similar application please tell me, and it will help me a lot in my design. Thank you in advance! --~--~-~--~~~---~--~~ 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 the selected location
Hi all, I'm working at an application about MapVIew. But I don't know how to respond to a click event on the map and how to get the geographical coordinate of the click. Could anyone give me some sample code to help me ? Thank you in advance! --~--~-~--~~~---~--~~ 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 send file by socket
Hi all, I want to send a file from the Android phone to a server by socket.Could anyone give me some example code about how to do it? Thank you in advance! --~--~-~--~~~---~--~~ 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 add text in ImageButton
Hi all, I want to use an imagebutton in my application, but only a button with image can not indicate its function clearly. If there are some text beside the button, I think everything will be more explicit. But I don't know how to add text in an imagebutton in Android.Can anyone help me with code?If text is not supported in imagebutton, can I define my own imagebutton which can show text by extending ImageButton, and how to do this? Thank you in advance! --~--~-~--~~~---~--~~ 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] Picture supported in Android
Hi all, I'm doing an application of showing picture with ImageView.I want to know how many kinds of picture are supported in Android, and what are they.Could anyone give a list of these files?Thank you in advance! --~--~-~--~~~---~--~~ 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: Picture supported in Android
Thank you for the help! On Apr 21, 10:34 am, Anonymous Anonymous firewallbr...@googlemail.com wrote: http://developer.android.com/guide/appendix/media-formats.html On Tue, Apr 21, 2009 at 8:02 AM, guishenl...@gmail.com guishenl...@gmail.com wrote: Hi all, I'm doing an application of showing picture with ImageView.I want to know how many kinds of picture are supported in Android, and what are they.Could anyone give a list of these files?Thank you in advance!- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: Problem on ImageSwitcher.setImageURI
Thanks for the reply! I've solved the problem by using Uri imageUri = Uri.parse(imageFileDir.listFiles() [position].getAbsolutePath()); mSwitcher.setImageURI(imageUri); On Apr 7, 9:12 am, Mark Murphy mmur...@commonsware.com wrote: guishenl...@gmail.com wrote: Nobody knows? I suspect your photo is not located at /data/data/com.Android.Hust.PoliceMap/app_c/2.jpg. App-local files should be in /data/data/your.package.here/files or subdirectories under there. BTW, your application should not be using the com.android namespace. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ 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: Question about zoom a picture
Nobody knows? On Apr 2, 1:07 pm, guishenl...@gmail.com guishenl...@gmail.com wrote: Hi all, I'm learning how to show pictures now, and following the example ApiDemos given by sdk.I want to add the zoom function to the ImageSwitcher, but I didn't find useful code in sdk. Can anyone give me some code to help me about zooming the picture in ImageSwitcher? Here is the code of ApiDemos which I followed: /* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.apis.view; import com.example.android.apis.R; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.animation.AnimationUtils; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Gallery; import android.widget.Gallery.LayoutParams; import android.widget.ImageSwitcher; import android.widget.ImageView; import android.widget.ViewSwitcher; public class ImageSwitcher1 extends Activity implements AdapterView.OnItemSelectedListener, ViewSwitcher.ViewFactory { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.image_switcher_1); mSwitcher = (ImageSwitcher) findViewById(R.id.switcher); mSwitcher.setFactory(this); mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in)); mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); Gallery g = (Gallery) findViewById(R.id.gallery); g.setAdapter(new ImageAdapter(this)); g.setOnItemSelectedListener(this); } public void onItemSelected(AdapterView parent, View v, int position, long id) { mSwitcher.setImageResource(mImageIds[position]); } public void onNothingSelected(AdapterView parent) { } public View makeView() { ImageView i = new ImageView(this); i.setBackgroundColor(0xFF00); i.setScaleType(ImageView.ScaleType.FIT_CENTER); i.setLayoutParams(new ImageSwitcher.LayoutParams (LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); return i; } private ImageSwitcher mSwitcher; public class ImageAdapter extends BaseAdapter { public ImageAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { ImageView i = new ImageView(mContext); i.setImageResource(mThumbIds[position]); i.setAdjustViewBounds(true); i.setLayoutParams(new Gallery.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); i.setBackgroundResource(R.drawable.picture_frame); return i; } private Context mContext; } private Integer[] mThumbIds = { R.drawable.sample_thumb_0, R.drawable.sample_thumb_1, R.drawable.sample_thumb_2, R.drawable.sample_thumb_3, R.drawable.sample_thumb_4, R.drawable.sample_thumb_5, R.drawable.sample_thumb_6, R.drawable.sample_thumb_7}; private Integer[] mImageIds = { R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7}; }- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: Problem on ImageSwitcher.setImageURI
Nobody knows? On Apr 1, 12:51 pm, guishenl...@gmail.com guishenl...@gmail.com wrote: Hi all, I tried to show a picture in local file system in a imageswitcher. But I could see nothing but a black screen in fact. Here is my code: public void onItemSelected(AdapterView parent, View v, int position, long id) { Uri imageUri = Uri.fromFile(imageFileDir.listFiles()[position]); /* imageUri has the value of file:///data/data/ com.Android.Hust.PoliceMap/app_c/2.jpg, and the file 2.jpg exists indeed. */ mSwitcher.setImageURI(imageUri); } When I debugged it, it showed me the message resolveUri failed on bad bitmap uri: file:///data/data/com.Android.Hust.PoliceMap/app_c/2.jpg. Is anyone can tell me how to solve this problem and show my picture in the Emulator? Thank you in advance! --~--~-~--~~~---~--~~ 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 Zoom out a picture
Nobody knows? On Mar 31, 12:44 pm, guishenl...@gmail.com guishenl...@gmail.com wrote: Hi all, If I have a picture file stored in the phone memery (.jpg .bmp etc.),can I use Android API to zoom it out.For example, convert a picture of size 800*800 to 80*80. If anyone knows, please give me some sample code. Thank you in advance! --~--~-~--~~~---~--~~ 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] About Video Call
Hi all, I want to develop an application containing video call, but I didn't find the interface in Android about video call. So I wonder whether Android has this Api in fact, if anyone know it, please tell me.Thank you in Advance! --~--~-~--~~~---~--~~ 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] Question about zoom a picture
Hi all, I'm learning how to show pictures now, and following the example ApiDemos given by sdk.I want to add the zoom function to the ImageSwitcher, but I didn't find useful code in sdk. Can anyone give me some code to help me about zooming the picture in ImageSwitcher? Here is the code of ApiDemos which I followed: /* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.apis.view; import com.example.android.apis.R; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.animation.AnimationUtils; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Gallery; import android.widget.Gallery.LayoutParams; import android.widget.ImageSwitcher; import android.widget.ImageView; import android.widget.ViewSwitcher; public class ImageSwitcher1 extends Activity implements AdapterView.OnItemSelectedListener, ViewSwitcher.ViewFactory { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.image_switcher_1); mSwitcher = (ImageSwitcher) findViewById(R.id.switcher); mSwitcher.setFactory(this); mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in)); mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); Gallery g = (Gallery) findViewById(R.id.gallery); g.setAdapter(new ImageAdapter(this)); g.setOnItemSelectedListener(this); } public void onItemSelected(AdapterView parent, View v, int position, long id) { mSwitcher.setImageResource(mImageIds[position]); } public void onNothingSelected(AdapterView parent) { } public View makeView() { ImageView i = new ImageView(this); i.setBackgroundColor(0xFF00); i.setScaleType(ImageView.ScaleType.FIT_CENTER); i.setLayoutParams(new ImageSwitcher.LayoutParams (LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); return i; } private ImageSwitcher mSwitcher; public class ImageAdapter extends BaseAdapter { public ImageAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { ImageView i = new ImageView(mContext); i.setImageResource(mThumbIds[position]); i.setAdjustViewBounds(true); i.setLayoutParams(new Gallery.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); i.setBackgroundResource(R.drawable.picture_frame); return i; } private Context mContext; } private Integer[] mThumbIds = { R.drawable.sample_thumb_0, R.drawable.sample_thumb_1, R.drawable.sample_thumb_2, R.drawable.sample_thumb_3, R.drawable.sample_thumb_4, R.drawable.sample_thumb_5, R.drawable.sample_thumb_6, R.drawable.sample_thumb_7}; private Integer[] mImageIds = { R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7}; } --~--~-~--~~~---~--~~ 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: Error on adb push
Thanks for your help! On Mar 31, 7:46 pm, Mark Murphy mmur...@commonsware.com wrote: guishenl...@gmail.com wrote: Hi all, When I tried to copy a file in my PC to the Android Emulator, I used the command C:\Documents and Settings\Aliothadb push D:\Data\Android\1.jpg \data \data\. But the it didn't work and the error message was failed to copy 'D:\Android\1.jpg' to '\data\data\': Read-only file system. I don't know what to do, can anyone help me ? 1. Android is Linux-based, so your path separator should be / instead of \ in the final parameter on your adb push command. 2. You may not be able to push files to /data/data on the emulator. You definitely cannot on a device. Your files do not belong there. Put them in /data/data/your.package.here/files, where your.package.here is the Java package associated with your Android application. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.0 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] Problem on ImageSwitcher.setImageURI
Hi all, I tried to show a picture in local file system in a imageswitcher. But I could see nothing but a black screen in fact. Here is my code: public void onItemSelected(AdapterView parent, View v, int position, long id) { Uri imageUri = Uri.fromFile(imageFileDir.listFiles()[position]); /* imageUri has the value of file:///data/data/ com.Android.Hust.PoliceMap/app_c/2.jpg, and the file 2.jpg exists indeed. */ mSwitcher.setImageURI(imageUri); } When I debugged it, it showed me the message resolveUri failed on bad bitmap uri: file:///data/data/com.Android.Hust.PoliceMap/app_c/2.jpg. Is anyone can tell me how to solve this problem and show my picture in the Emulator? Thank you in advance! --~--~-~--~~~---~--~~ 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] Error on adb push
Hi all, When I tried to copy a file in my PC to the Android Emulator, I used the command C:\Documents and Settings\Aliothadb push D:\Data\Android\1.jpg \data \data\. But the it didn't work and the error message was failed to copy 'D:\Android\1.jpg' to '\data\data\': Read-only file system. I don't know what to do, can anyone help me ? --~--~-~--~~~---~--~~ 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 Zoom out a picture
Hi all, If I have a picture file stored in the phone memery (.jpg .bmp etc.),can I use Android API to zoom it out.For example, convert a picture of size 800*800 to 80*80. If anyone knows, please give me some sample code. Thank you in advance! --~--~-~--~~~---~--~~ 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: Problem on creating Socket
For the PC side, the server code is just the same as usual java server code. And for the emulator side, you need to change the ip address represent local machine from 127.0.0.1 to 10.0.2.2. On Mar 28, 6:04 am, ndefo arnauld ndefoarna...@gmail.com wrote: hi, please, it is possible to use a socket a android emulator to my own remote server???if yes how can i doplease i need your helm --~--~-~--~~~---~--~~ 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 show my ProgressBar
I still have some question on it. If I put the backgroundWork() in another thread, how can the main UI thread know background thread has finished? And how to pause the main UI thread to wait for backgroundWork(). On Mar 25, 12:44 pm, Marco Nelissen marc...@android.com wrote: The problem is that your 'backgroundWork() method is not actually running in the background, but in the main UI thread. You'll need to do the work in a separate thread. On Tue, Mar 24, 2009 at 8:02 PM, guishenl...@gmail.com guishenl...@gmail.com wrote: I want to show a ProgressBar while doing some background operation, but my code seems not to work. I hope someone can help me to solve this problem. Thank you in advance!Here is my code and explanation : public boolean onMenuItemSelected(int featureId, MenuItem item) { switch(item.getItemId()) { case CASEONE_ID: ProgressBar progress = (ProgressBar)findViewById (R.id.ProgressBar); progress.setVisibility(View.VISIBLE); progress.bringToFront(); progress.invalidate(); backgroundWork(); progress.setVisibility(View.GONE); progress.invalidate(); return true; } return super.onMenuItemSelected(featureId, item); }/*In fact I never see the progressbar by this code, instead the program will keep frozen until backgroundWork() finish. But what I want is the progressbar can appear in the screen while backgroungWork () is being processed. private void backgroundWork(){ for(int i=0;i1E8;i++); }/*This is not the exact work I did in my own program. I change it to this form is just to tell you my operation will occupy the processor for long time.*/- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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] Problem on creating Socket
Hi all, I'm working at an application about network and faced some problem.I did a client which will send some data to the server.But, if the server is not open, my client will in trouble. Here is the code and exact state: try{ Socket netSocket = new Socket(10.0.2.2, 9001); / *Problem is in this line*/ /* At this line, when I try to create a socket binding to the local PC, the program will pause for very long time(almost 5 mins) and then go to IOExcption handling code where shows The operation timed out..When the server in my local PC is running, everything is OK.I need the program can response immediately, can anyone help me? */ .. } catch (UnknownHostException e) { Log.d(SoControl, UnknownHostException : + e.getLocalizedMessage()); } catch (IOException e) { Log.d(SoControl, IOException : + e.getLocalizedMessage()); } --~--~-~--~~~---~--~~ 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: Problem on creating Socket
Thanks for your help, Dillirao! I have made it work! Here is my final code which can response within 10 seconds: try{ Socket netSocket = null; SOCKET_TIMEOUT = 1; InetSocketAddress myAddress = new InetSocketAddress(10.0.2.2, 9001 ); netSocket = new Socket(); netSocket.connect(myAddress, SOCKET_TIMEOUT); .. } catch (UnknownHostException e) { Log.d(SoControl, UnknownHostException : + e.getLocalizedMessage()); } catch (IOException e) { Log.d(SoControl, IOException : + e.getLocalizedMessage()); } On Mar 24, 3:42 pm, dillirao malipeddi dillir...@arijasoft.com wrote: int SOCKET_TIMEOUT = 1; //10 sec InetSocketAddress myAddRess = new InetSocketAddress(url_connect,port ); //InetSocketAddress(InetAddress address, int port) try { //1. creating a socket to connect to the server Log.i(connecting to :+url_connect+], at port [+port+]); //requestSocket.setSoTimeout(SOCKET_TIMEOUT); //set time out for this scoket //if(myDebug.debug_Log)Log.i(SetSocketTimeOut,---WHILE CONNECTING SET TO 10 sec); requestSocket = new Socket();//(url_connect, port); try { Log.i(Try,To connect in 10 sec); requestSocket.connect(myAddRess, SOCKET_TIMEOUT);} catch (SocketTimeoutException SE) { Log.i(SocketTimeoutException,---+SE.toString()); requestSocket.close(); requestSocket = null; } } catch(Exception e) { Log.i(Exception,--is+e.tostring()); } This will try to connect with in 10 sec if not connected the timeout exception will raise On Tue, Mar 24, 2009 at 12:55 PM, guishenl...@gmail.com guishenl...@gmail.com wrote: Hi all, I'm working at an application about network and faced some problem.I did a client which will send some data to the server.But, if the server is not open, my client will in trouble. Here is the code and exact state: try{ Socket netSocket = new Socket(10.0.2.2, 9001); / *Problem is in this line*/ /* At this line, when I try to create a socket binding to the local PC, the program will pause for very long time(almost 5 mins) and then go to IOExcption handling code where shows The operation timed out..When the server in my local PC is running, everything is OK.I need the program can response immediately, can anyone help me? */ .. } catch (UnknownHostException e) { Log.d(SoControl, UnknownHostException : + e.getLocalizedMessage()); } catch (IOException e) { Log.d(SoControl, IOException : + e.getLocalizedMessage()); } -- Dilli Rao. M- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 show my ProgressBar
I want to show a ProgressBar while doing some background operation, but my code seems not to work. I hope someone can help me to solve this problem. Thank you in advance!Here is my code and explanation : public boolean onMenuItemSelected(int featureId, MenuItem item) { switch(item.getItemId()) { case CASEONE_ID: ProgressBar progress = (ProgressBar)findViewById (R.id.ProgressBar); progress.setVisibility(View.VISIBLE); progress.bringToFront(); progress.invalidate(); backgroundWork(); progress.setVisibility(View.GONE); progress.invalidate(); return true; } return super.onMenuItemSelected(featureId, item); }/*In fact I never see the progressbar by this code, instead the program will keep frozen until backgroundWork() finish. But what I want is the progressbar can appear in the screen while backgroungWork () is being processed. private void backgroundWork(){ for(int i=0;i1E8;i++); }/*This is not the exact work I did in my own program. I change it to this form is just to tell you my operation will occupy the processor for long time.*/ --~--~-~--~~~---~--~~ 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 show my ProgressBar
Thank you for your reply! On Mar 25, 12:44 pm, Marco Nelissen marc...@android.com wrote: The problem is that your 'backgroundWork() method is not actually running in the background, but in the main UI thread. You'll need to do the work in a separate thread. On Tue, Mar 24, 2009 at 8:02 PM, guishenl...@gmail.com guishenl...@gmail.com wrote: I want to show a ProgressBar while doing some background operation, but my code seems not to work. I hope someone can help me to solve this problem. Thank you in advance!Here is my code and explanation : public boolean onMenuItemSelected(int featureId, MenuItem item) { switch(item.getItemId()) { case CASEONE_ID: ProgressBar progress = (ProgressBar)findViewById (R.id.ProgressBar); progress.setVisibility(View.VISIBLE); progress.bringToFront(); progress.invalidate(); backgroundWork(); progress.setVisibility(View.GONE); progress.invalidate(); return true; } return super.onMenuItemSelected(featureId, item); }/*In fact I never see the progressbar by this code, instead the program will keep frozen until backgroundWork() finish. But what I want is the progressbar can appear in the screen while backgroungWork () is being processed. private void backgroundWork(){ for(int i=0;i1E8;i++); }/*This is not the exact work I did in my own program. I change it to this form is just to tell you my operation will occupy the processor for long time.*/- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---