1

i do an android Editor app for editing texts. now i wish to do these:

  1. create Widget from my app- as clicking my MainActivity/app starts.
  2. put the app in open with list- the other *.txt file can open with mine. although is it need to use read file code?

i just define a Text view and all editing buttons. i don't know how can i do this.would you please help me?

THANKS!!!

EDIT: i find this code for 2. is it enough?

<intent-filter >


<action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <data android:mimeType="application/txt" />
</intent-filter>
  • `i find this code for 2. is it enough?` No, it's **wrong**: If your app should read `txt` files, why did you set it for `pdf` files? `` should be `` – Phantômaxx May 08 '16 at 11:38
  • ok. i just copy it from internet. now what can i do? –  May 08 '16 at 13:25
  • is it ok? i update mine. –  May 08 '16 at 14:04
  • My very first comment is different: `android:mimeType="text/plain"` – Phantômaxx May 08 '16 at 14:20
  • Anyway, once your app is connected to the file type, you must write the code to read it. – Phantômaxx May 08 '16 at 14:22
  • i correct it, but it does not add to list. –  May 08 '16 at 15:35
  • would you please give me Read file code? –  May 08 '16 at 15:41
  • would you please google for that? you'll get a humongous number of results. – Phantômaxx May 08 '16 at 16:38
  • i find this 2 link, link1: http://stackoverflow.com/a/25175257/3671748 and link2: http://www.java-samples.com/showtutorial.php?tutorialid=1522 - but they are different and i don't know which one is suitable for mine? i want to open txt file anywhere from mobile's MyFile. –  May 09 '16 at 09:23
  • Not the second one, for sure. Because it only opens a file stored in the `raw` folder of your app. – Phantômaxx May 09 '16 at 09:29
  • so what about the first one? i think `!(state.equals(Environment.MEDIA_MOUNTED)` is not useful for me,is it? and another thing is that you suggest me to put related code in `ReadFile` method and call it in MainActivity/OnCreae or not? –  May 09 '16 at 09:38
  • your finds are both inappropriate for the case, I guess. You should search for a simple `android read text file` – Phantômaxx May 09 '16 at 10:20
  • why do not you want answer me completely?!. i don't have enough experience about its... i google it, but results are the same. all of them want to read a specify file and it is not my answer. –  May 09 '16 at 10:56
  • Shall I google it for you? https://www.google.com/search?q=android+read+text+file+line+by+line&oq=android+read+text+file&aqs=chrome.3.69i57j0l5.8793j0j7&sourceid=chrome&ie=UTF-8 – Phantômaxx May 09 '16 at 11:03

0 Answers0