Make sure you sign your APK before trying to use it on your phone.

http://developer.android.com/intl/fr/guide/publishing/app-signing.html


On Thu, Jan 28, 2010 at 11:48 AM, André <[email protected]> wrote:
> That worked fine!
> Thank you!
>
> Now my only problem is that my HTC Tattoo doesn't want to install the
> apk when I want to test it! =(
>
> André
>
> On Jan 28, 11:19 am, Sean Hodges <[email protected]> wrote:
>> Sorry, I really wasn't on the ball yesterday :)
>>
>> What you want is:
>>
>> String TESTSTRING = bodyText.getText().toString();
>>
>> Just for a little background:
>>
>> Your bodyText object is what's called a View in Android, it contains a
>> lot more info than just the contents of the text field (such as its
>> size and appearance). To get the text in the field you need to call
>> bodyText.getText(), which will return the current text value wrapped
>> in an object called an Editable.
>>
>> The reason it returns an Editable instead of a String is fairly
>> subtle, but if you understand the concept of "immutable" objects you'd
>> have an idea to its purpose, the API describes it in more 
>> detail:http://developer.android.com/intl/fr/reference/android/text/Editable....
>>
>> Ultimately, your OutputStreamWriter needs a String to work, which we
>> can get by calling the toString() method.
>>
>> Hope it helps.
>>
>>
>>
>> On Wed, Jan 27, 2010 at 7:08 PM, André <[email protected]> wrote:
>> > Thank you.
>>
>> > I have tried to do what you wrote. Not sure if I did it right because
>> > I still get a problem. When I put String TESTSTRING = bodyText.getText
>> > (); inside of the onClick method I get a red line under
>> > bodyText.getText(). If i hold my mouse over it suggests me to change
>> > String TESTSTRING do Editable TESTSTRING. If i do that osw.write is
>> > wrong and wants to change TESTSTRING to an int.
>>
>> > Any suggestions?
>>
>> > André
>>
>> > On Jan 27, 6:36 pm, Sean Hodges <[email protected]> wrote:
>> >> Ah, something I missed before...
>>
>> >> To get the text out of your EditText view, you want to do this:
>>
>> >> String TESTSTRING = bodyText.getText();
>>
>> >> The String() class does not accept EditText objects, you need to
>> >> retrieve the string that is contained inside your bodyText object.
>>
>> >> On Wed, Jan 27, 2010 at 5:31 PM, Sean Hodges
>>
>> >> <[email protected]> wrote:
>> >> > The problem is that you are referencing a non-final variable
>> >> > ("bodyText") that is outside the scope of your View.OnClickListener()
>> >> > inner class.
>>
>> >> > You need to make bodyText final, so that it can be accessed from
>> >> > inside your anonymous inner class. You do not need to make TESTSTRING
>> >> > final, though doing so should do no harm (unless later on you try to
>> >> > re-assign it to another string).
>>
>> >> > Your code should end up looking something like this:
>> >> >http://pastebin.com/f4895dad4
>>
>> >> > Make sure you are familiar with the concepts of the final keyword. It
>> >> > is important to understand how it affects the variables you apply it
>> >> > to. In particular, take a look at the "Anonymous Inner Classes"
>> >> > section on this article:
>> >> >http://renaud.waldura.com/doc/java/final-keyword.shtml#vars.
>>
>> >> > On Wed, Jan 27, 2010 at 5:14 PM, André <[email protected]> wrote:
>> >> >> I tried that now but get the same problem.
>>
>> >> >> here is a screen shot of it:
>>
>> >> >>http://www.andreborud.com/android/android-problem-2.jpg
>>
>> >> >> André
>>
>> >> >> On Jan 27, 5:39 pm, Justin Anderson <[email protected]> wrote:
>> >> >>> Why are you using the final keyword?  I think that is the source of 
>> >> >>> your
>> >> >>> problem.  Remove that and I would be that everything will work out.
>>
>> >> >>> In java, "final" is more-or-less equivalent to "const" in c++.  Since 
>> >> >>> you
>> >> >>> are setting this variable every time a button is clicked I don't 
>> >> >>> think you
>> >> >>> want to set this to final.
>>
>> >> >>> I am curious though... what exactly is the error that you are getting?
>>
>> >> >>> ----------------------------------------------------------------------
>> >> >>> There are only 10 types of people in the world...
>> >> >>> Those who know binary and those who don't.
>> >> >>> ----------------------------------------------------------------------
>>
>> >> >>> On Wed, Jan 27, 2010 at 9:26 AM, André <[email protected]> wrote:
>> >> >>> > Hello,
>>
>> >> >>> > I'm sure there has been a lot of questions like this here already. 
>> >> >>> > But
>> >> >>> > I haven't been able to find an answer to my question is. I'm still
>> >> >>> > very new to this so it's probably something very simple.
>> >> >>> > What I am trying is to save text from a edittext window, it works 
>> >> >>> > fine
>> >> >>> > if I have a pre-written text. Any suggestion on how I should make 
>> >> >>> > this
>> >> >>> > work?
>>
>> >> >>> > Bellow you can see what I have tried! The row with the stars is what
>> >> >>> > eclipse doesn't accept.
>>
>> >> >>> > private EditText bodyText;
>>
>> >> >>> >   �...@override
>> >> >>> >    public void onCreate(Bundle savedInstanceState) {
>> >> >>> >        super.onCreate(savedInstanceState);
>> >> >>> >        setContentView(R.layout.main);
>>
>> >> >>> >        bodyText = (EditText) findViewById(R.id.body);
>> >> >>> >        Button confirmButton = (Button) findViewById(R.id.confirm);
>> >> >>> >        confirmButton.setOnClickListener(new View.OnClickListener() {
>>
>> >> >>> >                public void onClick(View view) {
>> >> >>> >                        try {
>> >> >>> >                            final String TESTSTRING = new 
>> >> >>> > String(bodyText);
>>
>> >> >>> > ***************************************************************************
>> >> >>> >  *****
>>
>> >> >>> >                            FileOutputStream fOut =
>> >> >>> > openFileOutput("samplefile.txt",
>> >> >>> > MODE_WORLD_READABLE);
>> >> >>> >                            OutputStreamWriter osw = new
>> >> >>> > OutputStreamWriter(fOut);
>>
>> >> >>> >                            osw.write(TESTSTRING);
>>
>> >> >>> >                            osw.flush();
>> >> >>> >                            osw.close();
>>
>> >> >>> >                        } catch (IOException ioe) {
>> >> >>> >                            ioe.printStackTrace();
>> >> >>> >                        }
>> >> >>> >                }
>>
>> >> >>> >            });
>> >> >>> >        }
>> >> >>> > }
>>
>> >> >>> > --
>> >> >>> > You received this message because you are subscribed to the Google
>> >> >>> > Groups "Android Beginners" group.
>>
>> >> >>> > NEW! Try asking and tagging your question on Stack Overflow at
>> >> >>> >http://stackoverflow.com/questions/tagged/android
>>
>> >> >>> > To unsubscribe from this group, send email to
>> >> >>> > [email protected]<android-beginners%2Bunsubscr
>> >> >>> >  [email protected]>
>> >> >>> > 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.
>>
>> >> >> NEW! Try asking and tagging your question on Stack Overflow at
>> >> >>http://stackoverflow.com/questions/tagged/android
>>
>> >> >> To unsubscribe from this group, send email to
>> >> >> [email protected]
>> >> >> 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.
>>
>> > NEW! Try asking and tagging your question on Stack Overflow at
>> >http://stackoverflow.com/questions/tagged/android
>>
>> > To unsubscribe from this group, send email to
>> > [email protected]
>> > 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.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> [email protected]
> 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.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to