2015-06-22 75 views
1

我試圖創建一個「聯繫人」活動,用戶可以在EditText小部件上編寫一些內容,然後按「發送」,Parse.com將創建一個文件.txt並將其上傳到我的分析類上。唯一的問題是,我實際上無法告訴腳本「閱讀」EditText中的內容。讓我告訴你:如何將Parse.com上的EditText內容?

public void send(View view)//this is the onclick "send" button 
{ 


    byte[] data = "text to send".getBytes();// In this way parse.com will write "text to send" in the .txt file. Here's the problem: i can't figure out how to tell parse to take what's in the edit text widget and write it inside the .txt. 

    ParseFile file = new ParseFile("contact.txt", data); 
    file.saveInBackground(); 

    ParseObject contacts = new ParseObject("Contacts"); 
    contacts.put("contactName", "File"); 
    contacts.put("contactResumeFile", file); 
    contacts.saveInBackground(); 
} 

有什麼想法?任何幫助將愉快地接受了:)

+0

哪裏是你編輯文本? –

+0

https://parse.com/docs/android/guide – Gunaseelan

+0

EditText editabletext; ---- oncreate ----> editabletext =(EditText)findViewById(R.id.editText2); – Thozzmass

回答

1

如果你沒有把它上傳爲.txt文件,你可以使用gettext()。toString()和然後用saveInBackground上傳()

+0

謝謝,我之前閱讀過此評論。我就是這麼做的,謝謝:D – Thozzmass