[android-developers] Creating new directory under out\target\product\*\data
I'm trying to write a makefile for the Android system that copies files from my local filesystem to out/target/product*/data. Is there anyway to create new directories from within the makefile? What I'm doing right now is: file := $(TARGET_OUT_DATA)/media/audio/wolf.mp3 $(file) : $(LOCAL_PATH)/media/audio/wolf.mp3 However, this doesn't create /data/media (and /data/media/audio). --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: [android-developers] Utilizing HTTPS
You can use .net clases for https import java.net.* import javax.net.ssl.HttpsURLConnection; { HttpsURLConnection urlConnection; urlConnection = (HttpsURLConnection) new URL(actionUrl).openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String str; StringBuffer responseBuffer= new StringBuffer(); while ((str = in.readLine()) != null) { responseBuffer.append(str); } } - Anurag Singh On Mon, Jan 11, 2010 at 10:40 PM, Knossos wrote: > Hi, > > I want to use HTTPS in my application. The Java URL class does not > seem to do the job. > > Does anyone have any pointers? > > Thanks! > Knossos. > > -- > 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 > -- 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: Tiff Codec
Yeah, we can use C function from Android SDK. Please go through with Android NDK which is provided by Google. It's just like using C code from Java using JNI. ~ Anurag Singh On Thu, Jun 9, 2011 at 4:19 AM, Gregory Nash wrote: > But LibTiff is a set of C functions. Is it possible to access this > library from code written with the android SDK? If so, where would I > learn how to do this? > > From google searches, I've also found this > > http://www.java2s.com/Open-Source/Android/File/tiffonandroid/Catalogtiffonandroid.htm > but I don't understand it. It's TiffDecoder.java class looks more like > a header file than source code. In a static method that seems > nameless, it loads some sort of library that I can't find information > about. Maybe it's somehow loading the LibTiff library? I tried putting > System.loadLibrary("tiff"); > in my code but it crashed the program in the emulator. Maybe it would > work with a different AVD? > > On Aug 13 2010, 3:18 am, Anurag Singh wrote: > > LibTiff is the right place. > > > > http://www.libtiff.org/ > > > > - Anurag Singh > > > > > > > > > > > > > > > > On Thu, Aug 12, 2010 at 2:37 PM, Reddy wrote: > > > Hi, > > > > > I am not sure whether it is the right place to ask this question. > > > > > Has any one implemented the codec for Tiff formated image? If any one > > > is having any idea please share the info where i can get the source > > > code for the same. > > > > > Help is hightly appreciated. > > > > > /Reddy > > > > > -- > > > 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< > android-developers%2bunsubscr...@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] aidl.exe is missing from tool directory
Hello All I had install SDK 2.0. I am not able to locate aidl.exe in tool directory. Please help to locate. Is there any location from where I can download? Thanks In Advance. Anurag -- 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
Re: [android-developers] aidl.exe is missing from tool directory
Thanks a lot, I got the same. > I had install SDK 2.0. I am not able to locate aidl.exe in tool directory. > > It will not be in the top-level tools directory, but in a > platform-specific tools directory. For example, if you have installed > the SDK in C:\SDK, you will find the Android 2.1 version of aidl.exe in > C:\SDK\platforms\android-2.1\tools. > > Ant and Eclipse should each find it without issue, if you have > everything configured properly. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Android Consulting: http://commonsware.com/consulting > > -- > 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 -- 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
Re: [android-developers] Can i get this layout with List view??
I think, it's not right way. You have mention Button in a TextView. - Anurag Singh Hi. please find the link to attached file, i need to have this kinda > layout. > is it possible?? > well perhaps it is, but im not getting it how to do it. > i want to specify the whole layout in the xml, but it gives runtime > error > > here's the link to the blue print of desired layout: > > http://lh6.ggpht.com/_o9EYB0b5APY/S8s-coQE-KI/CrA/KJUl5ANBi88/desired%20layout.jpg > > here's my main.xml- > > > http://schemas.android.com/apk/res/ > android" >android:orientation="vertical" >android:layout_width="fill_parent" >android:layout_height="fill_parent" >> > android:id="@+id/widget28" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:layout_x="17px" > android:layout_y="10px" > > > android:id="@+id/widget40" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="Button" > android:layout_alignTop="@+id/widget39" > android:layout_toRightOf="@+id/widget38" > > > > android:id="@+id/widget39" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="TextView" > android:layout_alignParentBottom="true" > android:layout_alignParentLeft="true" > > > android:id="@+id/widget38" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="Button" > android:layout_alignParentTop="true" > android:layout_alignParentRight="true" > > > > > > android:id="@+id/tweetList" >android:layout_width="wrap_content" >android:layout_height="wrap_content" >/> > > > is anything wrong?? > > -- > 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 -- 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
Re: [android-developers] Portrait/landscape question
Specify in your manifest file into Activity block as android:ScreenOrientation="portrait" I've got an app that I don't want to auto-rotate. Currently, I've got > it set up so that it is always in portrait mode. However, I'd like to > add a setting to my preferences where the user can choose either > portrait or landscape mode. Is there a way to force screen rotation? > Or, could I perhaps make two different layout XML files, one for > portrait and one for landscape, and programmatically choose which to > use? > > -- > 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 -- 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
Re: [android-developers] Handling Orientation Changes in AppWidgets
Implement OnConfigurationChanged() function of your Activity and also mention in your manifest as android:configChanged=s="orientation" > How can we tell our AppWidget to recalculate the amount of text > displayed on screen orientation change? Is this possible? How would > you solve this problem? > > > -- > 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 -- 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
Re: [android-developers] Handling Orientation Changes in AppWidgets
Implement OnConfigurationChanged() function of your Activity and also mention in your manifest as android:configChanges="orientation" How can we tell our AppWidget to recalculate the amount of text > displayed on screen orientation change? Is this possible? How would > you solve this problem? > > -- 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
Re: [android-developers] GetLocation of the phone
Have you set uses permission in manifiest file. - Anurag Singh Hi, > > I am trying to retrieve the GPS location of the phone. I believe I > cannot create an object of the class which stores the location in a > variable. So that once the class gets instantiated I use a get method > and retrieve the content in the variable. > So I am trying to do this > > locationListener = new MyLocationListener(); > >lm.requestLocationUpdates( >LocationManager.GPS_PROVIDER,0,0,locationListener); >if(!information.equals(null)){ >Bundle bundle = new Bundle(); >bundle.putString("hello", information); >Intent intent = new Intent(LocationActivity.this, > MainActivity.class); >intent.putExtras(bundle); >startActivity(intent); >} > > > and in the locationlistener class > > > public void onLocationChanged(Location loc) { >if (loc != null) { >double lat=loc.getLatitude(); >double lon=loc.getLongitude(); >information = " "+lat +lon; >Toast.makeText(getBaseContext(), >"Location Changed:"+information, >Toast.LENGTH_LONG).show(); >} >else >information="bad luck"; >} > > The mainactivity then displays that...but its not happening...could > some one please help me how to get the values of this. > > Thanks...Raqeeb > > -- > 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 -- 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
Re: [android-developers] Re: GetLocation of the phone
Store in a Bundle pass to your activity public void onLocationChanged(Location loc) { if (loc != null) { double lat=loc.getLatitude(); double lon=loc.getLongitude(); Bundle bundle = new Bundle(); bundle.putDouble("lat", lat); bundle.putDouble("lon", lon); // Create Intent, store Bundle into Intent and paas intent to another Activity information = " "+lat +lon; Toast.makeText(this, "Location Changed:"+information, Toast.LENGTH_LONG).show(); } } And you can extract these value in OnCreate() of another Activity. Bundle b = this.getIntent().getExtras(); - Anurag Singh On Mon, Apr 19, 2010 at 10:24 AM, raqz wrote: > yes.. its getting the locations all right..but i am unable to save the > location somwhere so that i can use it later. thats the whole > issue > > I just thought of something... > if I start a service that does the onLocationChanged stuffit would > get the gps locations and store it (somewhere in the system) > and later if i just start an acitivity that would do > getLastKnowLocation() , shouldn't that fetch the location for further > use. > Come some one advise please > > > > On Apr 19, 12:22 am, Anurag Singh wrote: > > Have you set uses permission in manifiest file. > > > > > android:name="android.permission.ACCESS_FINE_LOCATION" /> > > > > - Anurag Singh > > > > Hi, > > > > > > > > > > > > > I am trying to retrieve the GPS location of the phone. I believe I > > > cannot create an object of the class which stores the location in a > > > variable. So that once the class gets instantiated I use a get method > > > and retrieve the content in the variable. > > > So I am trying to do this > > > > > locationListener = new MyLocationListener(); > > > > >lm.requestLocationUpdates( > > >LocationManager.GPS_PROVIDER,0,0,locationListener); > > >if(!information.equals(null)){ > > >Bundle bundle = new Bundle(); > > >bundle.putString("hello", information); > > >Intent intent = new Intent(LocationActivity.this, > > > MainActivity.class); > > >intent.putExtras(bundle); > > >startActivity(intent); > > >} > > > > > and in the locationlistener class > > > > > public void onLocationChanged(Location loc) { > > >if (loc != null) { > > >double lat=loc.getLatitude(); > > >double lon=loc.getLongitude(); > > >information = " "+lat +lon; > > >Toast.makeText(getBaseContext(), > > >"Location Changed:"+information, > > >Toast.LENGTH_LONG).show(); > > >} > > >else > > >information="bad luck"; > > >} > > > > > The mainactivity then displays that...but its not happening...could > > > some one please help me how to get the values of this. > > > > > Thanks...Raqeeb > > > > > -- > > > 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 > > > > -- > > 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 athttp:// > 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 > -- 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 pick or upload gallery photo
Hello All I have some requirement to upload photo. I am able to browse gallery but not able to pick any photo from main gallery. Android allows us to upload snaps from SDCARD, I think there must be some way. isn't it? Thanks In Advance. - Anurag Singh -- 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] A Simple question about photo Gallery
Hello All I did all my home work regarding gallery. private static final int SELECT_PICTURE = 1; private static final int SELECT_GALLERY_PICTURE = 2; private String selectedImagePath; // Browse and pick photo from SDCARD, wokring perfact Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent,SELECT_PICTURE); // Browse Gallery, working perfact Intent gIntent = new Intent(); gIntent.setClassName("com.android.camera", "com.android.camera.GalleryPicker"); gIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(gIntent); //It's not working Intent gIntent = new Intent(); gIntent.setClassName("com.android.camera", "com.android.camera.GalleryPicker"); gIntent.setAction(Intent.ACTION_PICK); startActivityForResult(gIntent,SELECT_GALLERY_PICTURE); I just want to know the feasible to pick photo from built-in Gallery and get image path and data?? Please say Yes or No. I want to move towards right direction. if it's feasible, definitely I will try to find my way. Thanks, Anurag -- 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
Re: [android-developers] Display small portion of HTML file in WebView
Please use webView.loadData("Hello, world!", "text/html", "UTF-8"); There are so many navigation functions to move forward and back, like goBack(), canGoBack(), goForward(), canGoForward(), reload() etc. - Anurag Singh On Wed, Apr 21, 2010 at 8:07 AM, mansur wrote: > Hi All, > > We have a large HTML which contents 1000's of lines. But we want to > show content of the HTML file that fits a > single screen. We want provide a '>' kind of to show the next > contents of the same HTML file. > > Our objective is to only display the HTML contents that fits the > screen.Similar to reader application For user, it seems there are > several pages. > > Is there any way in which we can achieve this functionality. Whether > WebView has any function related to full fill the requirement. > > Thanks and Regards, > Mansur Agasar > > -- > 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 -- 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
Re: [android-developers] Re: A Simple question about photo Gallery
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); > intent.addCategory(Intent.CATEGORY_OPENABLE); > startActivityForResult(intent, SELECT_GALLERY_PICTURE); Thanks for your reply. It's again open SDCARD not in-built Gallery. Please provide suggestion. Thanks, Anurag On Wed, Apr 21, 2010 at 1:20 PM, VovaN wrote: > Intent intent = new Intent(Intent.ACTION_GET_CONTENT); > intent.setType("image/*"); > intent.addCategory(Intent.CATEGORY_OPENABLE); > startActivityForResult(intent, SELECT_GALLERY_PICTURE); > > On Apr 21, 5:33 am, Anurag Singh wrote: > > Hello All > > > > I did all my home work regarding gallery. > > > > private static final int SELECT_PICTURE = 1; > > private static final int SELECT_GALLERY_PICTURE = 2; > > private String selectedImagePath; > > > > // Browse and pick photo from SDCARD, wokring perfact > > > > Intent intent = new Intent(); > > intent.setType("image/*"); > > intent.setAction(Intent.ACTION_GET_CONTENT); > > startActivityForResult(intent,SELECT_PICTURE); > > > > // Browse Gallery, working perfact > > > > Intent gIntent = new Intent(); > > gIntent.setClassName("com.android.camera", > > "com.android.camera.GalleryPicker"); > > gIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); > > startActivity(gIntent); > > > >//It's not working > > Intent gIntent = new Intent(); > > gIntent.setClassName("com.android.camera", > > "com.android.camera.GalleryPicker"); > > gIntent.setAction(Intent.ACTION_PICK); > > startActivityForResult(gIntent,SELECT_GALLERY_PICTURE); > > > >I just want to know the feasible to pick photo from built-in > Gallery > > and get image path and data?? > > > >Please say Yes or No. > > > >I want to move towards right direction. if it's feasible, > definitely > > I will try to find my way. > > > > Thanks, > > Anurag > > > > -- > > 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 athttp:// > 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 -- 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
Re: [android-developers] Re: How to pick or upload gallery photo
I did all my home work regarding gallery. private static final int SELECT_PICTURE = 1; private static final int SELECT_GALLERY_PICTURE = 2; private String selectedImagePath; // Browse and pick photo from SDCARD, wokring perfact Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent,SELECT_PICTURE); // Browse Gallery, working perfact Intent gIntent = new Intent(); gIntent.setClassName("com.android.camera", "com.android.camera.GalleryPicker"); gIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(gIntent); // try to pick , It's not working Intent gIntent = new Intent(); gIntent.setClassName("com.android.camera", "com.android.camera. GalleryPicker"); gIntent.setAction(Intent.ACTION_PICK); startActivityForResult(gIntent,SELECT_GALLERY_PICTURE); By using third method , It's open gallery to browse. I'm not bale to pick photo and *startActivityForResult *method is not called. Thanks for your reply. - Anurag Singh On Thu, Apr 22, 2010 at 3:22 PM, Kumar Bibek wrote: > Have you tried anything? What problems are you facing? That will help > up answering your question. This question's answer will run into a > page of lines and pics. > > Please be specific about your problems. > > Sure, you can do what you want. > > > Thanks and Regards, > Kumar Bibek > > On Apr 20, 9:19 pm, Anurag Singh wrote: > > Hello All > > > > I have some requirement to upload photo. I am able to browse gallery > > but not able to pick any photo from main gallery. > > > > Android allows us to upload snaps from SDCARD, I think there > > must be some way. > > > > isn't it? > > > > Thanks In Advance. > > - Anurag Singh > > > > -- > > 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 athttp:// > 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 -- 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
Re: [android-developers] store sd card image in remote server
Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent,SELECT_PICTURE); GetImage in OnActivityResult public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == SELECT_PICTURE) { Uri selectedImageUri = data.getData(); selectedImagePath = getPath(selectedImageUri); Toast.makeText(this, selectedImagePath, Toast.LENGTH_LONG) .show(); } if(requestCode == SELECT_GALLERY_PICTURE){ Uri imageUri = data.getData(); String imagePath = getPath(imageUri); Toast.makeText(this, imagePath, Toast.LENGTH_LONG) .show(); } } } public String getPath(Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(uri, projection, null, null, null); int column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } Use HTTP POST to upload on server. - Anurag Singh On Sat, Apr 24, 2010 at 9:05 AM, aswani kumar tholeti wrote: > > Hi all, > > > how to store sd card image in remote server.any one please help me i posted > this question many times > > > but i am not getting any reply .it is very urgent to me > > > > Thanks in advance > > > Aswan > > -- > 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 -- 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
Re: [android-developers] Progress bar is run after task completing
Please send your main3 layout file, so that I can check what you want to do actually. - Anurag Singh On Sat, Apr 24, 2010 at 12:33 PM, pramod.deore wrote: > Hello everybody, > I am developing one application in that I am using progress > bar. but progress bar is display after task is completed.but I want to > run progress bar first and task must be completing in background. Here > is my code > > import android.app.Activity; > import android.os.Bundle; > import android.view.View; > import android.view.View.OnClickListener; > import android.widget.Button; > > public class Progress extends Activity implements OnClickListener > { >Button yesButton,noButton; >/** Called when the activity is first created. */ >@Override >public void onCreate(Bundle savedInstanceState) >{ >super.onCreate(savedInstanceState); >setContentView(R.layout.main1); >yesButton = (Button) findViewById(R.id.widget31); >noButton = (Button) findViewById(R.id.widget32); > >yesButton.setOnClickListener(this); >noButton.setOnClickListener(this); >} > >public void onClick(View v) >{ >if (v==yesButton) >{ >setContentView(R.layout.main3); >sendFileToServer(); >} >} > >public void sendFileToServer() >{ >for (int i=0;i<5000;i++) >{ >System.out.println ("Now value of i is"+i); >} >} > > > } > > > Here it prints value of i from 0 to 4999 then after that > R.layout.main3 is displayed. > what should I have to do? should I have to create a class that extends > from Service class in that palced the method sendFileToServer > > Please help me. > > 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 -- 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
Re: [android-developers] Inter thread Communication
1. use global varibales 2. use named pipe streams 3. use socket 4. use file system - Anurag Singh On Sat, Apr 24, 2010 at 9:31 PM, Shekhar wrote: > Hi All, > > I have a basic question on support of mutithreading in the android > application programming. > Suppose I have an activity running on the main thread and from the > main thread, I have > started two threads .Now my intention is to pass the data between > these two threads. > > Which method I have to use to pass the data between these two new > threads? > > Thanks, > Shekhar > > -- > 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 -- 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
Re: [android-developers] Inter thread Communication
Dianne, original poster want to pass stuff/data from main thread to secondary thread. is it possbile using Handler? Geaneraly, we use Handler to get back data from secondary thread to main thread using SendMessage() or Post(). - Anurag Singh > >> > Don't do these things for threads running in the same process (which is > what the original poster is asking about); much more overhead and complexity > for no purpose. > > Handler is Android's standard way to get stuff back on the main thread. > Create one in the main thread, then post messages or (Runnable objects if > desired) to get what you want to that thread. > > The other Java concurrency stuff can be useful, but be careful because you > don't want to end up with your main thread using that and blocking on one of > the other threads for data from it. The main thread is message-based, so > posting messages to it via Handler is a good approach. > > -- > 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 > -- 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
Re: [android-developers] Re: Inter thread Communication
Tejas, Thanks for very good example. It'll definitely help to setup communication between threads. It's mean that if we want to communicate from worker thread to main thread then we have to setup one another handler (which is assciated with another message queue) and using same message passing technique (obtainMessage and sendMessage, handleMessage). Conclusion, Handler is one-way message passing technique using queue. - Anurag Singh On Sun, Apr 25, 2010 at 10:08 AM, Tejas wrote: > So, here is the code to send messages to a worker thread. > In your main thread create a worker thread using HandlerThread: > >HandlerThread myThread = new HandlerThread("Worker > Thread"); >myThread.start(); > > You will have to implement a Handler class for this worker thread. > Suppose it is called MyHandler as follows: > > class MyHandler extends Handler { >public MyHandler(Looper myLooper) { >super(myLooper); >} >public void handleMessage(Message msg) { >Log.v("MyHandler", "handleMessage in worker > thread called"); >} >} > > Now, get the looper from that thread. And pass this looper to the > Handler class you implemented. >Looper mLooper = myThread.getLooper(); >MyHandler mHandler = new MyHandler(mServiceLooper); > > Now from your main thread when you have to pass a message to the > worker thread, do the following: >Message msg = mHandler.obtainMessage(); >//msg.obj = blah blah >mHandler.sendMessage(msg); > > -Cheers, > Tejas > > On Apr 24, 11:58 pm, Tejas wrote: > > I suppose, to pass data to a worker thread, that thread needs a > > Looper. Hence android has HandlerThread class which creates a looper > > for the worker thread. > > We can get this looper from the worker thread and then send messages > > to it. > > > > Please correct me if I'm wrong. I'll try to find some code > > demonstrating this. If anyone knows it already, please post a sample > > code. > > > > - Tejas > > > > On Apr 24, 11:43 pm, Anurag Singh wrote: > > > > > > > > > > > > > Dianne, original poster want to pass stuff/data from main thread to > > > secondary thread. > > > > > is it possbile using Handler? Geaneraly, we use Handler to get back > data > > > from secondary thread to main thread using SendMessage() or Post(). > > > > > - Anurag Singh > > > > > > Don't do these things for threads running in the same process (which > is > > > > what the original poster is asking about); much more overhead and > complexity > > > > for no purpose. > > > > > > Handler is Android's standard way to get stuff back on the main > thread. > > > > Create one in the main thread, then post messages or (Runnable > objects if > > > > desired) to get what you want to that thread. > > > > > > The other Java concurrency stuff can be useful, but be careful > because you > > > > don't want to end up with your main thread using that and blocking on > one of > > > > the other threads for data from it. The main thread is > message-based, so > > > > posting messages to it via Handler is a good approach. > > > > > > -- > > > > 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 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. > >
Re: [android-developers] Re: how to list the "live" background service
Actually, He is looking for command. Definitely you can use ps command. 1) Open command prompt 2) open shell (adb shell) 3) type linux command (ps) - Anurag Singh On Sun, Apr 25, 2010 at 1:57 AM, krox wrote: > Hi! > > See > http://groups.google.com/group/android-developers/browse_thread/thread/9d3a18d966a320cd# > > //Erik > > On 23 Apr, 10:21, yangm wrote: > > how to list the "live" background server, like the "ps -ef" on linux. > > > > Thanks, > > Ming > > > > -- > > 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 athttp:// > 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 > -- 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
Re: [android-developers] Problem XML : Bad XML Block
check that your attribute block is closed properly. - Anurag Singh On Sun, Apr 25, 2010 at 1:20 AM, fjfdeztoro wrote: > Hey guys, i am developing an application, and suddently, working with > XML, designing a menu, appear this error and now, apparently > everything is ok, but i can not run the application. > > That was the message from Console: > [2010-04-24 21:45:11 - DroidWallet] W/ResourceType( 3148): Bad XML > block: header size 2370 or total size 0 is larger than data size 0 > > Anybody knows how can i solve it? 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 -- 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
Re: [android-developers] Starting default calendar and contacts application
How you have open default mail client? I want to do same thing. -- Best Regards, Anurag Singh On Fri, Apr 23, 2010 at 4:49 PM, Tejas wrote: > Hi, > > What basically i wanna do is > > I have got three buttons in my app, one for calendar, one for contacts > and third for mail. when i click on those buttons corresponding > application should get open. > > The mail code works perfectly fine > but somehow calendar and contact code which i have doesnt work good, > can any one please provide the code. > > thank you very much. > > Regards, > Tejas > > -- > 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 -- 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
Re: [android-developers] Re: Progress bar is run after task completing
Try it, If you want to paas any specific message to UI then use message object for the same. like Message msg = handler.obtainMessage();e fucntion // set any value // get the same value in hadleMessag Complete code is here ProgressBar bar; Handler handler=new Handler() { public void handleMessage(Message msg) { bar.incrementProgressBy(5); } }; public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); bar=(ProgressBar)findViewById(R.id.progress); bar.setProgress(0); Thread background=new Thread(new Runnable() { public void run() { try { for (int i=0;i<20 && isRunning;i++) { Thread.sleep(1000); handler.sendMessage(handler.obtainMessage()); } } catch (Throwable t) { // just end the background thread } } } } - Anurag Singh On Sun, Apr 25, 2010 at 12:38 PM, pramod.deore wrote: > > Hello everybody again, > > Now my code runs in background anfd on foreground it shows progress > bar.But now I want to show another screen after sendFileToServer > method completes. I had tried followinfg but throws exception. Please > help me how to to do this? > > public void onClick(View v) >{ >if (v==yesButton) >{ > setContentView(R.layout.main2); > >t = new Thread(){ > public void run() > { >while (!threadDone) > { > sendFileToServer(); > > } > setContentView(R.layout.main3); > } >}; > >t.start(); > >} >} > >public void sendFileToServer() >{ >for (int i=0;i<5000;i++) >{ > >System.out.println ("Now value of i is"+i); >} > threadDone = true; > > >} > > -- > 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 > -- Best Regards, Anurag Singh -- 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
Re: [android-developers] Starting default calendar and contacts application
Is there any place where developer can easily find URI for Contact, Calender, Mail etc. - Anurag Singh > On Sun, Apr 25, 2010 at 2:23 AM, Anurag Singh > wrote: > >> How you have open default mail client? I want to do same thing. > > > Start an activity with it's intent set to a standard email URI - Android > will find the best match of the apps that can handle that type of intent. > > > -- 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
Re: [android-developers] Starting default calendar and contacts application
But, there must be some standard way to do this. Trek suggest, Start an activity with it's intent set to a standard email URI - Android will find the best match of the apps that can handle that type of intent. What is the standard email URI? how it could be standard if it's not part of SDK. - Anurag Singh > >No mail clients are part of the Android SDK. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Android 2.x Programming 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 > -- 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
Re: [android-developers] What is the maximum memory capacity
The maximum heap memory an process (app) gets in Android is 16M. That's not that much, a basic app takes already several MBs after you've only just started it. - Anurag Singh On Mon, Apr 26, 2010 at 9:34 AM, Karteek N wrote: > Hi all, > If i have implemented a database in an application. > So what ever the tables i create in that database will be saved in > /data/data/packagename/databasess > My question is how many tables i can create or how much data can i insert. > How to know capacity of the database.In which factors will it depends. > Please help > > Regards, > Karteek > > -- > 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 -- 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
Re: [android-developers] a question about menu
You have to implement *onCreateOptionsMenu() *in your Activity. public boolean *onCreateOptionsMenu*(Menu menu) { CreateMenu(menu); return(super.onCreateOptionsMenu(menu)); } private void CreateMenu(Menu menu) { menu.add(Menu.NONE, 1, Menu.NONE, "Add"); menu.add(Menu.NONE, 2, Menu.NONE, "Delete"); } First try it and let me know the problem. - Anurag Singh On Thu, Apr 22, 2010 at 1:40 PM, 智超 薛 wrote: > hey all! > > meet a question about menu. > > i want to push a button to pop-up menu, > > my coding is > > case R.id.menus: > if(myMenu==null) { >myMenu.add(0, 0, 0, > "Add").setIcon(R.drawable.addfolderr); >myMenu.add(0, 1, 0, > "Delete").setIcon(R.drawable.delete); >} >onCreateOptionsMenu(myMenu); > braek; > > but onCreateOptionsMenu(myMenu) is not work , > how to make it work ,or had other way to realize button pop-up menu ? > > -- > 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 -- 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
Re: [android-developers] Re: What is the maximum memory capacity
Nope, I want to say 16 MB restriction for Heap. You can save more in your database but you are not going to load whole database at run time. You have to manage your database efficiently. - Anurag Singh On Mon, Apr 26, 2010 at 12:58 PM, karteek wrote: > Thanks for your reply. > You mean to say that we can't save the database of more than 16M is it > so. > >a basic app takes already several MBs after you've only just started it. > Sorry i didn't understand above statement.Can u expand statement > > On Apr 26, 9:33 am, Anurag Singh wrote: > > The maximum heap memory an process (app) gets in Android is 16M. That's > not > > that much, > > a basic app takes already several MBs after you've only just started it. > > > > - Anurag Singh > > > > > > > > On Mon, Apr 26, 2010 at 9:34 AM, Karteek N wrote: > > > Hi all, > > > If i have implemented a database in an application. > > > So what ever the tables i create in that database will be saved in > > > /data/data/packagename/databasess > > > My question is how many tables i can create or how much data can i > insert. > > > How to know capacity of the database.In which factors will it depends. > > > Please help > > > > > Regards, > > > Karteek > > > > > -- > > > 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 > > > > -- > > 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 athttp:// > 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 > -- 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
Re: [android-developers] About EditText inputType
Use android:digits android:numeric - Anurag Singh On Fri, Apr 23, 2010 at 8:48 AM, E wrote: > Hi! I've searched for long-long time and I can't find the answer. > >android:inputType="number|phone"/> > > This will pop-up a soft keyboard with big buttons and some signs(- . > N , * # / ), right? > > But the propose for this EditText is entering an age number. > > Can I restrict the inputType to number AND use a phone keyboard > WITHOUT entering these signs? > > Thank you for guiding a newcomer. > > -- > 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 > -- 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
Re: [android-developers] Re: Starting default calendar and contacts application
Thanks Ajeet, have you set permission to write contact in your manifest.xml? - Auurag Singh On Mon, Apr 26, 2010 at 12:07 AM, AJ wrote: > Hi Anurag, > > You can start the contact activity in the following way:- > > Intent i = new Intent(Intent.ACTION_INSERT,People.CONTENT_URI); > i.putExtra(ContactsContract.Intents.Insert.NAME, "AJ"); > startActivity(i); > > But I am facing some problem in passing the Extra data to the > activity. It looks that Contact in SDK 2.1 has some limitation. > > I posted my problem in the following thread. But nobody answered.:- > > http://groups.google.com/group/android-developers/browse_thread/thread/37e59bcd5f3b4e5a# > > > Thanks, > AJ > > On Apr 25, 9:28 pm, Anurag Singh wrote: > > But, there must be some standard way to do this. > > > > Trek suggest, Start an activity with it's intent set to a standard email > URI > > - Android will find the best match of the apps that can handle that type > of > > intent. > > > > What is the standard email URI? how it could be standard if it's not part > of > > SDK. > > > > - Anurag Singh > > > > > > > > > >No mail clients are part of the Android SDK. > > > > > -- > > > Mark Murphy (a Commons Guy) > > >http://commonsware.com|http://twitter.com/commonsguy > > > > > Android 2.x Programming 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 > > > > -- > > 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 athttp:// > 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 > -- 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
Re: [android-developers] Starting default calendar and contacts application
Thanks Mark for your valuable note. Best Regards, Anurag Singh On Mon, Apr 26, 2010 at 12:11 AM, Mark Murphy wrote: > Anurag Singh wrote: > > But, there must be some standard way to do this. > > > > Trek suggest, Start an activity with it's intent set to a standard email > > URI - Android will find the best match of the apps that can handle that > > type of intent. > > > > What is the standard email URI? how it could be standard if it's not > > part of SDK. > > I believe TreKing was slightly mistaken in his choice of terms. Here is > a slightly corrected example from the one found on AndroidSnippets.org: > > Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); > > emailIntent.setType("text/plain"); > emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new > String[]{"t...@email.com"}); > emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject"); > emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text"); > > context.startActivity(Intent.createChooser(emailIntent, "Send mail...")); > > There is no Uri for sending an email. Instead, you use ACTION_SEND with > text/plain as the MIME type and a suitable set of extras. > > By using Intent.createChooser() to create your actual Intent, you will > let the user choose from available email clients how to send the message. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > _Android Programming Tutorials_ 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 > -- 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
Re: [android-developers] Re: Starting default calendar and contacts application
these are the permissions for contact. READ_CONTACTS, WRITE_CONTACTS - Anurag Singh On Mon, Apr 26, 2010 at 7:43 PM, AJ wrote: > @Anurag > I didn't need any permission, as my requirement is to launch the > Contact App. > > > Thanks, > AJ > > On Apr 26, 4:53 pm, Anurag Singh wrote: > > Thanks Ajeet, have you set permission to write contact in your > manifest.xml? > > > > - Auurag Singh > > > > > > > > On Mon, Apr 26, 2010 at 12:07 AM, AJ wrote: > > > Hi Anurag, > > > > > You can start the contact activity in the following way:- > > > > > Intent i = new Intent(Intent.ACTION_INSERT,People.CONTENT_URI); > > > i.putExtra(ContactsContract.Intents.Insert.NAME, "AJ"); > > > startActivity(i); > > > > > But I am facing some problem in passing the Extra data to the > > > activity. It looks that Contact in SDK 2.1 has some limitation. > > > > > I posted my problem in the following thread. But nobody answered.:- > > > > >http://groups.google.com/group/android-developers/browse_thread/threa. > .. > > > > > Thanks, > > > AJ > > > > > On Apr 25, 9:28 pm, Anurag Singh wrote: > > > > But, there must be some standard way to do this. > > > > > > Trek suggest, Start an activity with it's intent set to a standard > email > > > URI > > > > - Android will find the best match of the apps that can handle that > type > > > of > > > > intent. > > > > > > What is the standard email URI? how it could be standard if it's not > part > > > of > > > > SDK. > > > > > > - Anurag Singh > > > > > > > >No mail clients are part of the Android SDK. > > > > > > > -- > > > > > Mark Murphy (a Commons Guy) > > > > >http://commonsware.com|http://twitter.com/commonsguy > > > > > > > Android 2.x Programming 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 > > > > > > -- > > > > 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 athttp:// > > > 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 > > > > -- > > 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 athttp:// > 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 > -- 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
Re: [android-developers] How to unregister listener after application get closed
Why dont you put your code in OnDestry. like OnDestroy() { telephonyManager.listen(phoneListener, PhoneStateListener.LISTEN_NONE); } - Anurag Singh On Wed, Apr 28, 2010 at 7:07 PM, zohar lerman wrote: > Hi, > > I am writing an application that listens to phone calls and perform > some tasks when phone call arrives. > The Application contains one activity which includes 2 buttons ‘Start’ > and ‘Stop’ (where starts register the listener and stops unregister it > – see code below). > > The problem starts when the application is closed ( onDestroy is > called ). > If the user pressed on the start button and exit from the application > the listener still working (which is the expected behavior) but from > now it is impossible to unregister the listener since launching new > instance of the application create new instance of phoneListener. > > My question is: > 1. Is there better way to implement my requirement? > 2. Can I save the phoneListener object and reload It on > application creation? > 3. Any other idea? > > Thanks > > ((Button) findViewById(R.id.Start)).setOnClickListener(new > View.OnClickListener() { > public void onClick(View v) { >telephonyManager.listen(phoneListener, > PhoneStateListener.LISTEN_CALL_STATE); > } > }); > > ((Button) findViewById(R.id.Stop)).setOnClickListener(new > View.OnClickListener() { > public void onClick(View v) { >telephonyManager.listen(phoneListener, > PhoneStateListener.LISTEN_NONE); > } > }); > > -- > 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 -- 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
Re: [android-developers] Stopping or Killing a Thread
You can use Interrupt to strop a thread. http://java.sun.com/docs/books/tutorial/essential/concurrency/interrupt.html - Anurag Singh On Fri, Apr 30, 2010 at 3:57 AM, Cameron.M.Johnson < cameron.m.john...@gmail.com> wrote: > Hi There, > > I am basing my game off of the Lunar Lander demo. > > The problem I am having is my game not restoring its last saved state > when it comes back into focus. > > When the game loses focus/quits it saves all the information to a > Bundle correctly, then runs surfaceDestroyed() to shut down the > thread. > > When I restart the game, I thought onCreate(Bundle savedInstanceState) > method was supposed to always start first, then restore the saved > Bundle if it is not "Null". But because it sees that I have started/ > created a thread last time, it jumps straight to surfaceCreated > method. > > The only thing I can think of is to find a way to get rid/destroy the > thread so that it runs onCreate at the start. However the stop() and > destroy() methods for threads have been depreciated. Is there anyway > to do this? Or is there a better method of saving an instance of the > game? > > Basically when the game restarts it goes to surfaceCreated() instead > of onCreate(). > > > > Note: In surfaceDestroyed() if I force the application to crash here, > that gives me an "Application has stopped unexpectedly" error which > causes the thread to die. When I restart my game it runs onCreate, > sees that there is a bundle saved and starts from where the game left > off perfectly fine! > > > > BallDrop.java* > /** Called when the activity is first created. */ >@Override >public void onCreate(Bundle savedInstanceState) { >super.onCreate(savedInstanceState); >requestWindowFeature(Window.FEATURE_NO_TITLE); >setContentView(R.layout.balldrop); > >mBallDropView = (BallDropView) findViewById(R.id.BallDrop); >mBallDropThread = mBallDropView.getThread(); >mBallDropView.setTextView((TextView) findViewById(R.id.text)); > >if (savedInstanceState == null) { >mBallDropThread.setState(BallDropThread.STATE_READY); >} else { >Bundle map = savedInstanceState.getBundle(ICICLE_KEY); >if (map != null) { >mBallDropThread.restoreState(map); >} else { >mBallDropThread.setState(BallDropThread.STATE_PAUSE); >} >} >} > > @Override >protected void onSaveInstanceState(Bundle outState) { >//Store the game state >super.onSaveInstanceState(outState); >outState.putBundle(ICICLE_KEY, mBallDropThread.saveState()); >} > > > BallDropView.java* > > public void surfaceCreated(SurfaceHolder holder) { >// start the thread here so that we don't busy-wait in run() >// waiting for the surface to be created > // FIX FROM LUNAR LANDER ---> >if(thread.getState()== Thread.State.TERMINATED){ >thread = new BallDropThread(getHolder(), getContext(), > getHandler()); >thread.setRunning(true); >thread.start(); > // <--- FIX FROM LUNAR LANDER >}else { >thread.setRunning(true); >thread.start(); >} >} > >/* > * Callback invoked when the Surface has been destroyed and must > no longer > * be touched. WARNING: after this method returns, the Surface/ > Canvas must > * never be touched again! > */ >public void surfaceDestroyed(SurfaceHolder holder) { >// we have to tell thread to shut down & wait for it to > finish, or else >// it might touch the Surface after we return and explode >boolean retry = true; >thread.setRunning(false); >while (retry) { >try { >thread.join(); >retry = false; >} catch (InterruptedException e) { >} >} > /* mBallDrop.finish(); //CAUSES APP TO CRASH ON EXIT > WHICH KILLS THREAD*/ >} > > -- > 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 -- 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
Re: [android-developers] Read Gmail from my app
This is the suggestion provide by Mark. Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("text/plain"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"t...@email.com"}); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text"); context.startActivity(Intent.createChooser(emailIntent, "Send mail...")); There is no Uri for sending an email. Instead, you use ACTION_SEND with text/plain as the MIME type and a suitable set of extras. By using Intent.createChooser() to create your actual Intent, you will let the user choose from available email clients how to send the message. - Anurag Singh On Fri, Apr 30, 2010 at 1:31 AM, ling chiao wrote: > Hi: > I got exception trying to read email > > Uri uri = Uri.parse("content://com.android.provider/EmailProvider/"); > Intent intent = new Intent(Intent.ACTION_VIEW, uri); > startActivity(intent); > > "No Activity found to handle Intent { act=android.intent.action.VIEW > dat=content://com.android.provider/EmailProvider/ }" > Is this doable from my app? What is the right URI? > > Thanks so much. > ling > > -- > 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 -- 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
Re: [android-developers] Re: Easiest way to communicate between two activities in two different Applications
What about Intent intent =getIntent(); in your OnCreate() of second Activity. - Anurag Singh On Sat, May 1, 2010 at 3:48 PM, Sebastian wrote: > yes i tried to use broadcast receiver: > > Intent intent = new Intent("b.intent.action.Broadcast"); > sendBroadcast(intent); > > Then i added an entry to the manifest file of applikation a which is > defining the receiving class. the problem here is a > ClassDefNotFoundException. Since the two activties are in different > applications, the class i defined in the manifest of application a, > but wich is located in application b can't be found at runtime. > > Any hints to avoid this? > > On 30 Apr., 22:06, TreKing wrote: > > On Fri, Apr 30, 2010 at 3:03 PM, sebastian23 > wrote: > > > So what can i do to solve this problem? Any help is really appreciated. > > > Thanks! > > > > I think is what BroadcastReceivers are for ... > > > > > - > > TreKing - Chicago transit tracking app for Android-powered deviceshttp:// > sites.google.com/site/rezmobileapps/treking > > > > -- > > 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 athttp:// > 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 > -- 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
Re: [android-developers] Change the playback rate of a track in real time
Hey, I just gone through with your code. You are not using public final void setRate (int streamID, float rate)Please take care streamID is different from soundID. streamID is the value returned by the play() function. - Anurag Singh On Sun, May 2, 2010 at 12:48 AM, Y Kim wrote: > Hello everybody, > > I would like to know if somebody knows a library to changing the > playback rate of a track in real time. My idea is to load a track and > change its playback rate to half or double. Firstly, I tried with > MusicPlayer but is was not possible at all and then I tried with > SoundPool. The problem is that with SoundPool I can´t change the rate > once the track is loaded. Here is the code I am using (proof of > concept): > >float j = 1; > >@Override >public void onCreate(Bundle savedInstanceState) { >super.onCreate(savedInstanceState); >setContentView(R.layout.main); > >Button b = (Button)findViewById(R.id.Button01); >b.setOnClickListener(new OnClickListener() { > >@Override >public void onClick(View v) { >j = (float) (j +.5); > >} >}); > >AssetFileDescriptor afd; >try { > >SoundPool sp = new SoundPool(1, AudioManager.STREAM_MUSIC, > 0); > >afd = getAssets().openFd("wav/sample.wav"); >int id = sp.load(afd, 1); >sp.play(id, 1, 1, 1, 0, j); > >} catch (IOException e) { >// TODO Auto-generated catch block >e.printStackTrace(); >} >} > > When I press the button, the playback rate should increase but it does > not happen. Any idea of how change the rate in real time? > > Thanks 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 > -- 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
Re: [android-developers] BroadcastReceiver, Intent objects
Yeah, there's no fucntion available in intent class. But you can putExtra putExtra<http://developer.android.com/reference/android/content/Intent.html#putExtra%28java.lang.String,%20long%29> (String <http://developer.android.com/reference/java/lang/String.html> name, long value) to recongnize any known scenario. On the other end use getExtra to get the same value. There are so many similar function described in intent class, you can try according to your need. - Anurag Singh On Sun, May 2, 2010 at 11:28 AM, Sean Sullivan wrote: > > I've implemented a BroadcastReceiver class to receive Intent objects. > > In my BroadcastReceiver class, I'd like to be able to identify the > source (sender) of the Intent object. Is there an API that enables me > to do this? > > I've already read through the javadocs and the Android platform source > code but didn't find an answer. > > Thank in advance. > > Sean > > -- > 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 -- 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
Re: [android-developers] Activity Not coming to foreground
intent.getAction() , This method is depricated now. So, please choose another option like onNewIntent() or brodcast. - Anurag Singh On Sun, May 2, 2010 at 6:52 PM, mike wrote: > hi guys, > > i'm getting the outgoing number using BroadCastReceiver and then > starts a Activity. > but my activity runs in the background??? how can i bring it to > foreground?? > >public void onReceive(Context context, Intent intent) { >// TODO Auto-generated method stub >this.context = context; >// this.inten = intent; >// String s = intent.getAction(); > >if (intent.getAction() > > .equalsIgnoreCase(Intent.ACTION_NEW_OUTGOING_CALL)) { >phonenbr = > intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); >intent = new Intent(context, OutGoing.class); >intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); >intent.putExtra("Number", phonenbr); >context.startActivity(intent); >} else { >telManager = (TelephonyManager) context > > .getSystemService(Context.TELEPHONY_SERVICE); >telManager.listen(new StateListener(), > > PhoneStateListener.LISTEN_CALL_STATE); >} >} > > > regards, > Rrandika > > -- > 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 -- 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
Re: [android-developers] Activity Not coming to foreground
This is typo mistake, I want to say that we can't use intent.getIntent(), This method is depricated now. So, please choose another option like onNewIntent() or sendbrodcast. On Mon, May 3, 2010 at 10:58 AM, Anurag Singh wrote: > intent.getAction() , This method is depricated now. So, please choose > another option like onNewIntent() or brodcast. > > - Anurag Singh > > > On Sun, May 2, 2010 at 6:52 PM, mike wrote: > >> hi guys, >> >> i'm getting the outgoing number using BroadCastReceiver and then >> starts a Activity. >> but my activity runs in the background??? how can i bring it to >> foreground?? >> >>public void onReceive(Context context, Intent intent) { >>// TODO Auto-generated method stub >>this.context = context; >>// this.inten = intent; >>// String s = intent.getAction(); >> >>if (intent.getAction() >> >> .equalsIgnoreCase(Intent.ACTION_NEW_OUTGOING_CALL)) { >>phonenbr = >> intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); >>intent = new Intent(context, OutGoing.class); >>intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); >>intent.putExtra("Number", phonenbr); >>context.startActivity(intent); >>} else { >>telManager = (TelephonyManager) context >> >> .getSystemService(Context.TELEPHONY_SERVICE); >>telManager.listen(new StateListener(), >> >> PhoneStateListener.LISTEN_CALL_STATE); >>} >>} >> >> >> regards, >> Rrandika >> >> -- >> 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 > > > -- 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
Re: [android-developers] How to access the internet in emulator?
set permission for internet in your manifest file. http://developer.android.com/reference/android/Manifest.permission.html#INTERNET> " /> - Anurag Singh On Sat, May 1, 2010 at 6:11 PM, bhuether wrote: > I juust installed the SDK and then added the 1.6 component. THen I > created an AVD. WHen I lauch the AVD (inidentally, there is a brief > error message saying could not load preferences) and try and login, it > says no network conenction. THe computer definitely has an internet > connection, otherwise I could not write this message.. Evberything I > have read suggests you don't have to do anything special to get > internet access in the emulator. My computer's internet connection is > via LAN, which conencts to a 3G router. I read something about using > 10.0.2.2 in the proxy settings, but when I specify that in ther SDK, > the SDK hangs upon launch as it tries to find the repositiry, or > whatever it does at startup. > > Any advice is appreciated! > > thanks, > > Brian > > -- > 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 -- 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
Re: [android-developers] Keep Camera App running continuously
there should be some option in setting like all other phones. - Anurag Singh On Mon, May 3, 2010 at 4:49 AM, Sundar wrote: > Hello Developers, > > I would like to run the Android Camera application from my development > board for about 2 hours continuously. > > I want to disable the phone lock screen that comes and shuts down the app. > > Can someone guide me how to do this? > > Thanks, > Jack > > -- > 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 -- 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
Re: [android-developers] TextView cuts off part of an initial capital "J"
Paste your xml file. - Anurag Singh On Mon, May 3, 2010 at 11:59 PM, bwin wrote: > I'm having a problem with TextView and would appreciate some help > finding out what I might be doing wrong. (Or if this is in fact an > Android problem, a workaround :-) > > If the first letter of text in a TextView is capital "J", the first > pixel or two are cut off so that the "J" starts looking a bit more > like an "I". If I set the gravity to, say, "center", the "J" looks > OK. Setting layout_marginLeft or paddingLeft to a non-zero value does > not help. > > If you would like to see this effect for yourself, the easiest way is > to create a default generic Android project and change the "hello" > text to something like "JJJ". > > Thanks for any help you may be able to give me. > Brian. > > PS: I just typed in "JJ" into the search widget of the generic Android > Browser and its got the same problem. OK, so maybe it's an Android > bug. Anyone have an idea for a workaround? I could stick a space in > the front of all initial "J"s, but that's, um..., a little > distasteful. > > > > -- > 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 -- 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
Re: [android-developers] problem in layout alignment
Use public LinearLayout.LayoutParams (int width, int height, float weight)For your reference http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html - Anurag Singh On Tue, May 4, 2010 at 4:17 PM, rajesh chandrasekaran < crajeshdanger...@gmail.com> wrote: > Hi all > > I am new in android, i am having few problem in layout alignment.I > have divide the screen into three layout,as header, body and footer. > > I am giving the height dynamically for the three layout in java file, > so i need to give 12% of height to header and footer layout, and the > remaining 75% i need to assign height to body layout. > > For that i have made the calculation as follow > > first i am getting the height and width for the screen. With the help > of the screen height i am getting the 12.5% height for header and > footer layout > > WindowManager w = getWindowManager(); > Display d = w.getDefaultDisplay(); > int totalwidth_screen = d.getWidth(); > int totalheight_screen = d.getHeight(); > > > int total_HF_screen = (int) ((12.5/100)*totalheight_screen); # height > for header and footer > int total_body_screen = totalheight_screen - (2*(total_HF_screen)) > #height for body > > By assigning the width and height for the layout using the above > calculations, iam not getting the footer layout properly.i.e only some > part of the footer is viewable. > > I need to assign the height for the layout dynamically, which is not > comming using the above calculation.Can you please suggest me the apt > way of calculation for dynamically assigning the height of the > layout. > > > > > Thanks > C.Rajesh > > -- > 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 -- 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
Re: [android-developers] How to know Battery Level in android.
Implement BrodcastReceiver for battery status. - Anurag Singh On Tue, May 4, 2010 at 2:49 PM, subrat kumar panda < evergreen.sub...@gmail.com> wrote: > Hi all, > i am having a problem with "Battery Level". > i am using sdk 1.5 in my app. > when the Battery Level reduced to 15%(i want to post the info to the > Soap server as an Alert). > > what i got info is if you are using 1.5 (>= ) > then use BatteryManager.EXTRA_LEVEL. > > but in my app, i am not getting it. > > if anybody knows the desired solution regarding the problem > please help me. > > Thanks in advance, > > Best Regards > Subrat Kumar Panda > India. > . > > -- > 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 -- 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
Re: [android-developers] Re: In process communication
I really not able to understand how service can communicate using handler. How service would know about our Handler? Should I pass Handler object to Service? - Anurag Singh On Wed, May 5, 2010 at 12:13 PM, FrankG wrote: > Hello T-Droid, > > maybe this it's so simple that noone wants to say it ? :-) > > I simply use a static call back reference in the service class > to inform the calling activity about any changes from the service. > > Works fine. But maybe you should better use a android.os.Handler. > In my case I use Handler more in the service themselve. > > Good luck ! > > Frank > > > > > On 4 Mai, 08:37, T-Droid wrote: > > Sorry, I was meaning I'm using the solution of Kumar Bibek. The static > > one. > > > > On May 4, 8:34 am, T-Droid wrote: > > > > > > > > > > > > > Hi, > > > > > I solved the problem as spachner mentioned. From my point of view it > > > was easy to understand. > > > > > About the second solution I still get not the whole idea. If I have a > > > connection between the service and the activity. How do they > > > communicate? Is there an interface between them? > > > > > @Dianne: Thanks to point out to the sample code. I think I got the > > > idea of binding them together. How do the service send an event to the > > > activity? > > > From the service is there a possibility to invoke the activity like > > > mMyActivity.changeState();. > > > > > Another point which I was recognizing you are talking about how a > > > activity knows the service. I'm talking how a service knows an > > > activity. Because in my design the service should trigger view > > > changes. The communication is unidirectional. > > > > > Thanks in advance > > > T-Droid > > > > > On Apr 4, 8:24 am, Dianne Hackborn wrote: > > > > > > Fyi this approach is illustrated in the LocalService sample code. > > > > > > On Sat, Apr 3, 2010 at 7:39 PM, JP > wrote: > > > > > Kumar's method might work, but you should look up > > > > > Context.bindService() and ServiceConnection.onServiceConnected() > > > > > to find out how to do this within Android's framework. > > > > > > > What I do: In MyApplication's > > > > >@Override public void onStart() > > > > > I call: > > > > > bindService(new Intent(MyApplication.this, MyService.class), > > > > >new (MyServiceConnection(this)), > > > > >BIND_AUTO_CREATE); > > > > > > > MyServiceConnection implements ServiceConnection, and as soon as > the > > > > > service is created or bound, you get a call to > > > > > MyServiceConnection.onServiceConnected(), which you implement like > > > > > this: > > > > > public void onServiceConnected(ComponentName name, IBinder service) > { > > > > >serv = ((MyService.LocalBinder)service).getService(); > > > > > } > > > > > With serv being an instance variable of MyApplication of type > > > > > MyService which you can use to call methods of your Service. Hope > this > > > > > helps. > > > > > > > On Mar 30, 1:26 am, T-Droid wrote: > > > > > > Hi @all, > > > > > > > > I have a design problem with my Android components. > > > > > > > > My activity is starting a service which is doing the work in the > > > > > > background. What I want is that the service informs the activity > about > > > > > > state changes. How can I do this? > > > > > > > > Normally I would add an observer but the activity has no > reference to > > > > > > the service. Then I was thinking to take AIDL but this is more > for > > > > > > inter-process communication. > > > > > > > > How is it possible that the service informs the activity about > state > > > > > > changes? Both are running in the same process. What can you > recommend? > > > > > > > > Thank you in advance. > > > > > > > > T-Droid > > > > > > > -- > > > > > 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 > > > >
Re: [android-developers] Tiff Codec
LibTiff is the right place. http://www.libtiff.org/ - Anurag Singh On Thu, Aug 12, 2010 at 2:37 PM, Reddy wrote: > Hi, > > I am not sure whether it is the right place to ask this question. > > Has any one implemented the codec for Tiff formated image? If any one > is having any idea please share the info where i can get the source > code for the same. > > Help is hightly appreciated. > > /Reddy > > -- > 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 -- 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] abort()-ing HttpGet requests in ThreadSafeClientConnManager
Hi, I have an http client based on multi-threaded model of apache http components in my App. And I want to achieve spontaneous cancellation of http get requests from my Android app. A new executor thread is started for each http request and the Thread and the HttpGet is saved in a thread safe queue. When abort is requested (on pressing back on the progress dialog and when starting a new activity) - another thread is started which goes through the queue of Threads and HttpGet and attempts to terminate them (code below). While the HttpGet gets aborted successfully, the Threads go into 'native' state. They only time out giving SocketTimeoutException after a default interval. The threads end up this way on most cancellations. Is this something to be expected or I am hitting a bug? The issue is that And as soon as 2 threads enter this state, all further executor threads go into wait. Only when either of the 2 blocked threads time out, other executors get a chance (this seems to be the default behavior of http). I have have tried many different thing but I am unable to budge the 'stuck' threads. I think the problem can be easily overcome by increasing the total no of threads and threads per host -- but I am not sure if this will be a correct thing to do (because the socket resources will stay occupied till timeout and there is nothing theoretically that can stop a user to do infinite cancellations)? Even if this is -- for Android, what should be the number? Now I am also doubting if my abort strategy is flawed. Can anyone please commentor let me know of a fool-proof abort strategy? - - - Run method of the abort thread is like: public void run() { while (!stopQueue.isEmpty()) { final List stopRequest = stopQueue.remove(); HttpGet abortRequest = (HttpGet) stopRequest.get(0); Thread abortThread = (Thread) stopRequest.get(1); // first abort the request if (abortRequest != null && !abortRequest.isAborted()) { abortRequest.abort(); Log.d("Aborting", abortRequest.getURI().toString()); } // if the thread is still stuck -- interrupt it if (abortThread != null && abortThread.isAlive()) { abortThread.interrupt(); Log.d("Interrupting", abortThread.getName()); } } } Thanks Anurag -- 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: abort()-ing HttpGet requests in ThreadSafeClientConnManager
Now I am not able to find a way to increase max no of connections per host in android... Anurag On Jul 9, 3:34 pm, Anurag Singh wrote: > Hi, > > I have an http client based on multi-threaded model of apache http > components in my App. And I want to achieve spontaneous cancellation > of http get requests from my Android app. > > A new executor thread is started for each http request and the Thread > and the HttpGet is saved in a thread safe queue. When abort is > requested (on pressing back on the progress dialog and when starting a > new activity) - another thread is started which goes through the queue > of Threads and HttpGet and attempts to terminate them (code below). > > While the HttpGet gets aborted successfully, the Threads go into > 'native' state. They only time out giving SocketTimeoutException after > a default interval. The threads end up this way on most cancellations. > Is this something to be expected or I am hitting a bug? > > The issue is that And as soon as 2 threads enter this state, all > further executor threads go into wait. Only when either of the 2 > blocked threads time out, other executors get a chance (this seems to > be the default behavior of http). I have have tried many different > thing but I am unable to budge the 'stuck' threads. > > I think the problem can be easily overcome by increasing the total no > of threads and threads per host -- but I am not sure if this will be a > correct thing to do (because the socket resources will stay occupied > till timeout and there is nothing theoretically that can stop a user > to do infinite cancellations)? Even if this is -- for Android, what > should be the number? > > Now I am also doubting if my abort strategy is flawed. Can anyone > please commentor let me know of a fool-proof abort strategy? > > - - - > > Run method of the abort thread is like: > public void run() { > while (!stopQueue.isEmpty()) { > final List stopRequest = > stopQueue.remove(); > HttpGet abortRequest = (HttpGet) > stopRequest.get(0); > Thread abortThread = (Thread) > stopRequest.get(1); > > // first abort the request > if (abortRequest != null && > !abortRequest.isAborted()) { > abortRequest.abort(); > Log.d("Aborting", > abortRequest.getURI().toString()); > } > > // if the thread is still stuck -- interrupt > it > if (abortThread != null && > abortThread.isAlive()) { > abortThread.interrupt(); > Log.d("Interrupting", > abortThread.getName()); > } > } > } > > Thanks > Anurag -- 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
Re: [android-developers] Playing a video in VideoView in Android
Please try it and let me know if you have any issue. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); VideoView videoView = (VideoView)findViewById(R.id.VideoView); videoView.setKeepScreenOn(true); videoView.setVideoPath("/sdcard/blonde_secretary.3gp"); videoView.start(); videoView.requestFocus(); } - Anurag Singh On Fri, Jul 16, 2010 at 5:54 PM, Maxood wrote: > I can't figure out why am i not able to play the video in my > VideoView. All i'm getting a message is Cannot Play Video : Sorry, > this video cannot be played. > > I created an SD card for my emulator as well. Do i need to place me SD > card in a particular folder in my SDK? Please comment. > > Here's the code: > > > > > > > >android:layout_height="fill_parent" xmlns:android="http:// > schemas.android.com/apk/res/android" > >android:paddingLeft="2px" android:paddingRight="2px" > >android:paddingTop="2px" android:paddingBottom="2px" > >android:layout_width="fill_parent" android:orientation="vertical"> > > > > >android:layout_width="fill_parent" android:id="@+id/ > VideoView"> > > > > > > > > package com.examples.videoviewdemo; > > import android.app.Activity; > import android.os.Bundle; > import android.widget.MediaController; > import android.widget.VideoView; > > public class VideoViewDemo extends Activity { >/** Called when the activity is first created. */ >@Override >public void onCreate(Bundle savedInstanceState) { >super.onCreate(savedInstanceState); >setContentView(R.layout.main); > >VideoView videoView = (VideoView)findViewById(R.id.VideoView); >//MediaController mediaController = new MediaController(this); > // mediaController.setAnchorView(videoView); > > >//videoView.setMediaController(mediaController); > >videoView.setVideoPath("/sdcard/blonde_secretary.3gp"); > > > >videoView.start(); > > > > >} > } > > > > These are the error messages displayed in my Log cat window: 07-16 > 17:16:30.237: ERROR/PlayerDriver(30): Command PLAYER_SET_DATA_SOURCE > completed with an error or info PVMFErrNotSupported 07-16 > 17:16:30.247: ERROR/MediaPlayer(240): error (1, -4) 07-16 > 17:16:30.257: ERROR/MediaPlayer(240): Error (1,-4) 07-16 17:16:30.267: > DEBUG/VideoView(240): Error: 1,-4 07-16 17:16:30.287: WARN/ > PlayerDriver(30): PVMFInfoErrorHandlingComplete > > -- > 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 -- 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