[android-beginners] Re: findViewById() function return null
What is timestamp of this xml file? How does it work with the app? I think the reason it was suggested was to convince the thing to recompile. I don't think that's the problem. I'd guess you are using the m5 sdk, but the layout file you posted is m3. try changing the id=@+id... to android:id=@+id... On May 5, 8:22 pm, tagore [EMAIL PROTECTED] wrote: Thank you for your reply. the relative_view.xml file is shown below: ?xml version=1.0 encoding=UTF-8? RelativeLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=wrap_content android:padding=10px TextView id=@+id/label android:layout_width=fill_parent android:layout_height=wrap_content android:text=Type here:/ EditText id=@+id/entry android:layout_width=fill_parent android:layout_height=wrap_content android:background=@android:drawable/ editbox_background android:layout_below=@id/label/ Button id=@+id/ok android:layout_width=wrap_content android:layout_height=wrap_content android:layout_below=@id/entry android:layout_alignParentRight=true android:layout_marginLeft=10px android:text=OK / Button android:layout_width=wrap_content android:layout_height=wrap_content android:layout_toLeft=@id/ok android:layout_alignTop=@id/ok android:text=Cancel / /RelativeLayout I REALLY have the id -- entry. I wonder if there is other problem? What is timestamp of this xml file? How does it work with the app? On 5月6日, 上午10时04分, Mark Murphy [EMAIL PROTECTED] wrote: tagore wrote: Today, I write some simple code to implement activity. See the following codes: public class TestLinearView extends Activity { private EditText edit = null; /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); // Set activity content from layout view setContentView(R.layout.relative_view); // change the edit text edit = (EditText)findViewById(R.id.entry); edit.setText(Mysdfsadfdsafdsf); } } However, the application crushed. After I debug into the app, I found that the edit was null. It would appear that your res/layout/relative_view.xml file does not have a view with the id of @+id/entry. I would have expected a compiler error, though, complaining that R.id.entry was not found. Perhaps your R.java file is out of sync with the contents of your res/ directory tree. Try updating the timestamp on your res/layout/relative_view.xml file (e.g., touch res/layout/relative_view.xml in Linux) and recompile. Or, update res/layout/relative_view.xml to include an EditText element with an android:id of @+id/entry, since it would appear it doesn't have one already. -- Mark Murphy (a Commons Guy)http://commonsware.com The Busy Coder's Guide to Android Development -- coming in June 2008! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: HELP! R.layout.main cannot be resolved error
Well, the resource stuff isn't a Java thing, it's an Android thing. Basically if you put a layout xml file in res/layout, you reference it by filename when you call setContentView. For instance, if you have res/layout/my_fancy_layout.xml, you make a call to setContentView(R.layout.my_fancy_layout). But, it sounds like you have a main.xml in that directory and using it correctly with setContentView. The layout xml looks valid for the m5 sdk. Are you using m5 or m3? Also, if you are using eclipse, it should tell you if theres a problem in the xml file itself when you open the file. That might give some insight. On Apr 22, 10:14 am, Kastagire [EMAIL PROTECTED] wrote: Thank for the info Tatsu... The file I am trying to import is main.xml, and is located in Res-Layout. I just labeled the XML DroidDraw to pretty much say it was from DroidDraw.. I wasn't awake yet when I put that in there I guess, lol. I am not quite following the part about the res filename. Pardon my ignorance, I have only been doing JAVA stuff for a few days, and I am not very well versed in it. Would you be able to be a little more detailed with that explanation? On Apr 22, 9:52 am, Tatsu [EMAIL PROTECTED] wrote: Hi, It seems that res filename must contain only [a-z0-9_-.]. (It is possibly undocumented issue.) Change your layout filename from DroidDraw.xml to droiddraw.xml or simply main.xml, and hand same name to setContentView(). Best Regards, Tatsu http://www.tatsu.com On Apr 22, 9:31 pm, Kastagire [EMAIL PROTECTED] wrote: Hey all, I have been fiddling around with Android for the past couple of days, and I was working through the tutorials and sample code. Yesterday, I made an interface with DroidDraw, which generates XML to make the GUI. As far as I can see, everything is in order, but I have an error when it goes to pull the XML from the layout folder. It says that R.layout.main cannot be resolved, and thus all subsequent links to the XML get a similar error. I have been plugging away on this problem for a couple of hours, but cannot get it to work. I checked the forums already, and someone mentioned that the version of DroidDraw may not be compatible with the new SDK, but I checked what was posted, and it seemed to work fine. Below is the JAVA code, and then the XML from Droid Draw.. any help would be appreciated!!! Thanks! package com.android.androidtake2; import android.R; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RadioButton; import android.widget.TextView; public class androidtake2 extends Activity implements OnClickListener { TextView dollars; TextView euros; RadioButton dtoe; RadioButton etod; Button convert; /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); dollars = (TextView)this.findViewById(R.id.dollars); euros = (TextView)this.findViewById(R.id.euros); dtoe = (RadioButton)this.findViewById(R.id.dtoe); dtoe.setChecked(true); etod = (RadioButton)this.findViewById(R.id.etod); convert = (Button)this.findViewById(R.id.convert); convert.setOnClickListener(this); } public void onClick(View v) { if (dtoe.isChecked()) { convertDollarsToEuros(); } if (etod.isChecked()) { convertEurosToDollars(); } } protected void convertDollarsToEuros() { double val = Double.parseDouble(dollars.getText().toString()); euros.setText(Double.toString(val*0.67)); } protected void convertEurosToDollars() { double val = Double.parseDouble(euros.getText().toString()); dollars.setText(Double.toString(val/0.67)); } } DroidDraw XML- ?xml version=1.0 encoding=utf-8? AbsoluteLayout android:id=@+id/widget63 android:layout_width=fill_parent android:layout_height=fill_parent xmlns:android=http://schemas.android.com/apk/res/android; LinearLayout android:id=@+id/widget96 android:layout_width=wrap_content android:layout_height=wrap_content xmlns:android=http://schemas.android.com/apk/res/android; android:orientation=vertical android:layout_x=91px android:layout_y=0px EditText android:id=@+id/viewdol android:layout_width=100 px android:layout_height=wrap_content android:text=Dollars android:textSize=18sp android:textStyle=bold /EditText TextView
[android-beginners] Re: EditText getText() to string for notification
Because message is whatever text is in the EditText whenever this bit of code runs. I assume this is ran in onCreate? Probably this is blank unless you gave it a default value. What you might try is to remove the message variable and then call text.getText().toString() in the Toast.makeText method. On Apr 22, 2:28 pm, Kyle [EMAIL PROTECTED] wrote: Hi, I have my application set to grab the text from an EditText field, but for some reason even if I convert it toString, the returned string always comes back blank. Here is my code: Button button; EditText text; button = (Button) findViewById(R.id.btnOK); text = (EditText) findViewById(R.id.txtCustomerName); final String message = text.getText().toString(); button.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { Toast.makeText(HelloWorld.this, message, Toast.LENGTH_SHORT).show(); } }); Sorry for the bad code organization, but copy and paste didn't really work out the way I imagined, Haha. Any help would be great. Also, I tried searching, but for some reason I just can't find a solution. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: RemoteService not Found
I would guess you don't have IRemoteService or ISecondary defined as a service in your androidmanifest.xml On Apr 21, 7:46 am, WildLuka [EMAIL PROTECTED] wrote: hi, I've trying to run the RemoteService example in the ApiDemo but I'm getting this error: WARN/ActivityManager(631): Unable to start service Intent { action=test.remote.IRemoteService }: not found and WARN/ActivityManager(631): Unable to start service Intent { action=test.remote.ISecondary }: not found can someone tell what I've done wrong ? thanks in advance luka --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: RemoteService not Found
I haven't worked with aidl, but just looking at the docs gives me a good idea. Yes, you would have an interface to the service, but the service itself is what gets defined in the manifest. On Apr 21, 1:51 pm, WildLuka [EMAIL PROTECTED] wrote: Well, what I did was read the AIDL tutorial and run the RemoteService and RemoteServiceBinding examples. The way I undestood it was that interfaces are interfaces to a service, and that's the thing you declare in the AndroidManifest.xml. you bind to the service and through the ServerConnection callback you get one or more interfaces to the service. how would you declare an interface in the AndroidManifex.xml ? thank you On Apr 21, 9:06 pm, Dan U. [EMAIL PROTECTED] wrote: I guess I don't quite understand. How exactly are you trying to start an interface? On Apr 21, 9:41 am, WildLuka [EMAIL PROTECTED] wrote: but the only service to declare would RemoteService, the class that extends Service. Those two are just interfaces. i didn't think I had to declare them as services in the android manifest. On Apr 21, 5:35 pm, Dan U. [EMAIL PROTECTED] wrote: I would guess you don't have IRemoteService or ISecondary defined as a service in your androidmanifest.xml On Apr 21, 7:46 am, WildLuka [EMAIL PROTECTED] wrote: hi, I've trying to run the RemoteService example in the ApiDemo but I'm getting this error: WARN/ActivityManager(631): Unable to start service Intent { action=test.remote.IRemoteService }: not found and WARN/ActivityManager(631): Unable to start service Intent { action=test.remote.ISecondary }: not found can someone tell what I've done wrong ? thanks in advance luka --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Help with Hello Android
The first time you run the emulator I guess is the slowest (or so I've heard). Also, if you don't have a reasonably fast machine, it will be slow. I'm not sure how debugging is. I almost never use debuggers. On Apr 12, 11:13 pm, jamiros [EMAIL PROTECTED] wrote: So if I wait a while the knight rider will close and I'll have my app running?? if this is the loading of the emulator man... it's kinda slow... I wonder how debugging will be :S On Apr 8, 12:11 pm, Joe Braga [EMAIL PROTECTED] wrote: Ah! I got it to work. I was just being impatient. Thanks for the information everyone. Joe --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Please Help on Example / Tutorial by Reto Meier
It looks like his example has the user actually typing in some coordinate data to the notes field for a contact. It'd be hard to give you sample code in that case. It really depends on what they have written in the notes. It could be the recipe for bushs baked beans for all you know, but let's assume you tell the user to input in the form: latitude,longitude. All you'd do is read the notes and then coords.split(,); along with casting those values to a number of some sort. From there, I'd guess loc is just a Location built with that coords data. On Apr 12, 4:43 pm, navdev [EMAIL PROTECTED] wrote: Hi I have seen this Tutorial by Reto Meier athttp://blogoscoped.com/archive/2007-11-19-n27.html A part of code says to process the lat/long from the coordinates ... [ Process the lat/long from the coordinates ] ... ... [ Storing their location under variable loc ] ... Can some one tell me what exactly this means and what I should do, can you show me a sample code? Thanks NavidAC --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Network connections in android
That wasn't quite what I was expecting. I'm not sure what you would use for rmi. I thought you were talking about connections to something like a webserver. On Apr 9, 11:30 pm, Analdin Judy [EMAIL PROTECTED] wrote: In java we use import java.rmi.Remote; import java.rmi.RemoteException; for network application na? What are the header files we have to use in android? Thanks judy --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Zoom button not displaying
I am not able to figure out how exactly to make the zoom slider pop up every time I click on that small circle on the center of the map. So are you trying to do both a click and a key press? I'm not sure what the code is for keypress, but you don't need to click the center of the map. Just click AND hold for a bit anywhere on the screen. On Apr 9, 10:47 am, marioneil [EMAIL PROTECTED] wrote: Hi I am developing a map application. I am trying to zoom the map using the slider that pops up when I click on the small circle on the center of the map. However it pops up only occasionally. Is there a way to make it pop up from a key board shortcut cut. I am not able to figure out how exactly to make the zoom slider pop up every time I click on that small circle on the center of the map. I have seem some demos where the zoom is done without clicking on the screen. It is done using the buttons on the phone. Does anyone know how to do this? Regards and thanks in advance Mario --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Network connections in android
Just like you do them in regular 'ole java. On Apr 7, 11:42 pm, Analdin Judy [EMAIL PROTECTED] wrote: Hi, Can anybody please tell me.how to do network connections in android? Thanks judy --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Help with Hello Android
You need to wait for the emulator to start up. On Apr 8, 8:08 am, Joe Braga [EMAIL PROTECTED] wrote: I am having trouble getting the simple Hello Android to run properly on my system. I followed the standard tutorial available here:http://code.google.com/android/intro/hello-android.html. From what I can tell, I followed every step to the T. When I run the app, the Android emulator pops up, however instead of displaying, Hello Android as shown in the documentation, it simply displays Android, with a blinking underscore, in the middle of the phone's screen. Here is the code that I am using: package com.android.hello; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); TextView tv = new TextView(this); tv.setText(Hello, Android); setContentView(tv); } } The Eclipse console displays: [2008-04-08 10:07:29 - Hello Android] -- [2008-04-08 10:07:29 - Hello Android] Android Launch! [2008-04-08 10:07:29 - Hello Android] adb is running normally. [2008-04-08 10:07:29 - Hello Android] Launching: com.android.hello.HelloAndroid [2008-04-08 10:07:29 - Hello Android] Automatic Target Mode: launch emulator. [2008-04-08 10:07:29 - Hello Android] Launching a new emulator. [2008-04-08 10:07:30 - Hello Android] New emulator found: emulator- tcp- Once I close the emulator: [2008-04-08 10:07:32 - Hello Android] emulator-tcp- disconnected! Cancelling 'com.android.hello.HelloAndroid' launch! I am using the M5 SDK. Any help would be greatly appreciated. Thanks in advance. Joe --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Eclipse stuck at 19%
It's been discussed many times here in the groups. It is a bug and I don't think there is a fix out yet. On Apr 8, 9:56 am, Luca Bedogni [EMAIL PROTECTED] wrote: Hello on Linux I've got a strange problem. When I try to run my project in Eclipse, it starts fine the emulator, but after that, when launching an application, eclipse remain at 19% of Launching Delegate, and nothing is shown on the emulator. Any idea? TIA Bedo --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Android Application Error
Doh!, yep, you are right. On Apr 8, 11:12 am, Raul Bocter [EMAIL PROTECTED] wrote: actualy, it is the other way around. Your object is an EditText and you try to cast it to something else. String maybe ? regards, Raul On Mon, Apr 7, 2008 at 11:50 PM, Dan U. [EMAIL PROTECTED] wrote: I don't believe that's the problem. Probably you are casting something to an EditText, but it's not an EditText. It looks like a hello world application, so perhaps it is a TextView? On Apr 7, 1:37 pm, Chris B. [EMAIL PROTECTED] wrote: I have been making this program that has a user input their name and then click the ok button. Now I want to use the buttons. I used the onClickListener code and after using code from one of the API demos i get an Application Error. The error says: Application Error: com.android An error has occurred in com.android. Unable to start activity ComponentInfo{com.android/com.android.HelloWorld}: java.lang.ClassCastException: Landroid/widget/EditText;. I think it has to do something with it saying Landroid but I don't know. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Eclipse stuck at 19%
Xavier, The 19% apparently is just how far eclipse says it gets while doing a deploy of the app to the emulator. I notice Luca is using Linux. I think most of the 19% problems have been on Windows. Have you been able to reproduce this on Windows? On Apr 8, 11:27 am, Xavier Ducrohet [EMAIL PROTECTED] wrote: Hi, I'm trying to track this problem down, but I have yet to reproduce it. Could you give me the content of the android console when it's stuck like this? (I don't update the progress percent so I don't know what 19% is all about) thanks! Xav On Tue, Apr 8, 2008 at 9:56 AM, Luca Bedogni [EMAIL PROTECTED] wrote: Hello on Linux I've got a strange problem. When I try to run my project in Eclipse, it starts fine the emulator, but after that, when launching an application, eclipse remain at 19% of Launching Delegate, and nothing is shown on the emulator. Any idea? TIA Bedo --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: openFileOutput questions / clarifications
1. Should be /data/data/com.organization.android.app.myapplication/ files/test.txt 2. I think it is possible to use normal file i/o code (by normal, I mean not using openFileOutput) to do this. 3. There isn't anything stopping another app from reading it. 4. I found this: http://blogs.sun.com/manveen/entry/blob_vs_file_system_storage which might give you an idea, although I don't really agree with all of it. For example: # The whole point of storing data in a SQL database, is to put some kind of ordering and structure on your data, as well as being able to search on these data. But how do you search in the # binary data of a picture? That's what other columns in the table are for. Just because a column is there doesn't mean you need to search with it. On Apr 8, 12:04 pm, Kevin Tan [EMAIL PROTECTED] wrote: hi, I have been reading the android file storage and content provider documentations and have few questions that was unanswered. I did a few searches alternating around the words ' android file storage methods' and can the only result that i find useful is the documentation that i have been reading which is this.http://code.google.com/android/devel/data.html Here are my questions, lets say that my application package is com.organization.android.app.myapplication 1) Where is the file stored in android by default if I am to create a new file named test.txt with this openFileOutput(test.txt, MODE_WORLD_READABLE); 2) The documentation of the openFileOutput says that the name parameter cannot contain path separators, so does that mean that I cannot specify where to place my file in the application? Or is there another way to specify where i want my files? 3) If i set the file mode to MODE_WORLD_READABLE, what is stopping an outside application from using the path to read it? 4) sqlite3 supports byte data types (called blob) but the contentprovider tutotial recommends that we store a string that represents the path of the file instead, why is that? Any answer or suggestion is greatly appreciated 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: openFileOutput questions / clarifications
I think you should use relative addressing. As I recall, the files location for your application is not set in stone. It may change. A content provider is a way to give access to your data from other applications or let your data access other applications data. I suppose since the MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE flags lets another app access your file, you wouldn't have to use a content provider, but I suppose it would be discouraged to do it this way. I'm not sure if there is an easy way to change the flag. I haven't seen one. I don't think I'd manipulate the file data. I think maybe just opening the file for output with a different flag would do it. Either that or maybe you'd have to get the file contents, then delete and re-create it with the new flag. On Apr 8, 2:16 pm, Kevin Tan [EMAIL PROTECTED] wrote: Thank you for your reply. I have a few more questions. 1. Should be /data/data/com.organization.android.app.myapplication/ files/test.txt When I am implementing the contentprovider for myapplication, the path of a file in the database will be this? Or should I use relative addressing? 3. There isn't anything stopping another app from reading it. So the content provider is just a convenient way to access data from our application? Also, I have not noticed a function to change the mode of an existing file. Is there a way to change the mode? Or do I have to actually manipulate bytes in the file to do that? On Apr 8, 3:32 pm, Dan U. [EMAIL PROTECTED] wrote: 1. Should be /data/data/com.organization.android.app.myapplication/ files/test.txt 2. I think it is possible to use normal file i/o code (by normal, I mean not using openFileOutput) to do this. 3. There isn't anything stopping another app from reading it. 4. I found this:http://blogs.sun.com/manveen/entry/blob_vs_file_system_storage which might give you an idea, although I don't really agree with all of it. For example: # The whole point of storing data in a SQL database, is to put some kind of ordering and structure on your data, as well as being able to search on these data. But how do you search in the # binary data of a picture? That's what other columns in the table are for. Just because a column is there doesn't mean you need to search with it. On Apr 8, 12:04 pm, Kevin Tan [EMAIL PROTECTED] wrote: hi, I have been reading the android file storage and content provider documentations and have few questions that was unanswered. I did a few searches alternating around the words ' android file storage methods' and can the only result that i find useful is the documentation that i have been reading which is this.http://code.google.com/android/devel/data.html Here are my questions, lets say that my application package is com.organization.android.app.myapplication 1) Where is the file stored in android by default if I am to create a new file named test.txt with this openFileOutput(test.txt, MODE_WORLD_READABLE); 2) The documentation of the openFileOutput says that the name parameter cannot contain path separators, so does that mean that I cannot specify where to place my file in the application? Or is there another way to specify where i want my files? 3) If i set the file mode to MODE_WORLD_READABLE, what is stopping an outside application from using the path to read it? 4) sqlite3 supports byte data types (called blob) but the contentprovider tutotial recommends that we store a string that represents the path of the file instead, why is that? Any answer or suggestion is greatly appreciated Kevin- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: problrm in calling activity/plz do solve his problem i am running out of time...
It looks like you are asking 3 questions. My answers... 1. I don't understand why you need to call one activity from your others. 2. You could add a logo either by adding a imageview to every layout, or you could extend a layout class that has an imageview in it, then just specify that layout view in your layout xml (instaed of whatever your top level container view is). 3. I think you might want to look at Gallery. On Apr 7, 2:54 am, ambresh [EMAIL PROTECTED] wrote: hi folks,i am working on project whc consist of around 20-25 screens... in all the screens i have to call one common activityi am not getting how to do it(i mean to say ,in each screen about screen has to called).. 2:i want to add company logo to all the screen,can any one plz guide me how to do that. 3after capturing images from camera wnt arrange them in tumbnails on to the nxt screen. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Android Application Error
I don't believe that's the problem. Probably you are casting something to an EditText, but it's not an EditText. It looks like a hello world application, so perhaps it is a TextView? On Apr 7, 1:37 pm, Chris B. [EMAIL PROTECTED] wrote: I have been making this program that has a user input their name and then click the ok button. Now I want to use the buttons. I used the onClickListener code and after using code from one of the API demos i get an Application Error. The error says: Application Error: com.android An error has occurred in com.android. Unable to start activity ComponentInfo{com.android/com.android.HelloWorld}: java.lang.ClassCastException: Landroid/widget/EditText;. I think it has to do something with it saying Landroid but I don't know. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Embed audio file !
Try removing the prepare() call. I'm using m5 and having that call in your example caused it to break on me. On Apr 6, 1:24 am, LE THANH TUNG [EMAIL PROTECTED] wrote: Still having the problem. On Fri, Apr 4, 2008 at 10:34 PM, LE THANH TUNG [EMAIL PROTECTED] wrote: I use m3, is this the problem ? On Fri, Apr 4, 2008 at 10:28 PM, LE THANH TUNG [EMAIL PROTECTED] wrote: Hi ! I follow exactly the instruction from http://code.google.com/android/toolbox/apis/media.htmlto embed media file. I created raw in res then add android.wmv and use the following code to embed it. I don't know why it show R.raw cannot be resolved. How to resolve ? ... showAudio(this); ... void showAudio(Context context) { InputStream is = this.getResources().openRawResource(R.raw.android); MediaPlayer mp = MediaPlayer.create(context, R.raw.android); mp.prepare(); mp.start(); } Thanks for help ! -- Many thanks and regards LÊ THANH TÙNG Da Nang, Vietnam -- Many thanks and regards LÊ THANH TÙNG Da Nang, Vietnam -- Many thanks and regards LÊ THANH TÙNG Da Nang, Vietnam --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: best way to setup 3 buttons
Yes, that's expected behavior for fill_parent. It fills what's left in the parent which means it pushes other things out of view. I think you could accomplish what you want by specifying a layout_weight on button 2. On Apr 6, 8:46 am, Rahul [EMAIL PROTECTED] wrote: ok i am having trouble with my current layout. I want to set this up so that there are 3 buttons on one line. The first button on the left should be a set width, and the second button should fill the remaining space, and the third button should be a set width. basically this- button 1button 2button 3 XXX===XXX full width of android window right now I am using a LinearLayout but the problem is once we set button 2 to fill_parent, button 3 never shows up --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Problems running the emulator (error: com.google.android.phone is not responding)
I don't think there's much you can do. You will have to allow for a long boot time or upgrade your hardware. I've heard complaints about boot times being 20-30 minutes, but that may have been just the first boot. On Apr 6, 6:41 am, Jakob Bjerre Jensen [EMAIL PROTECTED] wrote: Hello Digit, Thanks for your answer, and you are right: I ran on a CPU with 1 GHz and 500 MB RAM. However I fail to find any system requirements related to CPU and RAM in the documentation System and Software Requirements. I only complied to the Windows XP requirement. Perhaps it would be an idea to state hardware requirements as well? Anything I can do to run the emulator on a 1 GHz CPU with 500 MB RAM? Allow longer first-boot time? Best regards, Jakob Bjerre Jensen On Apr 6, 1:52 am, Digit [EMAIL PROTECTED] wrote: for the record, Eclipse and the plugin are totally un-necessary for developing Android applications. they just provide a better environment but you should be able to use all the tools available in $SDK/tools from the command-line to package run and debug your Android applications. I do that routinely when benchmarking emulator binaries on different PCs. now, the very first time you launch the emulator on a clean PC, the boot sequence will be longer because the system will build various caches. any boot after than should be faster. the Application not responding dialog you see is just a symptom of having a very long boot sequence (at the moment, the Application Manager is not too sharp and considers that the Home application is not responding because the CPU was taken by other processes during the long boot sequence). now, why the boot sequence is long on your machine can be from two things: - you're running on a low-end CPU (by today's standards of course, i.e. anything 2 real GHz or with 1MB L1 cache would qualify) - there are probably some bad dependency / race conditions in our boot sequence that make the system_server crash in a loop during the boot on some machines. it's unfortunately something we could not reproduce. On Sun, Apr 6, 2008 at 1:10 AM, Jakob Bjerre Jensen [EMAIL PROTECTED] wrote: Hello, I have problems running the emulator on a completely clean PC only with the following installed: 1. extract android-sdk_m5-rc15_windows.zip into a folder. 2. navigate to the tools folder and execute emulator. I.e. no Elipse Plug-in etc. installed. First the emulator screen appears as normal, then however it hangs for five minutes or so, finally the following error occurs: Application Not Responding. The application com.google.android.phone is not responding. I have done quite a lot of coding on a Windows Vista without any problems. The problem occurs on a Windows XP Home Edition (if that makes any difference). Are there other tasks necessary to do (e.g. installing Eclipse + ADT) in order to run the emulator? Best regards, Jakob Bjerre Jensen- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Most basic UI crash
Your layout file is in m3 format. http://code.google.com/android/migrating/m3-to-m5/m5-api-changes.html On Apr 6, 6:05 am, Jason Tai [EMAIL PROTECTED] wrote: Hi, Keep getting Unable to start activity...ComponentInfo{...}java.lang.NullPointerException error. Tried couple of basic examples from web, same problem: Actual Code: public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.enter_device_name); final Button button = (Button) findViewById(R.id.okButt); // *** // If I remove the bottom statement, I can see the UI display; a textedit and a abutton. // The line below causes the crash. // *** button.setOnClickListener( new Button.OnClickListener() { public void onClick(View v) { } } ); } XML: ?xml version=1.0 encoding=utf-8? RelativeLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=fill_parent android:background=#FFFEE9 android:padding=10px TextView id=@+id/nameLab android:layout_width=fill_parent android:layout_height=wrap_content android:text=Type your name/ EditText id=@+id/yourName android:layout_width=fill_parent android:layout_height=wrap_content android:layout_below=@id/nameLab/ Button id=@+id/okButt android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentRight=true android:layout_marginLeft=10px android:text=OK android:layout_below=@id/yourName/ /RelativeLayout SDK: m5. Emulator using HVGA-P. Also tried to use a dialog box. Also crashes when I call setOnClickListener. BTW, the 'okButt' button always display on top of the 'yourName' edit box, isn't it suppose to be 'layout_below'? Other XML that I copied from some example exibit the same behavior. Any clue? Cheers... Jason Tai --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Who has the specific document about XML layout files ?
This might sound like a smart-ass comment, but have you tried reading the api docs? Nearly everything related to layouts and related xml is explained. Just look for the class you want to know about (FrameLayout for instance): http://code.google.com/android/reference/index.html On Apr 6, 4:45 am, wolf [EMAIL PROTECTED] wrote: The andbook(version release.002) also does not provide these information. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Make a button reset a program
I've heard there is supposed to be some functionality coming in a future sdk to close an application. So I guess maybe in code you would make a close call (or whatever they call the method), then a startActivity call. If you wanted to do the same thing in the current sdk, you'd probably have to unwind the activity stack by using finish() calls in all your onActivityResult methods. On Apr 6, 11:33 am, Rahul [EMAIL PROTECTED] wrote: How would i go about making a button restart a program entirely? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: readonly singleline TextView and text which doesn't fit there completely
A few days ago someone was doing some things with formatting text in a textview and it was suggested he look at SpannableString and SpannableStringBuilder. I've looked at the docs, but those classes are still quite confusing to me, but maybe they would do something useful for you. On Apr 6, 8:12 am, Selmi [EMAIL PROTECTED] wrote: is it possible to find out which portion of text is visible, so i can alter it if it doesn't fit completely? or even better, is it possible to set textview somehow to such behaviour, that in case when text doesn't fit there completely it will show only beginning of text and append ... to the end? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: m5 not working
There's quite a few people using m5 successfully, myself included. I don't know what else to tell you. If you want to email me your test app, I'll run it in my environment, but I don't think that will help much. On Apr 6, 12:35 pm, wamoc [EMAIL PROTECTED] wrote: Ok, on the windows machine I didn't try anything with CVS, just to get m5 to work. I downloaded eclipse and put the program files in C:/ program files/eclipse. I downloaded m5 and put the folder in C:/. In eclipse I installed the plugins with the directions on the android site. I then restarted eclipse and went to properties and told it the location of the m5 version of the sdk. I created a new android project (to test things) and R.java was created no problems. I then modified a file (main.xml) and when eclipse rebuilt the project, R.java disappeared. I tried cleaning the project, going to android tools and fixing project properties, basically anything that people recommended to get m5 to work on a project. Nothing would fix it. This is the exact same problem that my Ubuntu machine is having, it can create an initial R.java, but when it needs updating, it will no longer create it. I have tried the same steps on both of cleaning and whatnot to try to fix it. I am out of ideas on what to do. I know it is not just my computer/os, because 2 computers with different operating systems both having the same problems seems odd. It seems to me that the m5 release is pretty broken. On Apr 6, 12:42 pm, Dan U. [EMAIL PROTECTED] wrote: Wow. That sucks. My first inclination is that CVS is related. When you tried this on Windows, were you opening the project from a copy you got out of CVS? If it's not CVS, could you explain the exact steps you took to install everything on the Windows machine? On Apr 6, 10:08 am, wamoc [EMAIL PROTECTED] wrote: Ok, I installed eclipse, the plugins and the sdk on my windows machine, and the same problem is happening. Everything with this computer is a completely clean install for android and eclipse things. Any idea why this is happening? The first machine tried on was a laptop running Ubuntu Gutsy, eclipse 3.2 (did try upgrading to 3.3) originally running m3 but updated to run m5 Second machine tried on was a pc running Windows XP Pro, eclipse 3.3 running m5 (completely clean install, nothing for eclipse or android was ever on this comp). On Apr 6, 12:27 am, wamoc [EMAIL PROTECTED] wrote: Ok, I tried installing Eclipse Europa, and that didn't fix it. Tomorrow I will try to do this on my windows machine (shudder) and hope it works. On Apr 5, 10:19 pm, Dan U. [EMAIL PROTECTED] wrote: I think your development environment must be messed up. If I do a clean, R.java goes away, then regenerates immediately. Your eclipse version is ok according to the docs, but maybe you should try getting 3.3. It seems Ubuntu has been giving people problems, so it might be related. On Apr 5, 8:31 pm, wamoc [EMAIL PROTECTED] wrote: Ok, I tried copying everything over to a new project and it made an initial R.java. When I did a clean of the project, the R.java disappeared again. Why can't m5 seem to do anything with R.java except create an initial one? On Apr 5, 5:17 pm, Dan U. [EMAIL PROTECTED] wrote: I recall some other people having this problem and importing to a new project was a solution. Like you said, having it in cvs makes copying to a new project painful. Probably some config file somewhere doesn't get updated. I haven't seen a list of all the changes to various files between m3 and m5. If you can find one, you would know what files to look at. You could also consider creating two default projects, one in m3 and one in m5, then running a diff on them. On Apr 5, 2:26 pm, wamoc [EMAIL PROTECTED] wrote: Ok, I have figured out one thing, It wont generate the R.java for existing projects, but it will for new ones. The project I am working on is in a cvs repository, so I can't just try copying the source over to a new project. On Apr 5, 3:14 pm, wamoc [EMAIL PROTECTED] wrote: I just tried that and it still wont generate R.java. I double checked the paths in Eclipse to make sure they were looking to the right areas, and they are. Later today I will try this on a different computer and hope that that works. If any body else has any ideas, I would greatly appreciate hearing them because I do most of my work on this computer. On Apr 4, 1:42 pm, Xavier Ducrohet [EMAIL PROTECTED] wrote: Hi, Look athttp://code.google.com/android/intro/upgrading.html See item 5 Update
[android-beginners] Re: need to learn java
I recommend the core java books. They are reasonably priced and written well. On Apr 6, 3:19 pm, Vames [EMAIL PROTECTED] wrote: Can anyone tell me how i can learn how to develop in java? where to go, what tutorial to use etc. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: need to learn java
I personally think it's one of the easier languages to learn, but then again I've been working with Java for nearly 8 years. One reason I say it's simple is that it's fairly easy to read. This does make code quite a bit more verbose though. Just make sure you start out simple. Make sure you write the obligatory Hello World application, then move on to more advanced things. There are people on the groups here that jumped right into developing against Android without knowing Java at all. That's not a great idea. On Apr 6, 10:13 pm, Vames [EMAIL PROTECTED] wrote: thanks everyone, i will check those out. another question, i am fairly new to programming in general so is it too hard to learn java? On Apr 6, 7:39 pm, tim jones [EMAIL PROTECTED] wrote: Free Java tutorial http://java.sun.com/docs/books/tutorial/information/download.html On Sun, Apr 6, 2008 at 5:45 PM, Dan U. [EMAIL PROTECTED] wrote: I recommend the core java books. They are reasonably priced and written well. On Apr 6, 3:19 pm, Vames [EMAIL PROTECTED] wrote: Can anyone tell me how i can learn how to develop in java? where to go, what tutorial to use etc. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Null Pointer Exception !
Without seeing the code, it's quite difficult to find the problem. On Apr 4, 12:38 am, LE THANH TUNG [EMAIL PROTECTED] wrote: Hi I tried to fix my null pointer exception 3 days but I don't success, please help me. I have 2 classes Resume_grammar.java and Resume_reading_java in 2 differrent packages, same code but different widget id. The Resume_grammar runs well but the Resume_reading get Null Pointer Exception. All variables are private and default, no inheritance. All id are unique... Is there any possible coming from Android ?, or please help me if you can guess a cause for me to check. I spent 3 whole days but not find the cause. -- Many thanks and regards LÊ THANH TÙNG Da Nang, Vietnam --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Null Pointer Exception !
The problem is that you have an id attribute in your result_reading.xml of id=cau_10_answer_reading instead of id=@+id/ cau_10_answer_reading. There is also a similar problem with result_listening.xml and result_vocabulary.xml On Apr 4, 1:09 am, LE THANH TUNG [EMAIL PROTECTED] wrote: I can send you my application folder if you want to ! On Fri, Apr 4, 2008 at 2:57 PM, LE THANH TUNG [EMAIL PROTECTED] wrote: Thank you Dan. It's nice. I just try not to bother you. Please see Resume_reading.java (I don't post grammar.java in another package because it runs well) *Resume.java :* package com.google.tung.englishtest.reading; import com.google.tung.englishtest.R; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class Resume_reading extends Activity { static char[] AnswerList = new char[10]; char[]RightAnswerList = new char[]{'a','c','c','a','b','c','a','b','c','b'}; TextView[]AnswerTextView = new TextView[10]; TextView ResultTextView; TextView Right_Answer_Number; protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.result_reading); setAnswerList(); setAnswerListTextView(); ResultTextView = (TextView)this.findViewById(R.id.result_reading_passed); Right_Answer_Number = (TextView)this.findViewById(R.id.number_right_answer_reading); setResult(); Button ReviewButton = (Button)findViewById(R.id.button_review_reading); ReviewButton.setOnClickListener(reviewClick); Button takeAnotherPartButton = (Button)findViewById(R.id.take_another_part_reading); takeAnotherPartButton.setOnClickListener(takeAnotherPart); } private void setAnswerList() { //assign AnswerList[10] AnswerList[0] = Cau_1_reading.getCau_1_Answer(); AnswerList[1] = Cau_2_reading.getCau_2_Answer(); AnswerList[2] = Cau_3_reading.getCau_3_Answer(); AnswerList[3] = Cau_4_reading.getCau_4_Answer(); AnswerList[4] = Cau_5_reading.getCau_5_Answer(); AnswerList[5] = Cau_6_reading.getCau_6_Answer(); AnswerList[6] = Cau_7_reading.getCau_7_Answer(); AnswerList[7] = Cau_8_reading.getCau_8_Answer(); AnswerList[8] = Cau_9_reading.getCau_9_Answer(); AnswerList[9] = Cau_10_reading.getCau_10_Answer(); } private void setAnswerListTextView() { // Identify TextView on Your answer: column AnswerTextView[0]=(TextView)this.findViewById(R.id.cau_1_answer_reading); AnswerTextView[1]=(TextView)this.findViewById(R.id.cau_2_answer_reading); AnswerTextView[2]=(TextView)this.findViewById(R.id.cau_3_answer_reading); AnswerTextView[3]=(TextView)this.findViewById(R.id.cau_4_answer_reading); AnswerTextView[4]=(TextView)this.findViewById(R.id.cau_5_answer_reading); AnswerTextView[5]=(TextView)this.findViewById(R.id.cau_6_answer_reading); AnswerTextView[6]=(TextView)this.findViewById(R.id.cau_7_answer_reading); AnswerTextView[7]=(TextView)this.findViewById(R.id.cau_8_answer_reading); AnswerTextView[8]=(TextView)this.findViewById(R.id.cau_9_answer_reading); AnswerTextView[9]=(TextView)this.findViewById(R.id.cau_10_answer_reading); // Display answer in Your answer: column for(int i=0;i=9;i++){ AnswerTextView[i].setText(Character.toString(AnswerList[i])); } } private void setResult() { //Display result : Passed or not Passed int Result = 0; for(int i=0;i=9;i++){ if (AnswerList[i] == RightAnswerList[i]) {Result++;} } if (Result=5) {ResultTextView.setText(Passed);} else {ResultTextView.setText(Not passed);}; Right_Answer_Number.setText(Integer.toString(Result)); } private OnClickListener reviewClick = new OnClickListener() { public void onClick(View v) { //Here we start the next activity Intent intent = new Intent(); intent.setClass(Resume_reading.this, Cau_1_reading.class); startActivity(intent); finish(); } }; private OnClickListener takeAnotherPart = new OnClickListener() { public void onClick(View v) { // Here we start the next activity Intent intent = new Intent(); intent.setClass(Resume_reading.this,com.google.tung.englishtest.Introduction.class); startActivity(intent); finish(); } }; } *result_reading.xml* : ?xml version=1.0 encoding=utf-8?
[android-beginners] Re: need help in debugging/making sense of this code
Do you know if the database had previously been created? I'm thinking it did when you tested the notepad tutorial and therefore the DATABASE_CREATE never gets executed. Try wiping the data on the emulator. On Apr 3, 1:05 pm, Kevin Tan [EMAIL PROTECTED] wrote: hi, I got an error on the emulator saying that the table new was not found. From the debugger, I notice that the program never entered the catch block, and therefore the table is not created. I borrowed this code from the notepad tutorial and it worked fine when i did the tutorial. Does anyone know what else I could be missing? private static final String DATABASE_NAME = test; private static final String DATABASE_TABLE = new; public FileShareDbAdapter open() throws SQLException { try { mDb = mCtx.openDatabase(DATABASE_NAME, null); } catch (FileNotFoundException e) { //this was never entered even if i change the DATABASE_NAME to anything else try { mDb = mCtx.createDatabase(DATABASE_NAME, DATABASE_VERSION, 0, null); mDb.execSQL(DATABASE_CREATE); } catch (FileNotFoundException e1) { throw new SQLException(Could not create database); } } return this; } --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Android app communicating with the outside
I don't know if the source for the android tools has been made available or will be made available, but that would be something to watch for in the future if you needed some way to write to your computers hard drive. You could also try to use the sdcard. There might be a way to mount it in your computer. That way, you could write to the sdcard from your client code, then access it in your computer. /data/data/your.app.namespace/files/out.txt is on the emulator file system. You can log in with adb shell or you can copy the file from the emulator with adb pull. So with your http post, you were using the actual ip address of your computer in the url? That should work. On Apr 1, 10:48 pm, yizhao [EMAIL PROTECTED] wrote: I can't write to the C: drive?! That sucks. Are there any other alternatives? I need the Android app to relay info to the outside world (app write data that outside programs consume). These are the two ways I came up with : ). When I said I couldn't find this file, I meant the computer file system. How do I access /data/data/your.app.namespace/files/ out.txt? Can an independent java program be able to read from this file? As for the http post, from an independent client, it works (I had to of course change 0.0.2.2 to localhost). The post hits a webapp implemented in Web Works. I have this code sitting inside the onCreate() method of an Activity. It doesn't give any on screen exceptions. Just no result on the server side. Thanks again, Yi On Apr 2, 1:24 am, Dan U. [EMAIL PROTECTED] wrote: ok, here's my advice: - You won't be able to write to your c: drive afaik. - You can't find the file on the file system? Do you mean your computers file system or the emulators file system? It should be on the emulator in /data/data/your.app.namespace/files/out.txt. - I don't think there would be a permissions problem for either the file or http examples you gave. - Your http post code looks ok at first glance. Are you getting any exceptions with it? Why do you need to write something to C: anyway? Are you working on some kind of development tool? On Apr 1, 9:54 pm, yizhao [EMAIL PROTECTED] wrote: Hi everyone, I have an app that needs to write to a file that is accessible from programs outside of Android. The snippet of code is as follows: OutputStreamWriter osw = new OutputStreamWriter( openFileOutput( out.txt, MODE_WORLD_READABLE ) ); osw.write( picture taken: + picId ); osw.flush(); osw.close(); Android doesn't allow me to write to the outside, for example the C: drive and I'm not able to find this file anywhere on the file system. I'm guessing its some kind of permissions problem. I would like to be able to write to anywhere on the file system I want. Is that possible? Also, since what I tried above didn't work, I also tried writing a Http Post and posting the info to a webapp. This code works independently but when put inside an Activitie's onCreate() method, it doesn't work. Again, I'm guessing it has to do with permissions: String data = URLEncoder.encode( signinUserAccount.userName, UTF-8 ) + = + URLEncoder.encode(a, UTF-8); data += + URLEncoder.encode(signinUserAccount.password, UTF-8) + = + URLEncoder.encode(b, UTF-8); URL url = new URL(http://10.0.2.2:8080/GoogleCamAF/ userAccountView.action); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); Any advice would be greatly appreciated! Yi --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Android app communicating with the outside
ok, here's my advice: - You won't be able to write to your c: drive afaik. - You can't find the file on the file system? Do you mean your computers file system or the emulators file system? It should be on the emulator in /data/data/your.app.namespace/files/out.txt. - I don't think there would be a permissions problem for either the file or http examples you gave. - Your http post code looks ok at first glance. Are you getting any exceptions with it? Why do you need to write something to C: anyway? Are you working on some kind of development tool? On Apr 1, 9:54 pm, yizhao [EMAIL PROTECTED] wrote: Hi everyone, I have an app that needs to write to a file that is accessible from programs outside of Android. The snippet of code is as follows: OutputStreamWriter osw = new OutputStreamWriter( openFileOutput( out.txt, MODE_WORLD_READABLE ) ); osw.write( picture taken: + picId ); osw.flush(); osw.close(); Android doesn't allow me to write to the outside, for example the C: drive and I'm not able to find this file anywhere on the file system. I'm guessing its some kind of permissions problem. I would like to be able to write to anywhere on the file system I want. Is that possible? Also, since what I tried above didn't work, I also tried writing a Http Post and posting the info to a webapp. This code works independently but when put inside an Activitie's onCreate() method, it doesn't work. Again, I'm guessing it has to do with permissions: String data = URLEncoder.encode( signinUserAccount.userName, UTF-8 ) + = + URLEncoder.encode(a, UTF-8); data += + URLEncoder.encode(signinUserAccount.password, UTF-8) + = + URLEncoder.encode(b, UTF-8); URL url = new URL(http://10.0.2.2:8080/GoogleCamAF/ userAccountView.action); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); Any advice would be greatly appreciated! Yi --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: android.net.http.RequestQueue - API Docs?
My guess is that if it's not documented, it's not supported and may be taken out in the next release. On Mar 29, 12:38 pm, r2d2 [EMAIL PROTECTED] wrote: Hi, I don't seem to find the API docs for the android.net.http.RequestQueue class. In fact I don't find the android.net.http package here at all: http://code.google.com/android/reference/packages.html In my code, the import android.net.http.RequestQueue does not complain. So I assume this class is a part of the API just that it's missing in the API docs. The only sample code that I found using this API is a posting by plusminus here:http://www.anddev.org/doing_http_post_with_android-t492.html Am I missing something? Thanks, R2D2 --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: XML: Can you create a button with a variable text field?
I think for that you'd have to set it programmatically. On Mar 27, 6:38 pm, Lita Cho [EMAIL PROTECTED] wrote: Hi. This is my first time posting and I am kind of a novice with XML. So I want several classes to use an this XML layout with several buttons. However, depending on the class, I want the text of the buttons to say different things with different functionality. Is there a way to display a button with varying text depending on a class that is using the layout? Any help would be greatly appreciated! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---