Re: [android-beginners] IOException with BufferedReader
Hi, You cannot use the regular java IO for res/raw. folder. only if you are using /sd/card you can use regular java.io here is some code that might help you FileInputStream fin = context.openFileInput(sitestore); InputStreamReader br = new InputStreamReader(fin); String readString = ; int i; while((i = br.read()) != -1){ inputBuffer = (char)i; readString = readString + inputBuffer; } FileOutputStream fOut = context.openFileOutput(sitestore, context.MODE_WORLD_READABLE); OutputStreamWriter bw = new OutputStreamWriter(fOut); write the code for writting to file here... Regards, Yousuf. On Mon, Dec 14, 2009 at 4:03 PM, kaloer mkal...@gmail.com wrote: Hi, I have a problem when I'm trying to read a file from the res/raw folder. When I get the file as an InputStream and try reading it line for line with a BufferedReader, I get an IOException when I'm calling the br.readLine(). I do no get any additional information in the exception. Are there anything wrong with this code: private void readFile(InputStream mFile) { DataInputStream in = new DataInputStream(mFile); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { Log.i(line, strLine); } in.close(); } Thank you very much! //Kaloer -- 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.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- 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
Re: [android-beginners] Re: IOException with BufferedReader
yes, For sure. the raw folder has a limit to the amount of data that it can hold. It cant hold large data files. Regards, Yousuf. On Tue, Dec 15, 2009 at 1:58 PM, kaloer mkal...@gmail.com wrote: Hi again, I've just tried putting a simple file with the Hello, world text into the raw folder, and this works as it should. The other file is 1.1 megabyte. Can the error be caused because of the size? On 15 Dec., 19:52, Yousuf Syed yousuf.syed@gmail.com wrote: Hi Kaloer, The procedure is as follows: 1. create a raw folder, 2. place a file.(txt or regular file with no extension) in the raw folder. 3.write the code as said earlier. 4 one more thing that you can do is push the file through eclipse's ddms to data/data/your application dir/files directory. (Your file in the DDMS will be updated not the one contained in /res/raw/ folder so look for the size of the file present in ddms under /data/data/com.app.files/files/ ) 5 path to be specified: just give the file name that is present in the raw folder. if the name of file is sample.txt which is present in /res/raw/ folder FileInputStream fin = context.openFileInput(sample.txt); // if used within a adapter class or somewhere outside the activity class if you are using this within the activity it should be FileInputStream fin = openFileInput(sample.txt); I guess step 4 is needed for the first time since your read is performed before your write. if you are writing before reading then the FileOutputStream object either writes to a existing file or creates a new one( FileInputStream object cannot create a new file). Do remember that raw folder has a limit to the data that it can contain so files with large amount of data cant be stored there. For your convenience I am attaching my filehandling projected that reads and writes to file. This is a working example. for some reason if this is not working try using permissions. read_owner_data write_owner_data write_external_storage but these permissions are for files stored on /sdcard/filename Hope this would help. Regards, Yousuf. On Tue, Dec 15, 2009 at 12:28 PM, kaloer mkal...@gmail.com wrote: Hi Yousuf, Thank you very much for the answer. However, I don't know in which directory i should put the file? I don't want to save the file from my application - it should just be there when the application is installed. I don't think I can access this file with the context.openFileInput() method? Or am I wrong? //Kaloer On 15 Dec., 16:44, Yousuf Syed yousuf.syed@gmail.com wrote: Hi, You cannot use the regular java IO for res/raw. folder. only if you are using /sd/card you can use regular java.io here is some code that might help you FileInputStream fin = context.openFileInput(sitestore); InputStreamReader br = new InputStreamReader(fin); String readString = ; int i; while((i = br.read()) != -1){ inputBuffer = (char)i; readString = readString + inputBuffer; } FileOutputStream fOut = context.openFileOutput(sitestore, context.MODE_WORLD_READABLE); OutputStreamWriter bw = new OutputStreamWriter(fOut); write the code for writting to file here... Regards, Yousuf. On Mon, Dec 14, 2009 at 4:03 PM, kaloer mkal...@gmail.com wrote: Hi, I have a problem when I'm trying to read a file from the res/raw folder. When I get the file as an InputStream and try reading it line for line with a BufferedReader, I get an IOException when I'm calling the br.readLine(). I do no get any additional information in the exception. Are there anything wrong with this code: private void readFile(InputStream mFile) { DataInputStream in = new DataInputStream(mFile); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { Log.i(line, strLine); } in.close(); } Thank you very much! //Kaloer -- 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.comandroid-beginners%2bunsubscr...@googlegroups.com android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@googlegroups.com android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@googlegroups.com android-beginners%252bunsubscr...@googlegroups.comandroid-beginners%25252bunsubscr...@googlegroups.com For more options
Re: [android-beginners] Re: IOException with BufferedReader
Hi, Write another supporting application to download them and save it to the location used in your main application. then install the main applicaiton. This should do. but I have not worked on downloading files from server. So cant help you in this regard. Sorry for that. Regards, Yousuf. On Tue, Dec 15, 2009 at 2:11 PM, kaloer mkal...@gmail.com wrote: Oh okay.. But how can I use it them? Do I need to download it from a server or so? I have tried putting it into the assets folder but this seems to have the same limit. On 15 Dec., 20:04, Yousuf Syed yousuf.syed@gmail.com wrote: yes, For sure. the raw folder has a limit to the amount of data that it can hold. It cant hold large data files. Regards, Yousuf. On Tue, Dec 15, 2009 at 1:58 PM, kaloer mkal...@gmail.com wrote: Hi again, I've just tried putting a simple file with the Hello, world text into the raw folder, and this works as it should. The other file is 1.1 megabyte. Can the error be caused because of the size? On 15 Dec., 19:52, Yousuf Syed yousuf.syed@gmail.com wrote: Hi Kaloer, The procedure is as follows: 1. create a raw folder, 2. place a file.(txt or regular file with no extension) in the raw folder. 3.write the code as said earlier. 4 one more thing that you can do is push the file through eclipse's ddms to data/data/your application dir/files directory. (Your file in the DDMS will be updated not the one contained in /res/raw/ folder so look for the size of the file present in ddms under /data/data/com.app.files/files/ ) 5 path to be specified: just give the file name that is present in the raw folder. if the name of file is sample.txt which is present in /res/raw/ folder FileInputStream fin = context.openFileInput(sample.txt); // if used within a adapter class or somewhere outside the activity class if you are using this within the activity it should be FileInputStream fin = openFileInput(sample.txt); I guess step 4 is needed for the first time since your read is performed before your write. if you are writing before reading then the FileOutputStream object either writes to a existing file or creates a new one( FileInputStream object cannot create a new file). Do remember that raw folder has a limit to the data that it can contain so files with large amount of data cant be stored there. For your convenience I am attaching my filehandling projected that reads and writes to file. This is a working example. for some reason if this is not working try using permissions. read_owner_data write_owner_data write_external_storage but these permissions are for files stored on /sdcard/filename Hope this would help. Regards, Yousuf. On Tue, Dec 15, 2009 at 12:28 PM, kaloer mkal...@gmail.com wrote: Hi Yousuf, Thank you very much for the answer. However, I don't know in which directory i should put the file? I don't want to save the file from my application - it should just be there when the application is installed. I don't think I can access this file with the context.openFileInput() method? Or am I wrong? //Kaloer On 15 Dec., 16:44, Yousuf Syed yousuf.syed@gmail.com wrote: Hi, You cannot use the regular java IO for res/raw. folder. only if you are using /sd/card you can use regular java.io here is some code that might help you FileInputStream fin = context.openFileInput(sitestore); InputStreamReader br = new InputStreamReader(fin); String readString = ; int i; while((i = br.read()) != -1){ inputBuffer = (char)i; readString = readString + inputBuffer; } FileOutputStream fOut = context.openFileOutput(sitestore, context.MODE_WORLD_READABLE); OutputStreamWriter bw = new OutputStreamWriter(fOut); write the code for writting to file here... Regards, Yousuf. On Mon, Dec 14, 2009 at 4:03 PM, kaloer mkal...@gmail.com wrote: Hi, I have a problem when I'm trying to read a file from the res/raw folder. When I get the file as an InputStream and try reading it line for line with a BufferedReader, I get an IOException when I'm calling the br.readLine(). I do no get any additional information in the exception. Are there anything wrong with this code: private void readFile(InputStream mFile) { DataInputStream in = new DataInputStream(mFile); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { Log.i(line
Re: [android-beginners] Re: IOException with BufferedReader
Hey can you help me with that. I am in the middle of developing a video dictionary. the main application is complete. I am working on the support application for downloading files form the server. can you help me with sample code or useful hints in downloading the files. Thanks in advance. Yousuf. On Tue, Dec 15, 2009 at 2:25 PM, kaloer mkal...@gmail.com wrote: Thank you very much for your help! No problem, I know how to do this. Best regards, Kaloer On 15 Dec., 20:22, Yousuf Syed yousuf.syed@gmail.com wrote: Hi, Write another supporting application to download them and save it to the location used in your main application. then install the main applicaiton. This should do. but I have not worked on downloading files from server. So cant help you in this regard. Sorry for that. Regards, Yousuf. On Tue, Dec 15, 2009 at 2:11 PM, kaloer mkal...@gmail.com wrote: Oh okay.. But how can I use it them? Do I need to download it from a server or so? I have tried putting it into the assets folder but this seems to have the same limit. On 15 Dec., 20:04, Yousuf Syed yousuf.syed@gmail.com wrote: yes, For sure. the raw folder has a limit to the amount of data that it can hold. It cant hold large data files. Regards, Yousuf. On Tue, Dec 15, 2009 at 1:58 PM, kaloer mkal...@gmail.com wrote: Hi again, I've just tried putting a simple file with the Hello, world text into the raw folder, and this works as it should. The other file is 1.1 megabyte. Can the error be caused because of the size? On 15 Dec., 19:52, Yousuf Syed yousuf.syed@gmail.com wrote: Hi Kaloer, The procedure is as follows: 1. create a raw folder, 2. place a file.(txt or regular file with no extension) in the raw folder. 3.write the code as said earlier. 4 one more thing that you can do is push the file through eclipse's ddms to data/data/your application dir/files directory. (Your file in the DDMS will be updated not the one contained in /res/raw/ folder so look for the size of the file present in ddms under /data/data/com.app.files/files/ ) 5 path to be specified: just give the file name that is present in the raw folder. if the name of file is sample.txt which is present in /res/raw/ folder FileInputStream fin = context.openFileInput(sample.txt); // if used within a adapter class or somewhere outside the activity class if you are using this within the activity it should be FileInputStream fin = openFileInput(sample.txt); I guess step 4 is needed for the first time since your read is performed before your write. if you are writing before reading then the FileOutputStream object either writes to a existing file or creates a new one( FileInputStream object cannot create a new file). Do remember that raw folder has a limit to the data that it can contain so files with large amount of data cant be stored there. For your convenience I am attaching my filehandling projected that reads and writes to file. This is a working example. for some reason if this is not working try using permissions. read_owner_data write_owner_data write_external_storage but these permissions are for files stored on /sdcard/filename Hope this would help. Regards, Yousuf. On Tue, Dec 15, 2009 at 12:28 PM, kaloer mkal...@gmail.com wrote: Hi Yousuf, Thank you very much for the answer. However, I don't know in which directory i should put the file? I don't want to save the file from my application - it should just be there when the application is installed. I don't think I can access this file with the context.openFileInput() method? Or am I wrong? //Kaloer On 15 Dec., 16:44, Yousuf Syed yousuf.syed@gmail.com wrote: Hi, You cannot use the regular java IO for res/raw. folder. only if you are using /sd/card you can use regular java.io here is some code that might help you FileInputStream fin = context.openFileInput(sitestore); InputStreamReader br = new InputStreamReader(fin); String readString = ; int i; while((i = br.read()) != -1){ inputBuffer = (char)i; readString = readString + inputBuffer; } FileOutputStream fOut = context.openFileOutput(sitestore, context.MODE_WORLD_READABLE); OutputStreamWriter bw = new OutputStreamWriter(fOut); write the code for writting to file here... Regards, Yousuf. On Mon, Dec 14, 2009 at 4:03 PM, kaloer mkal...@gmail.com wrote
Re: [android-beginners] Getting android.view.WindowManager$BadTokenException alternatively
Check your code for context and change getApplicationContext(); to this I Guess your context assignment is Context context = getApplicationContext(); // this give you the bad token error. change it to: *Context context = this;* // this assignment will remove your bad token exception. On Tue, Dec 15, 2009 at 8:27 AM, Ronin akpra...@gmail.com wrote: Hi, I am trying to write a small game application in Android. Following error is seen when I try to do showDialog(). When I launch the emulator and start the game the first time it works fine. Then, the second time, it fails with the error. And 3rd, 5th, 7th time it works fine. Whereas it fails 4th,6th, 8th time and so on... I do not have any clue why it is happening. Please help. May be the exception is cleaning up something and the next time the application works fine. Code snippet is below. I am not doing any cleanup in onDestroy() method as of now. -- Code GameActivity.onCreateDialog() start -- public Dialog onCreateDialog(int id) { AlertDialog ad = null; AlertDialog.Builder builder = new AlertDialog.Builder (this); ad = builder.create(); this.id = id; if(id == Consts.WINNER_DIALOG_ID) ad.setMessage(player[winnerId]+ is the winner); else if(id == Consts.TIE_DIALOG_ID) ad.setMessage(It's a tie); ad.setButton(OK, new DialogInterface.OnClickListener () { public void onClick(DialogInterface di, int i) { ((GameActivity)mContext).finish(); } }); return ad; } -- Code GameActivity.onCreateDialog() end -- -- Exception start here -- 12-14 08:25:40.166: WARN/WindowManager(52): Attempted to add application window with unknown token HistoryRecord{433b63b8 {com.abcd.android.examples/com.abcd.android.examples.GameActivity}}. Aborting. 12-14 08:25:40.176: DEBUG/AndroidRuntime(169): Shutting down VM 12-14 08:25:40.186: WARN/dalvikvm(169): threadid=3: thread exiting with uncaught exception (group=0x4000fe68) 12-14 08:25:40.186: ERROR/AndroidRuntime(169): Uncaught handler: thread main exiting due to uncaught exception 12-14 08:25:40.216: ERROR/AndroidRuntime(169): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.binderpr...@4338 is not valid; is your activity running? 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.ViewRoot.setView(ViewRoot.java:384) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:90) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.Window$LocalWindowManager.addView(Window.java:393) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.app.Dialog.show(Dialog.java:212) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.app.Activity.showDialog(Activity.java:2277) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at com.abcd.android.examples.ImageAdapter.clicked(ImageAdapter.java:115) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at com.abcd.android.examples.ImageAdapter$1.onClick(ImageAdapter.java: 149) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.View.performClick(View.java:2129) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.View.onTouchEvent(View.java:3543) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.View.dispatchTouchEvent(View.java:3198) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at com.android.internal.policy.impl.PhoneWindow $DecorView.superDispatchTouchEvent(PhoneWindow.java:1593) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1089) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at android.app.Activity.dispatchTouchEvent(Activity.java:1871) 12-14 08:25:40.216: ERROR/AndroidRuntime(169): at com.android.internal.policy.impl.PhoneWindow $DecorView.dispatchTouchEvent(PhoneWindow.java:1577) 12-14 08:25:40.216: ERROR/AndroidRuntime(169):
Re: [android-beginners] start another activity through onclick event
Do this Intent myIntent = new Intent(androidGallery.this, helloAndroid.class); startActivity(myIntent); On Mon, Dec 14, 2009 at 3:56 AM, Lynn Ooi lynnooi@gmail.com wrote: hi, I had 2 activity (called androidGallery and HelloAndroid). i try to call helloAndroid from the androidGallery when user click on the button. basically, androidGallery is just to get the onclick event. The helloAndroid activity will set the text of a textview. however, i cant get it working. Once i click the button, a dialog box pop up saying that the application has been stopped unexpectedly with a force close button. Can anyone help me with it? androidGallery.java : package testt.android.androidgallery; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class androidGallery extends Activity { private Button btnclickme; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button = (Button) findViewById(R.id.button_id); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click Intent myIntent = new Intent(androidGallery.this, helloAndroid.class); androidGallery.this.startActivity(myIntent); } }); } } helloAndroid.java : package test.android.androidgallery; import java.io.BufferedInputStream; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.List; import org.apache.http.util.ByteArrayBuffer; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class helloAndroid extends Activity{ /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.main); String a = hello Lynn; super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText(a); setContentView(tv); } } -- 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.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- 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
Re: [android-beginners] how to get starting material of android
Hi, You can start from here. http://developer.android.com/guide/index.html and later on you can go through the books on the link below http://wiki.andmob.org/books (given by some one on this forum earlier) regards, Yousuf. On Thu, Dec 10, 2009 at 4:57 AM, Xi Shen davidshe...@googlemail.com wrote: hi, i am totally new to android, and have little programming experience about linux. can anyone point me where should i start? i am planing to get a HTC g1. -- Best Regards, David Shen http://twitter.com/davidshen84/ http://meme.yahoo.com/davidshen84/ -- 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.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- 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
Re: [android-beginners] Re: Google Maps Api - No image displayed
Do you have the right key generated com.google.android.maps.MapView android:id=@+id/mapview android:layout_width=fill_parent android:layout_height=fill_parent android:clickable=true android:apiKey=*Your Maps API Key* / step 1: create your key store by going to cmd_promt step 2: copy the key store and paste it here http://code.google.com/android/maps-api-signup.html you will recieve your Maps API key . Place it in the code above. You will be able to see the google mapview. For more details on how to visit this link : http://code.google.com/android/add-ons/google-apis/mapkey.html regards, Yousuf. On Thu, Dec 10, 2009 at 1:15 PM, TreKing treking...@gmail.com wrote: Also make sure you have the internet permission in your manifest, otherwise the maps can't download the image tiles. - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking On Tue, Dec 8, 2009 at 11:06 AM, Denis 87elem...@gmail.com wrote: Hi, guys, It is interesting, but I have the same problem. I've found a guide to construct Google Maps-aware application (as simple as possible, just a map even without zoom...) and it doesn't work (Well, it works - shows me nice grey grid). The advice is always one - check API keys. But the key is correct, because another application (that is built-in MapsDemo in Eclipse) runs well using my key! Regards, Denis On 14 ноя, 21:27, Raphaël Piéroni raphaelpier...@gmail.com wrote: Thanks for the answer, Yes i am running in debug mode. But i think i did it right, as i gave the debug keystore fingerprint to the registration process. I have not performed yet the creation of a release keystore for wndows nor macosx. Regards, Raphaël 2009/11/11 TreKing treking...@gmail.com Looks like you're running in debug mode. Are you sure you're using the debug key? If you tested a release version on your Mac it would explain why it works there. 2009/11/10 Raphaël Piéroni raphaelpier...@gmail.com Hi Folks, Some updates, I retried on mac osx JAVA6 (i was on winXP JAVA5) and it works fine. I have 2 hypothesys on my problem : - OS but i don't believe it - Java version but i don't believe also Raphaël Le 10 novembre 2009 12:36, Raphaël Piéroni raphaelpier...@gmail.com a écrit : Hello folks, In my map view i have NO image displayed. I did get an apiKey from my keystore fingerprint. I using the ant script that affirms to sign the apk with the same keystore. I have proper permissions and library usage. But still I got no image. If anyone has a clue for displaying the map in my simulator i will be very happy. Regards, Raphaël Extracts from the manifest : ?xml version=1.0 encoding=utf-8? manifest xmlns:android=http://schemas.android.com/apk/res/android android:versionCode=1 android:versionName=1.0 *uses-permission android:name=android.permission.INTERNET / uses-permission android:name=android.permission.ACCESS_FINE_LOCATION / uses-permission android:name=android.permission.ACCESS_LOCATION_EXTRA_COMMANDS / uses-permission android:name=android.permission.ACCESS_COARSE_LOCATION /* uses-sdk android:minSdkVersion=5 / application android:label=@string/application_name *uses-library android:name=com.google.android.maps /* activity android:name=InitializationActivity android:label=@string/application_name intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter /activity /application /manifest Extracts from the layout.xml ?xml version=1.0 encoding=utf-8? ScrollView xmlns:android= http://schemas.android.com/apk/res/android; android:layout_width=fill_parent android:layout_height=fill_parent com.google.android.maps.MapView android:id=@+id/map_view android:layout_width=fill_parent android:layout_height=fill_parent * android:apiKey=0U4YsOFH1B2CbsN0un0AcdDlD30t4i-EDL3h4JQ* / /ScrollView Extract from the activity which extends MapActivity with proper override. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map_test); MapView map = (MapView) findViewById(R.id.map_view); map.setClickable(true); MapController mc = map.getController(); double latitude = 47.3869316; double longitude = -2.9516315; GeoPoint location = new GeoPoint((int) (latitude * 100.0), (int) (longitude * 100.0)); mc.setCenter(location); mc.setZoom(10); map.setEnabled(true); map.setSatellite(true); map.invalidate(); } Installing the
Re: [android-beginners] Playing a Video from file
I dont think you can place the video file in the raw folder. since there is a limit of data that you can have in your raw folder. try pushing it to the /sdcard/videofilename and add permissions for read_owner_data, write_owner_data, write_external_storage. I assume you know the procedure to push files to sdcard. Regards, Yousuf. On Fri, Dec 11, 2009 at 7:10 AM, Valentino XM shourai...@gmail.com wrote: Help! code code code, playing a video from file.. using the video view widget. not at all successful. the developers page claims this is easy.. i beg to differ... for first time coders, very frutstrating.. if you can help., please do. package info.shouraig.com; import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.widget.VideoView; public class XSO3 extends Activity { private static final String TAG = XSO3; VideoView videoXSO3; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Log.d(TAG,onCreate started); VideoView video = (VideoView) this.findViewById (R.id.VideoXSO3); my title Uri uri = Uri.parse(//info.shouraig.com/ + R.raw.C:/ XSCycling2.mp4); my video video.setVideoURI(uri); video.setMediaController(new VideoView(this)); video.requestFocus(); video.setOnCompletionListener(this); video.start(); }AssetFileDescriptor afd = getResources().openRawResourceFd (R.raw.video); // Create a new media player and set the listeners mMediaPlayer = new MediaPlayer(); mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); -- 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.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- 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
Re: [android-beginners] Where can I get android icons
Hi, here are some as well. http://www.screaming-penguin.com/info/android_drawables/android_drawables.html Regards, Yousuf. On Sun, Dec 13, 2009 at 6:19 PM, Liviu Ungureanu smartli...@gmail.comwrote: Hi! Try this link : http://e-lusion.com/design/greyscale -- 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.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- 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
Re: [android-beginners] Just trying to capture screenshots
Hi, From what I understand, you want to capture the screen shots of the application that is either running on emulator or the device. If so let the application start. Then in the eclipse do this. Click on the Window menu bar. -- open perspective--ddms now the ddms will be there on your eclipse window like your java perspective or Debug perspective. if your application is running you can capture screenshots by clicking on the screen capture icon present in the device window. hope this answers your question. regards, Yousuf. On Sat, Dec 12, 2009 at 11:23 AM, Rob slackat...@gmail.com wrote: I followed all instructions, but when I get to the point of double clicking the ddms.bat file, I see the command prompt pop up and then nothing. I have tried running as an admin with the same results. What am I doing wrong? Notes: I have downloaded and updated android sdk I have downloaded and installed java_ee_sdk-5_08-jdk-6u17-windows Sorry if this is posted under something else, but I only got one result for ddms -- 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.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- 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] Problem with VideoView when playing a mp4/3gp file
Hi, I was working on developing a VideoPlayer. I am getting an error while running the .mp4 file on VideoView. This error occurs when I click on the video view when the video is playing or if I start the video directly. The error dialogue that appears on the screen says application stopped unexpectedly. Does anyone knows whats wrong with my code. Is there any other thing that I need to do like adding permissions or intent filters. Here is the code that can give more understanding about my application Video Player.. public class VideoPlayer extends Activity { VideoView videoview; Context context; Bundle bundle; Intent sender; volatile boolean FLAG_FOR_FAVORITE; volatile boolean FLAG_FOR_PLAY_PAUSE = false; MediaController mediaController; TextView wordtext; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this.getApplicationContext(); sender = this.getIntent(); setContentView(R.layout.videoplayer); Bundle retrieving_bundle = sender.getExtras(); String wordname = retrieving_bundle.getString(txtstring); String filename = /sdcard/ + wordname + .mp4; ImageButton playpause = (ImageButton)findViewById(R.id.playpause); mediaController = new MediaController(context); wordtext = (TextView)findViewById(R.id.vocabularyword); wordtext.setText(wordname); ///Code for setting video View // try{ videoview = (VideoView)findViewById(R.id.wordvideo); videoview.setVideoPath(filename); videoview.setMediaController(mediaController); videoview.requestFocus(); //videoview.start(); *This gives an error if not commented This is what I meant by running directly* videoview.setClickable(false); videoview.setOnClickListener(new OnClickListener(){ public void onClick(View v){ if(FLAG_FOR_PLAY_PAUSE == false){ FLAG_FOR_PLAY_PAUSE = true; videoview.start(); } to remove from favorites /// else if(FLAG_FOR_PLAY_PAUSE == true){ FLAG_FOR_PLAY_PAUSE = false; videoview.pause(); } } }); } catch(Exception e){ Log.v(video,e.getMessage()); } playpause.setOnClickListener(new OnClickListener(){ public void onClick(View v) { ImageButton pauseplay = (ImageButton)findViewById(R.id.playpause); / to add to favorites/ if(FLAG_FOR_PLAY_PAUSE == false){ pauseplay.setImageResource(R.drawable.pause); FLAG_FOR_PLAY_PAUSE = true; videoview.start(); } to remove from favorites /// else if(FLAG_FOR_PLAY_PAUSE == true){ pauseplay.setImageResource(R.drawable.play); FLAG_FOR_PLAY_PAUSE = false; videoview.pause(); } } }); } The logcat shows the following: 12-10 11:53:12.931: WARN/WindowManager(52): at com.android.server.WindowManagerService$Session.onTransact(WindowManagerService.java:6427) 12-10 11:53:12.931: WARN/WindowManager(52): at android.os.Binder.execTransact(Binder.java:287) 12-10 11:53:12.931: WARN/WindowManager(52): at dalvik.system.NativeStart.run(Native Method) 12-10 11:53:12.931: WARN/WindowManager(52): Attempted to add window with token that is not a window: null. Aborting. 12-10 11:53:12.941: DEBUG/AndroidRuntime(3035): Shutting down VM 12-10 11:53:12.941: WARN/dalvikvm(3035): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 12-10 11:53:12.951: ERROR/AndroidRuntime(3035): Uncaught handler: thread main exiting due to uncaught exception 12-10 11:53:13.041: DEBUG/dalvikvm(3035): GC freed 2397 objects / 340176 bytes in 89ms 12-10 11:53:13.081: ERROR/AndroidRuntime(3035): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running? 12-10 11:53:13.081: ERROR/AndroidRuntime(3035): at android.view.ViewRoot.setView(ViewRoot.java:468) 12-10 11:53:13.081: ERROR/AndroidRuntime(3035): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) 12-10 11:53:13.081: ERROR/AndroidRuntime(3035): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) 12-10 11:53:13.081: ERROR/AndroidRuntime(3035): at android.widget.MediaController.show(MediaController.java:304) 12-10 11:53:13.081: ERROR/AndroidRuntime(3035): at android.widget.MediaController.show(MediaController.java:249) 12-10
[android-beginners] Is there a way to add Video files to my application
Hi, I am developing an application where in I need to display video files in a video player. I need to push the video files on to the sdcard of the emulator in order for my application to play those videos. if this application is deployed on an android phone I need to push the files on that too. Is there a way I can bundle those file along within the apk file so that its easy for the users to download and install the application? Thanks in advance, Yousuf -- 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] Help regarding facebook integration applicaiton
Hi, Can anyone help me with some ideas or clues on how to integrate my android application with facebook. Thanks in advance, Yousuf. -- 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