[android-beginners] Get file name from Uri
Hello, I am using content provider to access images in phone gallery and everything works fine except one thing that I want to get the physical file name of images I access. Can I get a java.io.File object from android.net.Uri object? if no, is there any other way to accomplish such a task? I just need to know the file name! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Hello MapView tutorial
Well I can't get this working. I've gone as far as step 6 of the tutorial, where it says You can actually run this now, but all it does is allow you to pan around the map. So my class is very simple: public class HelloMapView extends MapActivity { LinearLayout linearLayout; MapView mapView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) {; super.onCreate(savedInstanceState); setContentView(R.layout.main); } @Override protected boolean isRouteDisplayed() { return false; } } ...and the manifest is as already posted above. The error again is: 07-22 09:00:25.421: ERROR/AndroidRuntime(724): java.lang.IllegalAccessError: cross-loader access from pre-verified class 07-22 09:00:25.421: ERROR/AndroidRuntime(724): at dalvik.system.DexFile.defineClass(Native Method) 07-22 09:00:25.421: ERROR/AndroidRuntime(724): at dalvik.system.DexFile.loadClass(DexFile.java:193) 07-22 09:00:25.421: ERROR/AndroidRuntime(724): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:203) 07-22 09:00:25.421: ERROR/AndroidRuntime(724): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 07-22 09:00:25.421: ERROR/AndroidRuntime(724): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Query on PicSwitcher
Hi, I was wondering if in any way I can set a bitmap into an PicSwitcher? My initial finding suggest me that perhaps no such function such as SetImageBitmapResource( ) is available for PicSwitcher class? So does that mean I cannot set a Bitmap into a PicSwitcher? thanks regards, Arin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Query on PicSwitcher
Mistake, It is not picswitcher, it is ImageSwitcher... sorry for the confusion On Jul 22, 2:41 pm, arin arinv1618b...@gmail.com wrote: Hi, I was wondering if in any way I can set a bitmap into an PicSwitcher? My initial finding suggest me that perhaps no such function such as SetImageBitmapResource( ) is available for PicSwitcher class? So does that mean I cannot set a Bitmap into a PicSwitcher? thanks regards, Arin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Why so slow
And what does your application exactly? On Tue, Jul 21, 2009 at 7:15 PM, yves yves5...@googlemail.com wrote: Hi, Iam developing on Eclipse and I already set the Emulator Parameter to EDGE-Speed. The Problem is, the application runs fast on my Emulator but very slow on my device. Thanks Yves --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Get file name from Uri
Hi, The problem is that it should be documented in the Android Reference, here: http://developer.android.com/reference/android/provider/MediaStore.Images.html http://developer.android.com/reference/android/provider/MediaStore.Images.ImageColumns.html But, as far as i understand, it's not complete. Fortunately, we can check it in a different way. android code Uri u = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; //sdcard only Cursor c = managedQuery(u, null, null, null, null); if (c.moveToFirst()) { do { int max = c.getColumnCount(); for (int i = 0; i max; i++) { String colName = c.getColumnName(i); String value = c .getString(c.getColumnIndex(colName)); if (colName != null){ Log.d(columnName: , colName); } if (value != null) { Log.d(value, value); } } } while (c.moveToNext()); } /android code Check LogCat and you'll notice that we have all column names with their values. I suppose, you'd be interested in: 07-22 12:50:09.973: DEBUG/columnName:(3049): _data 07-22 12:50:09.973: DEBUG/value(3049): /sdcard/download/vienna-s- schonbrunn-zoo-and-giant-ferris-wheel-in-vienna-1.jpg (...) 07-22 12:50:09.983: DEBUG/columnName:(3049): _display_name 07-22 12:50:09.983: DEBUG/value(3049): vienna-s-schonbrunn-zoo-and- giant-ferris-wheel-in-vienna-1.jpg If you have got any questions, don't hesitate to ask. Greetings! On Jul 22, 10:28 am, Mina Shokry minasho...@gmail.com wrote: Hello, I am using content provider to access images in phone gallery and everything works fine except one thing that I want to get the physical file name of images I access. Can I get a java.io.File object from android.net.Uri object? if no, is there any other way to accomplish such a task? I just need to know the file name! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] a question about final variable and multiple constructors
Hi I ran into a compiler error saying The blank final field x may not have been initialized while I was extending ViewGroup to make another UI thing by modifying SlidingDrawer. The fact is I'd already assigned some value to my final variable in the 3rd constructor from ViewGroup, and I left the 1st and 2nd constructors nothing but the auto-genned super()s. But for some reason this error only showed up at the 1st constructor. And if I commented out the first constructor, the error will just disappear instead of complaining about my empty 2nd constructor. I'm new to Java and Eclipse, so not sure if this is a Java or Android thing, hope somebody stump upon here happens to have some clue :) BTW my code: private final mHandleId; private final mContentId; public DeckView(Context context) { super(context); // TODO Auto-generated constructor stub } public DeckView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public DeckView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes (attrs,R.styleable.DeckView,defStyle,0); int orientation = a.getInt (R.styleable.SlidingDrawer_orientation, ORIENTATION_HORIZONTAL); mVertical = orientation == ORIENTATION_HORIZONTAL; mBottomOffset=(int)a.getDimension (R.styleable.SlidingDrawer_bottomOffset, 0.0f); mTopOffset=(int)a.getDimension (R.styleable.SlidingDrawer_topOffset,0.0f); mAllowSingleTap=a.getBoolean (R.styleable.SlidingDrawer_allowSingleTap, true); int handleID = a.getResourceId (R.styleable.SlidingDrawer_handle, 0); if(handleID == 0) { throw new IllegalArgumentException(The handle attribute is required and must refer to a valid child); } int contentID = a.getResourceId (R.styleable.SlidingDrawer_content, 0); if(contentID == 0) { throw new IllegalArgumentException(The content attribute is requried and must refer to a valid child); } mHandleId = handleID; mContentId = contentID; a.recycle(); setAlwaysDrawnWithCacheEnabled(false); } THANKS! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: [android-beginners]
Read the google docs on the android sdk site. Android Apps Developer On Jul 22, 2009 6:58 AM, saurabh sinha saurso...@gmail.com wrote: what is difference between intent and intent-filter in android --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: a question about final variable and multiple constructors
Hi First of all, your code is a mess, and you shouldn't attach such snippets. Please be more careful, and make sure it'd be easy to read and compile. If it's not possible to compile then at least eliminate the most basic errors (e.g. mHandleId has no type, there is no class declaration etc.). Then, there is no x field in your code ;) Now, to the point. You can declare blank (without value) finals, but then all constructors MUST initialize it. This is a Java rule. So, either initialize it in all constructors, or remove the first two of them [constructors] if not needed. On Jul 22, 3:06 pm, nikki nikki_...@pegatroncorp.com wrote: Hi I ran into a compiler error saying The blank final field x may not have been initialized while I was extending ViewGroup to make another UI thing by modifying SlidingDrawer. The fact is I'd already assigned some value to my final variable in the 3rd constructor from ViewGroup, and I left the 1st and 2nd constructors nothing but the auto-genned super()s. But for some reason this error only showed up at the 1st constructor. And if I commented out the first constructor, the error will just disappear instead of complaining about my empty 2nd constructor. I'm new to Java and Eclipse, so not sure if this is a Java or Android thing, hope somebody stump upon here happens to have some clue :) BTW my code: private final mHandleId; private final mContentId; public DeckView(Context context) { super(context); // TODO Auto-generated constructor stub } public DeckView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public DeckView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes (attrs,R.styleable.DeckView,defStyle,0); int orientation = a.getInt (R.styleable.SlidingDrawer_orientation, ORIENTATION_HORIZONTAL); mVertical = orientation == ORIENTATION_HORIZONTAL; mBottomOffset=(int)a.getDimension (R.styleable.SlidingDrawer_bottomOffset, 0.0f); mTopOffset=(int)a.getDimension (R.styleable.SlidingDrawer_topOffset,0.0f); mAllowSingleTap=a.getBoolean (R.styleable.SlidingDrawer_allowSingleTap, true); int handleID = a.getResourceId (R.styleable.SlidingDrawer_handle, 0); if(handleID == 0) { throw new IllegalArgumentException(The handle attribute is required and must refer to a valid child); } int contentID = a.getResourceId (R.styleable.SlidingDrawer_content, 0); if(contentID == 0) { throw new IllegalArgumentException(The content attribute is requried and must refer to a valid child); } mHandleId = handleID; mContentId = contentID; a.recycle(); setAlwaysDrawnWithCacheEnabled(false); } THANKS! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Mulittouch in android?
Hi, Is the multitouch now enabled in android? - I've seen a hero with multitouch and zoom gesture..is it enabled in the new devices? 10x --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] How to Make my device sleep
PowerManager.goToSleep(long time) method seems to not work. Because I don't get a PowerManager instance. Instead, I use IPowerManager interface: IPowerManager.stub.asInterface(ServiceManager.getService (power)).goTosleep(1000); Why this code doesnt work? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] What is the package name and the Create Activity in wizard of new project (eclipse)
Hi, im really newbie to java. I know some php and c# and want to start to program for android phones. I get stuck in the very first steps. I already have an eclipse ide with the sdk and the android plugin, but when i try to made a new project it ask me for two things that i have no idea what means. Package name (force) Create Activity (optional) Searching by internet i found that is the same that in java, but i dont know a lot of java, so... ¿any help? By the way, if you know any online tutorial for dummys to get starting to java oriented to android, it would be nice. Thanks for your time and sorry for my english, im spanish :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: [android-beginners]
Perhaps it was done by mistake. We shouldn't assume. On Tue, Jul 21, 2009 at 4:18 PM, Oliver Rennfort anubis...@gmail.comwrote: Asking a question once is ok. Repeating them will not give you a faster answer. It just spamms our in box with it. Thank you. Android Apps Developer On Jul 21, 2009 4:16 PM, saurabh sinha saurso...@gmail.com wrote: what is pending Intent and how it differ from Intent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] a problem with connection Http
Hello every body, and excuse me for my poor English . I'm trying de build an activity which connect to a servlet. But the command execute (httpGet) doesn't work!! i write the permission of internet in the manifest.xml, but it doesn't work!! heres my code its supposed to connect to the servlet: and thank you import java.io.InputStream; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.BasicResponseHandler; import org.apache.http.impl.client.DefaultHttpClient; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.EditText; public class Connect extends Activity { /** Called when the activity is first created. */ private String adresse = new String( http://localhost:8080/Test_tomcat/Testt;); private EditText mTitleText; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mTitleText = (EditText) findViewById(R.id.message); connect(adresse); } public void connect(String url){ try { HttpClient httpclient = new DefaultHttpClient(); // Prepare a request object HttpGet httpget = new HttpGet(url); // Execute the request HttpResponse response; try { response = httpclient.execute(httpget); mTitleText.append(connexion); // Get hold of the response entity HttpEntity entity = response.getEntity(); // If the response does not enclose an entity, there is no need // to worry about connection release if (entity != null) { mTitleText.append(response.getStatusLine().toString()); } }catch (Exception e) {mTitleText.append(connexion); } httpclient.getConnectionManager().shutdown(); } catch (Exception e) { Log.e(Connect, exception au niveau de l'adresse); } } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] hi
Hi i want to know the information regarding the deployment of the user application(i.e my own application) on to the nokia internet tablet(N810) and on which i loaded with the Android OS (on N810) please guide me...i hope anyone will help me in this regard...reply me as early as possible... -- Regards, prasadNSRS +91 9393858787 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Switching layouts
Hello there! I'm a newbie in Android programming, and was exploring the possibility to switch between more than - one - layouts (i.e. more pages?). So I've created a new XML layout page (called second.xml) and created some things in there. At least I've created a button to switch back to the first layout, but a NullPointerException fires up when the application starts, and that only for the back button, while the next button just works great. Any suggestion? Thanks :) package com.elegos.test; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class ListViewTest extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView myText = (TextView)findViewById(R.id.myTextView); Button nextButton = (Button)findViewById(R.id.ButtonNext); Button backButton = (Button)findViewById(R.id.ButtonBack); nextButton.setOnClickListener(getCListener(R.layout.second)); try {backButton.setOnClickListener(getCListener (R.layout.main));} catch(Exception e) {myText.append(\n+e.toString ());} } final private OnClickListener getCListener(final int layout) { return new Button.OnClickListener() { public void onClick(View v) { setContentView(layout); } }; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: How to pass User created object between two Activity in same Application?
Thanks guys! These two examples are exactly what I was looking for! :-) AudioDroid On Jul 15, 10:57 am, MrChaz mrchazmob...@googlemail.com wrote: If your class implements Parcelable then you can use add it to the intent that you're calling via putExtra() e.g. ClassA bar = new ClassA(0, foo); Intent i = new Intent(this, Activity.class); i.putExtra(MyClass, bar); An example of implementing Parcelable is below, Serializable also seems to require a serialVersionUID variable but eclipse can generate that for you. public class ClassA implements Parcelable, Serializable{ private int _id; private String _name; public ClassA(int id, String name){ _id = id; _name = name; } public static final Parcelable.CreatorClassA CREATOR = new Parcelable.CreatorClassA() { public ClassA createFromParcel(Parcel in) { int id = in.readInt(); String name = in.readString(); return new ClassA(id, name); } public ClassA [] newArray(int size) { return new ClassA [size]; } }; public int describeContents() { // TODO Auto-generated method stub return 0; } public void writeToParcel(Parcel arg0, int arg1) { arg0.writeInt(_id); arg0.writeString(_name); }} On Jul 15, 2:22 am, Mapara,Harshit Nitinkumar hnmap...@gmail.com wrote: Hi All, Let say I have one class : Class A { int id; String name; public A(int id, String name) { this.id = id; this.name = name;} } How do I pass object of A between two Activity classes in a same application ? I came across the Parcelable interface, but I couldn't find good example. Thanks Harshit --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] The FTP uploading program does not work on Android Emulator
Dear Sir: I developed a FTP uploading program which upload the string to a text file through FTP. This program only works well as an Java application on PC, but when I put the same code to Android application on Emulator, Android always begins to grow heap and allocate memory when the code calls the functionURLConnection.getOutputStream(), and finally Android is Out of memory. I have suffered from this problem for a week. If you could help me, I really appreciate! Below is the code and debug trace got by adb logcat. (I replace the host, user, password and targetfile with some common strings.) String host = hostname; String user = username; String password = password; String targetfile = filename; try{ URL url= new URL(ftp://+ user+ :+ password+ @+ host+ /+ targetfile + ;type=i); URLConnection urlc = url.openConnection(); Log.d(DEBUG, openconnection done); OutputStream os = urlc.getOutputStream();// problem happens from this line Log.d(DEBUG,get OutputStream); String packet_str = Uploading; byte[] buf = packet_str.getBytes(); os.write(buf); Log.d(DEBUG,write done); os.close(); urlc= null; }catch (Exception E) { Log.d(DEBUG,Erro Happen! + E.getMessage ()); E.printStackTrace(); } Below is the trace: D/DEBUG ( 719): openconnection done D/InetAddress( 719): xzzb.hostrator.com: 64.191.109.6 (family 2, proto 6) D/dalvikvm( 637): GC freed 2854 objects / 162328 bytes in 177ms D/dalvikvm( 719): GC freed 14245 objects / 422552 bytes in 84ms D/dalvikvm( 719): GC freed 19713 objects / 529824 bytes in 75ms D/dalvikvm( 719): GC freed 17813 objects / 501656 bytes in 78ms D/dalvikvm( 719): GC freed 23615 objects / 567184 bytes in 82ms . D/dalvikvm( 719): GC freed 74935 objects / 1798504 bytes in 162ms D/dalvikvm( 719): GC freed 74935 objects / 1798504 bytes in 155ms D/dalvikvm( 719): GC freed 43212 objects / 1037152 bytes in 118ms I/dalvikvm-heap( 719): Forcing collection of SoftReferences for 9437196-byte allocation D/dalvikvm( 719): GC freed 0 objects / 0 bytes in 62ms E/dalvikvm-heap( 719): Out of memory on a 9437196-byte allocation. I/dalvikvm( 719): main prio=5 tid=3 RUNNABLE I/dalvikvm( 719): | group=main sCount=0 dsCount=0 s=0 obj=0x40018e70 I/dalvikvm( 719): | sysTid=719 nice=0 sched=0/0 handle=-1097544548 I/dalvikvm( 719): at java.lang.AbstractStringBuilder.enlargeBuffer (AbstractStringBuilder.java:~99) I/dalvikvm( 719): at java.lang.AbstractStringBuilder.append0 (AbstractStringBuilder.java:153) I/dalvikvm( 719): at java.lang.StringBuffer.append (StringBuffer.java:128) I/dalvikvm( 719): at org.apache.harmony.luni.internal.net.www.protocol.ftp.FtpURLConnection.readLine (FtpURLConnection.java:403) I/dalvikvm( 719): at org.apache.harmony.luni.internal.net.www.protocol.ftp.FtpURLConnection.getReply (FtpURLConnection.java:355) I/dalvikvm( 719): at org.apache.harmony.luni.internal.net.www.protocol.ftp.FtpURLConnection.port (FtpURLConnection.java:391) I/dalvikvm( 719): at org.apache.harmony.luni.internal.net.www.protocol.ftp.FtpURLConnection.connectInternal (FtpURLConnection.java:232) I/dalvikvm( 719): at org.apache.harmony.luni.internal.net.www.protocol.ftp.FtpURLConnection.connect (FtpURLConnection.java:189) I/dalvikvm( 719): at org.apache.harmony.luni.internal.net.www.protocol.ftp.FtpURLConnection.getOutputStream (FtpURLConnection.java:342) I/dalvikvm( 719): at com.example.sendonce.sendonce$1.onClick (sendonce.java:118) I/dalvikvm( 719): at android.view.View.performClick(View.java:2179) I/dalvikvm( 719): at android.view.View.onTouchEvent(View.java:3828) I/dalvikvm( 719): at android.widget.TextView.onTouchEvent (TextView.java:6291) I/dalvikvm( 719): at android.view.View.dispatchTouchEvent (View.java: 3368) I/dalvikvm( 719): at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:863) I/dalvikvm( 719): at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:863) I/dalvikvm( 719): at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:863) I/dalvikvm( 719): at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:863) I/dalvikvm( 719): at com.android.internal.policy.impl.PhoneWindow $DecorView.superDispatchTouchEvent(PhoneWindow.java:1707) I/dalvikvm( 719): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1197) I/dalvikvm( 719): at android.app.Activity.dispatchTouchEvent (Activity.java:1993) I/dalvikvm( 719): at com.android.internal.policy.impl.PhoneWindow $DecorView.dispatchTouchEvent(PhoneWindow.java:1691) I/dalvikvm( 719): at
[android-beginners] Re: a problem with connection Http
My guess is you are using the emulator here. To the emulator, localhost will refer to the emulator itself. It is its own virtual device, you may consider it its own entity on the network, so you'll need to use a proper hostname or IP address for the servlet you want to access. Cheers, Justin Android Team @ Google On Jul 22, 6:47 am, Ahmed BEJAOUI ahmed.bejaoui...@gmail.com wrote: Hello every body, and excuse me for my poor English . I'm trying de build an activity which connect to a servlet. But the command execute (httpGet) doesn't work!! i write the permission of internet in the manifest.xml, but it doesn't work!! heres my code its supposed to connect to the servlet: and thank you import java.io.InputStream; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.BasicResponseHandler; import org.apache.http.impl.client.DefaultHttpClient; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.EditText; public class Connect extends Activity { /** Called when the activity is first created. */ private String adresse = new String(http://localhost:8080/Test_tomcat/Testt;); private EditText mTitleText; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mTitleText = (EditText) findViewById(R.id.message); connect(adresse); } public void connect(String url){ try { HttpClient httpclient = new DefaultHttpClient(); // Prepare a request object HttpGet httpget = new HttpGet(url); // Execute the request HttpResponse response; try { response = httpclient.execute(httpget); mTitleText.append(connexion); // Get hold of the response entity HttpEntity entity = response.getEntity(); // If the response does not enclose an entity, there is no need // to worry about connection release if (entity != null) { mTitleText.append(response.getStatusLine().toString()); } }catch (Exception e) {mTitleText.append(connexion); } httpclient.getConnectionManager().shutdown(); } catch (Exception e) { Log.e(Connect, exception au niveau de l'adresse); } } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: a question about final variable and multiple constructors
Hi Kacper86, Thanks for your suggestion, I will make sure I provide more completed code next time. And I actually figured out the problem. The reason is because the auto-generated constructor (the one takes in only one Context object) calls super() in its body, which seems to the compiler that it will not initialize the final variable by any chances. The second constructor (the one takes in 2 parameters) calls this() with 3 parameters, which leads the compiler to the third constructor where the final variables are actually assigned some value. On Jul 22, 10:09 pm, Kacper86 cpph...@gmail.com wrote: Hi First of all, your code is a mess, and you shouldn't attach such snippets. Please be more careful, and make sure it'd be easy to read and compile. If it's not possible to compile then at least eliminate the most basic errors (e.g. mHandleId has no type, there is no class declaration etc.). Then, there is no x field in your code ;) Now, to the point. You can declare blank (without value) finals, but then all constructors MUST initialize it. This is a Java rule. So, either initialize it in all constructors, or remove the first two of them [constructors] if not needed. On Jul 22, 3:06 pm, nikki nikki_...@pegatroncorp.com wrote: Hi I ran into a compiler error saying The blank final field x may not have been initialized while I was extending ViewGroup to make another UI thing by modifying SlidingDrawer. The fact is I'd already assigned some value to my final variable in the 3rd constructor from ViewGroup, and I left the 1st and 2nd constructors nothing but the auto-genned super()s. But for some reason this error only showed up at the 1st constructor. And if I commented out the first constructor, the error will just disappear instead of complaining about my empty 2nd constructor. I'm new to Java and Eclipse, so not sure if this is a Java or Android thing, hope somebody stump upon here happens to have some clue :) BTW my code: private final mHandleId; private final mContentId; public DeckView(Context context) { super(context); // TODO Auto-generated constructor stub } public DeckView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public DeckView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes (attrs,R.styleable.DeckView,defStyle,0); int orientation = a.getInt (R.styleable.SlidingDrawer_orientation, ORIENTATION_HORIZONTAL); mVertical = orientation == ORIENTATION_HORIZONTAL; mBottomOffset=(int)a.getDimension (R.styleable.SlidingDrawer_bottomOffset, 0.0f); mTopOffset=(int)a.getDimension (R.styleable.SlidingDrawer_topOffset,0.0f); mAllowSingleTap=a.getBoolean (R.styleable.SlidingDrawer_allowSingleTap, true); int handleID = a.getResourceId (R.styleable.SlidingDrawer_handle, 0); if(handleID == 0) { throw new IllegalArgumentException(The handle attribute is required and must refer to a valid child); } int contentID = a.getResourceId (R.styleable.SlidingDrawer_content, 0); if(contentID == 0) { throw new IllegalArgumentException(The content attribute is requried and must refer to a valid child); } mHandleId = handleID; mContentId = contentID; a.recycle(); setAlwaysDrawnWithCacheEnabled(false); } THANKS! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: What is the package name and the Create Activity in wizard of new project (eclipse)
Please take a look at the HelloWorld tutorial: http://developer.android.com/guide/tutorials/hello-world.html -- Jack Ha Open Source Development Center ・T・ ・ ・Mobile・ stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 22, 4:57 am, Carlos Maldonado carlosmaldonadogo...@gmail.com wrote: Hi, im really newbie to java. I know some php and c# and want to start to program for android phones. I get stuck in the very first steps. I already have an eclipse ide with the sdk and the android plugin, but when i try to made a new project it ask me for two things that i have no idea what means. Package name (force) Create Activity (optional) Searching by internet i found that is the same that in java, but i dont know a lot of java, so... ¿any help? By the way, if you know any online tutorial for dummys to get starting to java oriented to android, it would be nice. Thanks for your time and sorry for my english, im spanish :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Mulittouch in android?
Short answer is that the device driver supports it but the functionality is not exposed in the Java API. The hero most likely uses a hack see: http://groups.google.com/group/android-platform/browse_thread/thread/209b512a9fdf7367?pli=1 for the gruesome details. Dave On Wed, Jul 22, 2009 at 7:41 AM, Androiddeveloper4andr...@gmail.com wrote: Hi, Is the multitouch now enabled in android? - I've seen a hero with multitouch and zoom gesture..is it enabled in the new devices? 10x --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Slow to load emulator with eclipse
Yes you only need to take the hit on startup once. After that it's almost instantaneous to execute a new app. I'm in the same boat with an IBM T43... but the 2nd or subsequent runs are really no problem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: hi
adb push http://developer.android.com/guide/developing/tools/adb.html#move Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 22, 4:02 am, prasad NSRS prasad.9...@gmail.com wrote: Hi i want to know the information regarding the deployment of the user application(i.e my own application) on to the nokia internet tablet(N810) and on which i loaded with the Android OS (on N810) please guide me...i hope anyone will help me in this regard...reply me as early as possible... -- Regards, prasadNSRS +91 9393858787 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Get file name from Uri
thank you for this great help but unfortunately this isn't my case. not me who created the cursor and iterate through it. I am just receiving the Uri from another activity via an intent. and it isn't good to iterate through all images to find one its Uri matches one I received especially that I am not sure it will always be a Uri of an image. still can I get the file name? On Jul 22, 4:04 pm, Kacper86 cpph...@gmail.com wrote: Hi, The problem is that it should be documented in the Android Reference, here: http://developer.android.com/reference/android/provider/MediaStore.Im...http://developer.android.com/reference/android/provider/MediaStore.Im... But, as far as i understand, it's not complete. Fortunately, we can check it in a different way. android code Uri u = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; //sdcard only Cursor c = managedQuery(u, null, null, null, null); if (c.moveToFirst()) { do { int max = c.getColumnCount(); for (int i = 0; i max; i++) { String colName = c.getColumnName(i); String value = c .getString(c.getColumnIndex(colName)); if (colName != null){ Log.d(columnName: , colName); } if (value != null) { Log.d(value, value); } } } while (c.moveToNext()); } /android code Check LogCat and you'll notice that we have all column names with their values. I suppose, you'd be interested in: 07-22 12:50:09.973: DEBUG/columnName:(3049): _data 07-22 12:50:09.973: DEBUG/value(3049): /sdcard/download/vienna-s- schonbrunn-zoo-and-giant-ferris-wheel-in-vienna-1.jpg (...) 07-22 12:50:09.983: DEBUG/columnName:(3049): _display_name 07-22 12:50:09.983: DEBUG/value(3049): vienna-s-schonbrunn-zoo-and- giant-ferris-wheel-in-vienna-1.jpg If you have got any questions, don't hesitate to ask. Greetings! On Jul 22, 10:28 am, Mina Shokry minasho...@gmail.com wrote: Hello, I am using content provider to access images in phone gallery and everything works fine except one thing that I want to get the physical file name of images I access. Can I get a java.io.File object from android.net.Uri object? if no, is there any other way to accomplish such a task? I just need to know the file name! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Basic java threading problems, code inside
Try to remove synchronized from stopThread() and startThread() this worked, thanks! On Jul 20, 7:52 pm, vladimir kroz vladimir.k...@gmail.com wrote: Try to remove synchronized from stopThread() and startThread() On Jul 17, 6:29 pm, Kevin Grant kevingra...@gmail.com wrote: I understand the concept of threads, and it almost seems like I understand how to implement them. This code executes properly until I press the back button (to close), and then gives a This application has stopped unexpectedly. Please try again. Well duh, I closed it! Heres the code Im using: (It is a slightly modified version of the example provided here:http://www.helloandroid.com/node/243 using the modifications I found here:http://stackoverflow.com/questions/680180/where-to-stop-destroy-threa... ) The import Pi class comes from this website, its just an arbitrary class that will perform a long calculation to show the example http://blog.taragana.com/index.php/archive/calculate-pi-to-arbitrary-... /*/ package com.example; import com.example.Pi; import android.app.Activity; import android.app.ProgressDialog; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class AndroidThreads extends Activity implements Runnable { private String pi_string; private TextView tv; private ProgressDialog pd; private volatile Thread runner; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); mp = MediaPlayer.create(getBaseContext(), R.raw.camera_click); //this is using the slow.mp3 resource tv = (TextView) this.findViewById(R.id.box); tv.setText(Press submit to start calculation); Button submit = (Button) findViewById(R.id.submit_btn); submit.setOnClickListener(new OnClickListener(){ public void onClick(View v){ startThread(); } }); } public synchronized void startThread(){ if(runner == null){ pd = ProgressDialog.show(this, Working.., Calculating Pi, true, false); runner = new Thread(this); runner.start(); } } public synchronized void stopThread(){ if(runner != null){ Thread moribund = runner; runner = null; moribund.interrupt(); } } public void run(){ pi_string = Pi.computePi(800).toString(); handler.sendEmptyMessage(0); } private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { pd.dismiss(); tv.setText(pi_string); } };} /*/ So like I said, this does everything I want it to do, except... it gives the crash error when I exit the program. *So what I need to know is why is it crashing, and how can I fix it?* It seems to me like the threads aren't all finishing properly, so I tried putting the stopThread() function into the onStop() and onDestroy () overrides, but that didn't seem to make a difference. Appreciate any input! -kevin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] how to program on application(not activity) exit ?
Hi all, I have requirement that needs to save data to a file. During multiple Activitiy screens, I add different data to a list and finally when user is not using the app (means if user exits app by pressing home button or call button), just before exiting that app, i want to save that data of the list to a file. coding before exiting activity screen is simple - by calling onDestory () method, but here I want not one activity but the application exit. So my question is How do I write a code that will be executed just before application exits ? I tried created one class extends Application, and then I override onTerminate() method, but it's not get called when I exit ( pressing home button on device) Plz help Thanks Harshit --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Get file name from Uri
Hi, Firstly, I'd like to recommend this article: http://developer.android.com/guide/topics/providers/content-providers.html Secondly, let's solve your problem (which you can solve on your own after reading the article). The Uri is not supposed to carry a large amount of data. You don't cast it to huge objects and directly query it for the information. Think of it as an address. When you have an address and a mean of transport you can get there and find whatever you're looking for. To the point, if you have an Uri, you can use Cursor and make a proper query, which can look like this: android code Uri u = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; Uri u2 = Uri.withAppendedPath(u, 1); // this is what you have // u2 == content://media/external/images/media/1 String[] projection = { MediaStore.Images.ImageColumns.DATA, / *col1*/ MediaStore.Images.ImageColumns.DISPLAY_NAME /*col2*/}; Cursor c = managedQuery(u2, projection, null, null, null); if (c!=null c.moveToFirst()) { String column0Value = c.getString(0); String column1Value = c.getString(1); Log.d(Data,column0Value); Log.d(Display name,column1Value); } /android code Obviously, you can reduce number of columns to the one you need the most. The less number of columns we have to return, the more efficient it will get. On Jul 22, 8:41 pm, Mina Shokry minasho...@gmail.com wrote: thank you for this great help but unfortunately this isn't my case. not me who created the cursor and iterate through it. I am just receiving the Uri from another activity via an intent. and it isn't good to iterate through all images to find one its Uri matches one I received especially that I am not sure it will always be a Uri of an image. still can I get the file name? On Jul 22, 4:04 pm, Kacper86 cpph...@gmail.com wrote: Hi, The problem is that it should be documented in the Android Reference, here: http://developer.android.com/reference/android/provider/MediaStore.Im.. But, as far as i understand, it's not complete. Fortunately, we can check it in a different way. android code Uri u = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; //sdcard only Cursor c = managedQuery(u, null, null, null, null); if (c.moveToFirst()) { do { int max = c.getColumnCount(); for (int i = 0; i max; i++) { String colName = c.getColumnName(i); String value = c .getString(c.getColumnIndex(colName)); if (colName != null){ Log.d(columnName: , colName); } if (value != null) { Log.d(value, value); } } } while (c.moveToNext()); } /android code Check LogCat and you'll notice that we have all column names with their values. I suppose, you'd be interested in: 07-22 12:50:09.973: DEBUG/columnName:(3049): _data 07-22 12:50:09.973: DEBUG/value(3049): /sdcard/download/vienna-s- schonbrunn-zoo-and-giant-ferris-wheel-in-vienna-1.jpg (...) 07-22 12:50:09.983: DEBUG/columnName:(3049): _display_name 07-22 12:50:09.983: DEBUG/value(3049): vienna-s-schonbrunn-zoo-and- giant-ferris-wheel-in-vienna-1.jpg If you have got any questions, don't hesitate to ask. Greetings! On Jul 22, 10:28 am, Mina Shokry minasho...@gmail.com wrote: Hello, I am using content provider to access images in phone gallery and everything works fine except one thing that I want to get the physical file name of images I access. Can I get a java.io.File object from android.net.Uri object? if no, is there any other way to accomplish such a task? I just need to know the file name! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Hello MapView tutorial
Hi again, in another net my issue is solved. Maybe proxy... Thanks Yusuf 2009/7/22 Neilz neilhorn...@googlemail.com Well I can't get this working. I've gone as far as step 6 of the tutorial, where it says You can actually run this now, but all it does is allow you to pan around the map. So my class is very simple: public class HelloMapView extends MapActivity { LinearLayout linearLayout; MapView mapView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) {; super.onCreate(savedInstanceState); setContentView(R.layout.main); } @Override protected boolean isRouteDisplayed() { return false; } } ...and the manifest is as already posted above. The error again is: 07-22 09:00:25.421: ERROR/AndroidRuntime(724): java.lang.IllegalAccessError: cross-loader access from pre-verified class 07-22 09:00:25.421: ERROR/AndroidRuntime(724): at dalvik.system.DexFile.defineClass(Native Method) 07-22 09:00:25.421: ERROR/AndroidRuntime(724): at dalvik.system.DexFile.loadClass(DexFile.java:193) 07-22 09:00:25.421: ERROR/AndroidRuntime(724): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:203) 07-22 09:00:25.421: ERROR/AndroidRuntime(724): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 07-22 09:00:25.421: ERROR/AndroidRuntime(724): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: how to program on application(not activity) exit ?
It seems to me that you may be able to do what you intend to do by using SharedPreferences http://developer.android.com/reference/android/content/SharedPreferences.html The only thing to note is that this class is not supported across multiple processes. The other advantage with using SharedPreferences is that the data will be saved not only on exit, but also if the app is paused. Hope this helps, Balwinder Kaur Open Source Development Center ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc On Jul 22, 12:29 pm, Mapara,Harshit Nitinkumar hnmap...@gmail.com wrote: Hi all, I have requirement that needs to save data to a file. During multiple Activitiy screens, I add different data to a list and finally when user is not using the app (means if user exits app by pressing home button or call button), just before exiting that app, i want to save that data of the list to a file. coding before exiting activity screen is simple - by calling onDestory () method, but here I want not one activity but the application exit. So my question is How do I write a code that will be executed just before application exits ? I tried created one class extends Application, and then I override onTerminate() method, but it's not get called when I exit ( pressing home button on device) Plz help Thanks Harshit --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Loading an image from remote server
Please refer to the post http://groups.google.com/group/android-beginners/browse_thread/thread/a47cc5d8aa243879/4656cf7af994d182?lnk=gstq=base64#4656cf7af994d182 Balwinder Kaur Open Source Development Center ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 21, 9:27 pm, santu santu.gu...@gmail.com wrote: Hi, Thnx. This is working fine. But how to display base 64 images in Android. waiting for u r replies. Thanks, Santhosh On Jul 21, 10:00 pm, Balwinder Kaur (T-Mobile) balwinder.k...@t- mobile.com wrote: Do you have the uses-permission android:name=android.permission.INTERNET/uses-permission declared in your AndroidManifest.xml file ? I can see an ImageView in my Emulator with your snapshot of the Emulator that you have up on your website :) Balwinder Kaur Open Source Development Center ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 20, 3:32 am, santu santu.gu...@gmail.com wrote: Hi , I have an issue when loading an image from remote location. For this I am using UrlConnection to connect and getting the InputStream . my code snippet is as follows: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ImageView i = new ImageView(this); i.setImageBitmap(getView(http://www.precentral.net/sites/ androidcentral.com/files/wp-migrate/2008/09/android-sdk.jpg)); setContentView(i); } public Bitmap getView(String myImageURL) { Bitmap bm = null; try { URL aURL = new URL(myImageURL); URLConnection conn = aURL.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is ); bm = BitmapFactory.decodeStream(bis); is.close(); bis.close(); } catch (IOException e) { Log.e(DEBUGTAG, Remtoe Image Exception, e); } return bm; } I don't know whats wrong with my code. But the image is not displayed. Nor the Exception. Can any one suggest me whats the problem. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Get file name from Uri
Thank you very much. this is exactly what I want. thanks again. On Jul 22, 11:38 pm, Kacper86 cpph...@gmail.com wrote: Hi, Firstly, I'd like to recommend this article: http://developer.android.com/guide/topics/providers/content-providers... Secondly, let's solve your problem (which you can solve on your own after reading the article). The Uri is not supposed to carry a large amount of data. You don't cast it to huge objects and directly query it for the information. Think of it as an address. When you have an address and a mean of transport you can get there and find whatever you're looking for. To the point, if you have an Uri, you can use Cursor and make a proper query, which can look like this: android code Uri u = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; Uri u2 = Uri.withAppendedPath(u, 1); // this is what you have // u2 == content://media/external/images/media/1 String[] projection = { MediaStore.Images.ImageColumns.DATA, / *col1*/ MediaStore.Images.ImageColumns.DISPLAY_NAME /*col2*/}; Cursor c = managedQuery(u2, projection, null, null, null); if (c!=null c.moveToFirst()) { String column0Value = c.getString(0); String column1Value = c.getString(1); Log.d(Data,column0Value); Log.d(Display name,column1Value); } /android code Obviously, you can reduce number of columns to the one you need the most. The less number of columns we have to return, the more efficient it will get. On Jul 22, 8:41 pm, Mina Shokry minasho...@gmail.com wrote: thank you for this great help but unfortunately this isn't my case. not me who created the cursor and iterate through it. I am just receiving the Uri from another activity via an intent. and it isn't good to iterate through all images to find one its Uri matches one I received especially that I am not sure it will always be a Uri of an image. still can I get the file name? On Jul 22, 4:04 pm, Kacper86 cpph...@gmail.com wrote: Hi, The problem is that it should be documented in the Android Reference, here: http://developer.android.com/reference/android/provider/MediaStore.Im.. But, as far as i understand, it's not complete. Fortunately, we can check it in a different way. android code Uri u = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; //sdcard only Cursor c = managedQuery(u, null, null, null, null); if (c.moveToFirst()) { do { int max = c.getColumnCount(); for (int i = 0; i max; i++) { String colName = c.getColumnName(i); String value = c .getString(c.getColumnIndex(colName)); if (colName != null){ Log.d(columnName: , colName); } if (value != null) { Log.d(value, value); } } } while (c.moveToNext()); } /android code Check LogCat and you'll notice that we have all column names with their values. I suppose, you'd be interested in: 07-22 12:50:09.973: DEBUG/columnName:(3049): _data 07-22 12:50:09.973: DEBUG/value(3049): /sdcard/download/vienna-s- schonbrunn-zoo-and-giant-ferris-wheel-in-vienna-1.jpg (...) 07-22 12:50:09.983: DEBUG/columnName:(3049): _display_name 07-22 12:50:09.983: DEBUG/value(3049): vienna-s-schonbrunn-zoo-and- giant-ferris-wheel-in-vienna-1.jpg If you have got any questions, don't hesitate to ask. Greetings! On Jul 22, 10:28 am, Mina Shokry minasho...@gmail.com wrote: Hello, I am using content provider to access images in phone gallery and everything works fine except one thing that I want to get the physical file name of images I access. Can I get a java.io.File object from android.net.Uri object? if no, is there any other way to accomplish such a task? I just need to know the file name! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at
[android-beginners] Question about the annoyingly short screen time-out during a call...
Hi, According to my adb logcat, this is what happens when the phone shuts off the screen during a phone call: D/PhoneApp( 185): updateWakeState: keepScreenOn = false (isRinging false, showingDisc false) D/SurfaceFlinger( 134): About to give-up screen, flinger = 0x17b200 [screen then turns off] How do I go about changing this setting? (Or settings, as the case may be.) Do I look through the source, change the variable and resign the whole package? Or is there a simpler way of going about it? Thanks for your help. Note: I have seen hundreds of complaints about this from people other than me, but no solutions. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Switching layouts
The findViewById will return a non-null Widget object, only if you first called setContentView and inflated the layout that contains it. That is why nextButton works and backButton is null - giving you your NullPointerException. For a simple application, an easier way to create 2 pages, would be to create 2 activities and switch between them. http://developer.android.com/reference/android/app/Activity.html Btw, there is related interesting read at http://android-developers.blogspot.com/2009/02/faster-screen-orientation-change.html Balwinder Kaur Open Source Development Center ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 22, 2:27 am, elegos furlan.giac...@gmail.com wrote: Hello there! I'm a newbie in Android programming, and was exploring the possibility to switch between more than - one - layouts (i.e. more pages?). So I've created a new XML layout page (called second.xml) and created some things in there. At least I've created a button to switch back to the first layout, but a NullPointerException fires up when the application starts, and that only for the back button, while the next button just works great. Any suggestion? Thanks :) package com.elegos.test; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class ListViewTest extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView myText = (TextView)findViewById(R.id.myTextView); Button nextButton = (Button)findViewById(R.id.ButtonNext); Button backButton = (Button)findViewById(R.id.ButtonBack); nextButton.setOnClickListener(getCListener(R.layout.second)); try {backButton.setOnClickListener(getCListener (R.layout.main));} catch(Exception e) {myText.append(\n+e.toString ());} } final private OnClickListener getCListener(final int layout) { return new Button.OnClickListener() { public void onClick(View v) { setContentView(layout); } }; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: how to program on application(not activity) exit ?
Saving a data is not a problem...I can save it by using File input/ ouput operaions. the problem is saving a data on particular event. And that event is Application exit. while app is running and user presses home button, what happens ? is application killed ? all activities are destroyed? I wrote a code in one activity's onDestroy() method. In normal situation it gets executed while leaving that activity, but when I press home button, it didn't. And after pressing home button, the app is starting from beginning. So it will not work what I wanted (saving a data (list of objects) ) before app exits. On Jul 22, 3:08 pm, Balwinder Kaur (T-Mobile) balwinder.k...@t- mobile.com wrote: It seems to me that you may be able to do what you intend to do by using SharedPreferences http://developer.android.com/reference/android/content/SharedPreferen... The only thing to note is that this class is not supported across multiple processes. The other advantage with using SharedPreferences is that the data will be saved not only on exit, but also if the app is paused. Hope this helps, Balwinder Kaur Open Source Development Center ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc On Jul 22, 12:29 pm, Mapara,Harshit Nitinkumar hnmap...@gmail.com wrote: Hi all, I have requirement that needs to save data to a file. During multiple Activitiy screens, I add different data to a list and finally when user is not using the app (means if user exits app by pressing home button or call button), just before exiting that app, i want to save that data of the list to a file. coding before exiting activity screen is simple - by calling onDestory () method, but here I want not one activity but the application exit. So my question is How do I write a code that will be executed just before application exits ? I tried created one class extends Application, and then I override onTerminate() method, but it's not get called when I exit ( pressing home button on device) Plz help Thanks Harshit --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: how to program on application(not activity) exit ?
Mapara,Harshit Nitinkumar wrote: while app is running and user presses home button, what happens ? is application killed ? all activities are destroyed? None of the above. The application is still running. http://developer.android.com/guide/practices/ui_guidelines/activity_task_design.html#tour I wrote a code in one activity's onDestroy() method. In normal situation it gets executed while leaving that activity, but when I press home button, it didn't. Correct. And after pressing home button, the app is starting from beginning. So it will not work what I wanted (saving a data (list of objects) ) before app exits. Save your data in onPause() or onStop(). Both of those will be called when: -- the user presses Home -- a call comes in and the user takes the call -- the user responds to a Notification -- etc. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Training: http://commonsware.com/training.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: how to program on application(not activity) exit ?
Yeah...it works.. Thanks On Jul 22, 5:55 pm, Mark Murphy mmur...@commonsware.com wrote: Mapara,Harshit Nitinkumar wrote: while app is running and user presses home button, what happens ? is application killed ? all activities are destroyed? None of the above. The application is still running. http://developer.android.com/guide/practices/ui_guidelines/activity_t... I wrote a code in one activity's onDestroy() method. In normal situation it gets executed while leaving that activity, but when I press home button, it didn't. Correct. And after pressing home button, the app is starting from beginning. So it will not work what I wanted (saving a data (list of objects) ) before app exits. Save your data in onPause() or onStop(). Both of those will be called when: -- the user presses Home -- a call comes in and the user takes the call -- the user responds to a Notification -- etc. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android App Developer Training:http://commonsware.com/training.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Question about the annoyingly short screen time-out during a call...
Looking at PhoneApp.java, this seems to be getting closer: 559 /** 560 * Controls how quickly the screen times out. 561 * 562 * The poke lock controls how long it takes before the screen powers 563 * down, and therefore has no immediate effect when the current 564 * WakeState (see {...@link PhoneApp#requestWakeState}) is FULL. 565 * If we're in a state where the screen *is* allowed to turn off, 566 * though, the poke lock will determine the timeout interval (long or 567 * short). 568 * 569 * @param shortPokeLock tells the device the timeout duration to use 570 * before going to sleep 571 * {...@link com.android.server.PowerManagerService#SHORT_KEYLIGHT_DELAY}. 572 */ 573 /* package */ void setScreenTimeout(ScreenTimeoutDuration duration) { 574 if (DBG) Log.d(LOG_TAG, setScreenTimeout( + duration + )...); 575 576 // make sure we don't set the poke lock repeatedly so that we 577 // avoid triggering the userActivity calls in 578 // PowerManagerService.setPokeLock(). 579 if (duration == mPokeLockSetting) { 580 return; 581 } 582 mPokeLockSetting = duration; 583 584 // This is kind of convoluted, but the basic thing to remember is 585 // that the poke lock just sends a message to the screen to tell 586 // it to stay on for a while. 587 // The default is 0, for a long timeout and should be set that way 588 // when we are heading back into a the keyguard / screen off 589 // state, and also when we're trying to keep the screen alive 590 // while ringing. We'll also want to ignore the cheek events 591 // regardless of the timeout duration. 592 // The short timeout is really used whenever we want to give up 593 // the screen lock, such as when we're in call. 594 int pokeLockSetting = LocalPowerManager.POKE_LOCK_IGNORE_CHEEK_EVENTS; 595 switch (duration) { 596 case SHORT: 597 // Set the poke lock to timeout the display after a short 598 // timeout (5s). This ensures that the screen goes to sleep 599 // as soon as acceptably possible after we the wake lock 600 // has been released. 601 if (DBG) Log.d(LOG_TAG, setting short poke lock); 602 pokeLockSetting |= LocalPowerManager.POKE_LOCK_SHORT_TIMEOUT; 603 break; 604 605 case MEDIUM: 606 // Set the poke lock to timeout the display after a medium 607 // timeout (15s). This ensures that the screen goes to sleep 608 // as soon as acceptably possible after we the wake lock 609 // has been released. 610 if (DBG) Log.d(LOG_TAG, setting medium poke lock); 611 pokeLockSetting |= LocalPowerManager.POKE_LOCK_MEDIUM_TIMEOUT; 612 break; 613 614 case DEFAULT: 615 default: 616 // set the poke lock to timeout the display after a long 617 // delay by default. 618 // TODO: it may be nice to be able to disable cheek presses 619 // for long poke locks (emergency dialer, for instance). 620 if (DBG) Log.d(LOG_TAG, reverting to normal long poke lock); 621 break; 622 } 623 624 // Send the request 625 try { 626 mPowerManagerService.setPokeLock(pokeLockSetting, mPokeLockToken, LOG_TAG); 627 } catch (RemoteException e) { 628 } 629 } On Jul 22, 6:18 pm, Ed edmundcl...@gmail.com wrote: Hi, According to my adb logcat, this is what happens when the phone shuts off the screen during a phone call: D/PhoneApp( 185): updateWakeState: keepScreenOn = false (isRinging false, showingDisc false) D/SurfaceFlinger( 134): About to give-up screen, flinger = 0x17b200 [screen then turns off] How do I go about changing this setting? (Or settings, as the case may be.) Do I look through the source, change the variable and resign the whole package? Or is there a simpler way of going about it? Thanks for your help. Note: I have seen hundreds of complaints about this from people other than me, but no solutions. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners]
please tell the difference when we use Intent when we use PendingIntent how pendingintent differ from Intent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: [android-beginners]
The difference is pending. you use pendingintent when you want 'pending'. - Original Message From: saurabh sinha saurso...@gmail.com To: jack...@t-mobile.com; android-beginners@googlegroups.com Sent: Wednesday, July 22, 2009 7:10:57 PM Subject: [android-beginners] please tell the difference when we use Intent when we use PendingIntent how pendingintent differ from Intent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] How to run instrumentation?
Hi, In the instrumentation class description it's given When running with instrumentation turned on, this class will be instantiated for you before any of the application code I included an instrumentation component in our application/package code and also added it in the manifest file. But when I run the app, the instrumentation is not launched, how to turn it on? Thanks Yasser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Low performance using SurfaceView, touchMode and OptionMenu
Hi guys, well I FOUND the solution to the slow surfaceview issue that almost no one mentions! I know someone will appreciate this though, for me its as simple as this: remove: // int flags = WindowManager.LayoutParams.FLAG_FULLSCREEN; //getWindow().setFlags(flags, flags); Ie dont set fullscreen programatically, and adjust your AndroidManifest.xml to do it for you using: activity android:name=.AndroidGameActivity android:label=@string/app_name android:theme=@android:style/ Theme.NoTitleBar.Fullscreen And this WORKS as a fix for me, thank god for that, took me wekkksss to work that out. Good luck fellow sufferers... Gareth www.garethmurfin.co.uk freelance j2me / android / iphone developer On Jun 25, 1:46 am, Jason Van Anden jason.van.an...@gmail.com wrote: I highly recommend that you watch this: http://www.youtube.com/watch?v=U4Bk5rmIpic Jason Van Andenhttp://www.smileproject.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: How to run instrumentation?
I think you will need to launch it with the following command: adb shell am instrument -w app_package_name/instrumentation_class_name On Wed, Jul 22, 2009 at 7:24 PM, Yasseryassersiddi...@gmail.com wrote: Hi, In the instrumentation class description it's given When running with instrumentation turned on, this class will be instantiated for you before any of the application code I included an instrumentation component in our application/package code and also added it in the manifest file. But when I run the app, the instrumentation is not launched, how to turn it on? Thanks Yasser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Switching layouts
package com.elegos.test; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class ListViewTest extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView myText = (TextView)findViewById(R.id.myTextView); Button nextButton = (Button)findViewById(R.id.ButtonNext); nextButton.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ Intent nextIntent=new Intent (ListViewTes.this,ExmpActivity.class); startActivity(nextIntent); }); }} U will create another activity by name ExmpActivity as follows package com.elegos.test; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class ExmpActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.xyz); Button backButton = (Button)findViewById(R.id.ButtonBack); backButton.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ Intent backIntent=new Intent (ExmpActivity.this,ListViewTes.class); startActivity(backIntent); }); } } On Jul 22, 2:27 pm, elegos furlan.giac...@gmail.com wrote: Hello there! I'm a newbie in Android programming, and was exploring the possibility to switch between more than - one - layouts (i.e. more pages?). So I've created a new XML layout page (called second.xml) and created some things in there. At least I've created a button to switch back to the first layout, but a NullPointerException fires up when the application starts, and that only for the back button, while the next button just works great. Any suggestion? Thanks :) package com.elegos.test; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class ListViewTest extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView myText = (TextView)findViewById(R.id.myTextView); Button nextButton = (Button)findViewById(R.id.ButtonNext); Button backButton = (Button)findViewById(R.id.ButtonBack); nextButton.setOnClickListener(getCListener(R.layout.second)); try {backButton.setOnClickListener(getCListener (R.layout.main));} catch(Exception e) {myText.append(\n+e.toString ());} } final private OnClickListener getCListener(final int layout) { return new Button.OnClickListener() { public void onClick(View v) { setContentView(layout); } }; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Attach multiple images
Hi... I have developed a application which can send an email with one image attachment. Now i want to attach the multiple images.when i click a button email should send to a hard coded email address with multiple image attachments. I used intents for my program. To send image i used putExtra method and send image as a EXTRA_STREAM. Are their any way to implement this.If any body knows plz help me my code is public class emailFun extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.email_main); Button btnSend = (Button) findViewById(R.id.mbutton); btnSend.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (v.getId() == R.id.mbutton) { sendEmail(); } } }); } public void sendEmail() { String []mailto = {mai...@yahoo.com}; // Create a new Intent to send messages Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto); Uri _uri=MediaStore.Images.Media.EXTERNAL_CONTENT_URI; android.provider.MediaStore.Images.ImageColumns.DATA },null, null, null); Cursor cursor = getContentResolver().query(_uri, new String[] { android.provider.MediaStore.Images.ImageColumns.DATA },null, null, null); cursor.moveToFirst(); int i=cursor.getCount(); sendIntent.putExtra(Intent.EXTRA_SUBJECT,Accsident pictueres- count+i); cursor.moveToFirst(); String imageFilePath1 = cursor.getString(0); String modPath1=file://+imageFilePath1; Uri uPath1=Uri.parse(modPath1); sendIntent.setType(image/jpg); sendIntent.putExtra(Intent.EXTRA_STREAM,uPath1); startActivity(Intent.createChooser(sendIntent,send the mail)); cursor.close(); finish(); } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---