Text Viewer App Q - Android Software Development

I am 'just' getting into app development, so be gentle...
I want to build a very very simple app that opens txt files from email; and then work on formatting them myself.
Do put it simply; I don't mind doing the research- but I'm 'so' green at this I'm not sure where to start.
Code:
TextView tv = new TextView(this);
tv.setText("Hello, Android");
I assume this is the code I need to research; TextView(filenamevariable.txt)?
My question is this; how do I make my app call and display raw text from any app; for example if I open a txt file in Astro, or from an email attachment- I want my app to be the 'opening app'; Also, I need to know how to make it variable so the app will always look at whatever txt file called the app to start.
I'm OK with vague 'lmgtfy' answers- I'm just at a point where I'm not sure what code I'm looking for- some example code would be great; I really just want to play around with the way text can be displayed from an external file.

Related

Looking for a small App

Hi there, i'm asking if there is a dev out there who can write me a small app, it's nothing special if you're into android apps but i cant do that myself.
Its should be a simple SMS parser for seperated ringtones.
pseudocode would be:
Code:
if (SMS.from = 123456) {
if (SMS.text has "RD-"){
play Soundfile "Alert" until a checkbox is clicked
}
if (SMS.text has "KTR-" or "KTx-"){
play Soundfile "Transport" until a checkbox is clicked
}
else{
play Soundfile "special sms tone"
}
the sender's number should be exchangeable and if its too hard to make the soundfiles changeable, i could upload it, but exchangeable sound and text would be great
if the app works, i'm willing to donate 10 bucks to you on paypal, i think 10 bucks should be enough since i rate that problem as easy, but i cant do a android app myself (only c/c++ knowledge)
You could try your hand at using App inventor to create it yourself.
http://appinventor.googlelabs.com
i tried it, but i couldnt get it to act on an sms recieved -.-
So if I read this correctly, you need 3 different executables: a BroadcastReceiver (for the SMS events), an Activity (to configure settings) and a Service launched by the broadcast receiver to play the alert and launch a popup. Sounds doable, but not as easy as your pseudo-code above.
arthofer said:
i tried it, but i couldnt get it to act on an sms recieved -.-
Click to expand...
Click to collapse
App inventor can't generate service.
So your app need to be active to receive SMS

[Q] Question about automated reply function

Hi guys. Developing an app with a simple enough concept. I want to be able to launch an app that has a textbox that a custom string can be saved to. When an sms message is received, the string is sent back automatically as a reply. So far I have an EditText in the xml and set up shared preferences so the string stays persistent if you exit back to the apps "main menu".
I have seen alot of sample code online but am struggling to get a decent example of my specific requirement that I could implement to what I already have in place.
Can anyone advise on how I could do this with the most ease?
I have researched smsmessagingdemo.java online and it's not really what I need.
And the "simple concept" is always a "killer" for programmers as they usually end up being hard to implement! LOL Such is the case here.
The app idea is a good one; kind of like your own personal "call waiting" app for texts.
just fyi
There's already a few apps on the market that do something like this. Otterbox is one example: https://market.android.com/details?id=com.otterapp.otter I think state farm has an app that does similar.

Application idea - camera (read barcode), and send data to ip address

I want to create an application or two, and the first one I want to do must be able to:
using a "chart", assign a numeric value to various barcode symologies... 1 for UPCA, 2 Code 39, etc
Read a barcode with the camera
"decode" the barcode symbology and create a value for the scanned bc
Cache the data from the decode and symbology
open a text file
Write that barocode symbology value to a file
Write that barcode data to the file on the phone or sd card
save the change
Send the file to an ip address and port that is configured by the user.
What I can already do with terminal emulation apps (in Windows or Android apps) is log into the ip address of a embedded wireless device, and configure the device through a console. I would like to send it a script instead. By scanning a barcode from a scanboard, I could take a value from that barcode and inject it into a file that is already mostly scripted, but with the value of the barcode as the only part that is missing. Once scanned, then written to the file, it could automatically or through a button press, send the file to the ip address to configure the device.
Since some barcodes might be code 39, upca, code 128, etc, each of those barcodes must be programmed into my script. So if I scan a code 39 barcode, the script might call that a value of 2, and then I place that 2 in my script along with the data in the code 39 barcode. With 2 variables always in play, type of barcode and data from the barcode read, that's what always has to be in the script.
Now for the hard part, at least for me. I have been working with App Inventor, and found that they do not have a TCP module, and do not believe that AI is where I should be to make this app. My question is for anyone familiar with programming TCP/sockets, or whatever other networking name it would be called, and another form of programming for the creation of this type of app. I am already working in Eclipse, and the learning curve for me is high because of the lack of time I am able to spend with the beast of a utility. As much as I would love to build this app myself, I would consider paying someone to create it for me as long as I could have the source and continue to modify it after the fact and call it my own. PM me your price, but please remember that I have an ex wife that is already bleeding me to death and that I would prefer to work on this app myself, so I am more interested in a nudge or push in the right direction to create the app.
Long of the short, it's a scanner app that allows me to inject the data read from the barcode into a text file and then send the file to an ip. if I could find a telnet app (ip and port configurability) that allowed me to send text files, I would be partially there, so instead I strive to create.
Anyone?
Thanks in advance,
Standupdad
There should be lots of tutorials on TCP/IP and URL connections you can probably google up.
That's actually the easier of the two tasks. However for scanning the barcode, you're also in luck: zxing's library for barcode and QR code scanning is opensource (and it's excellent). It will take a bit to learn how to integrate it into your app, or you can have the users download the BarcodeScanner app and just communicate from your app to the Bacrode scanner app with it with Intents.
http://code.google.com/p/zxing/

[Q] Editing an app

Hello,
I'm editing an app using APKGUI, mostly to modify the look to conform more to holo style. I would, however, like to modify it a little. It is a messaging app and i want to put pictures of those who sent the message next to the message (line in hangouts) but I can't get it to work by editing the XML. Is there any way to do this through APKGUI modifications or not?
Thanks.
Nickcu13 said:
Hello,
I'm editing an app using APKGUI, mostly to modify the look to conform more to holo style. I would, however, like to modify it a little. It is a messaging app and i want to put pictures of those who sent the message next to the message (line in hangouts) but I can't get it to work by editing the XML. Is there any way to do this through APKGUI modifications or not?
Thanks.
Click to expand...
Click to collapse
depends on the app but I would suspect not as you would need code to resolve from a content provider to then populate the item (ImageView) in the row. So that would be in the adapter code powering the listView in the app
deanwray said:
depends on the app but I would suspect not as you would need code to resolve from a content provider to then populate the item (ImageView) in the row. So that would be in the adapter code powering the listView in the app
Click to expand...
Click to collapse
is there any way to get into the code?
Nickcu13 said:
is there any way to get into the code?
Click to expand...
Click to collapse
yeah if it's not too obfuscated when decompiled and you know how to query a content provider and load images, maybe not doing said actions on the ui thread but on another thread.. use smart messenger instead when I'm done you will be able to create a UI to your own needs </shamelessplug>
deanwray said:
yeah if it's not too obfuscated when decompiled and you know how to query a content provider and load images, maybe not doing said actions on the ui thread but on another thread.. use smart messenger instead when I'm done you will be able to create a UI to your own needs </shamelessplug>
Click to expand...
Click to collapse
basically all i need to do is get to the coding of one section where the profile image is displayed, and copy the query into the new section. but i don't know how to do that or where to find it in the decompiled part. It's not a normal messaging app, it's more of a people discovery app with messaging haha.
Nickcu13 said:
basically all i need to do is get to the coding of one section where the profile image is displayed, and copy the query into the new section. but i don't know how to do that or where to find it in the decompiled part. It's not a normal messaging app, it's more of a people discovery app with messaging haha.
Click to expand...
Click to collapse
it is not really a copy paste and work job Or that would be like, 0.0001% probability of working
deanwray said:
it is not really a copy paste and work job Or that would be like, 0.0001% probability of working
Click to expand...
Click to collapse
and why is that?
Nickcu13 said:
and why is that?
Click to expand...
Click to collapse
cause you would possibly need the following, get the contact id from the row from xxx variable/data, construct the now unique uri to pass to a content resolver to lookup the image uri and or path, then get an instance of the row imageView (or whatever view was going to hold the image) then pass that to a loader/async/new thread along with the uri for that then to load in the background, then check that when loaded the imageView instance is still the same (due to the way android recycles views) before setting it back on the main ui thread.
So a recap on the variable/s
imageView
contact id source (of that row)
the instance and data tracking in a thread
so these things are not something you can find in one app or even from the same app and "paste" into another section.
hope that, well, makes enough sense to know it's not a copy paste thing
deanwray said:
cause you would possibly need the following, get the contact id from the row from xxx variable/data, construct the now unique uri to pass to a content resolver to lookup the image uri and or path, then get an instance of the row imageView (or whatever view was going to hold the image) then pass that to a loader/async/new thread along with the uri for that then to load in the background, then check that when loaded the imageView instance is still the same (due to the way android recycles views) before setting it back on the main ui thread.
So a recap on the variable/s
imageView
contact id source (of that row)
the instance and data tracking in a thread
so these things are not something you can find in one app or even from the same app and "paste" into another section.
hope that, well, makes enough sense to know it's not a copy paste thing
Click to expand...
Click to collapse
so if it does all that once, all i need to to is copy and paste it, then change the variables to be unique.
Nickcu13 said:
so if it does all that once, all i need to to is copy and paste it, then change the variables to be unique.
Click to expand...
Click to collapse
well no, each one of those happens for every row, also you would have to "find" the data and instances to make it happen. example would be simply finding the resource ident (integer) for the imageView and grabbing an instance of it. findViewById(R.id.someIDofImageView) but then to avoid constant findViewById lookups on recycled views you would use a viewholder pattern, that then you would create a new object class that would hold this (cause lookups for the same ident on the same row many times when scrolling would not be great)... and more stuff, and thats just for the imageView instance part... clearer ?
I guess my point would be it's more involved that you perhaps think it is. Specially if you know little or no android/java
deanwray said:
I guess my point would be it's more involved that you perhaps think it is. Specially if you know little or no android/java
Click to expand...
Click to collapse
Another thing not to forget is the APK signature. If you unpack, edit and repack an APK you must sign it, othewise the installation will fail.

Way to store Preferences

Hey Guys,
I am creating a app to rename other apps via xposed and the main code is written. Now I simply want to make a interface where you can define a app to rename and then enter a new name. For the beginning I thought about a Activity where you enter the Package Name and the desired name. Later on I want to use a list view to show all apps, from where you can choose one to rename(Like App Settings etc.). To show the renamed apps I want to use a ListView. Now I am stuck with a problem: My xposed code works with an array to check and rename. The list view can be used with an array or an arraylist, but I need a way to store the preferences(which are stored in a array).
Do you have a good idea or a sample how to realise this? And does somebody know a nice App List type of thing(I googled, but the project there aren't usable with my kind of approach.)
GalaxyInABox said:
Hey Guys,
I am creating a app to rename other apps via xposed and the main code is written. Now I simply want to make a interface where you can define a app to rename and then enter a new name. For the beginning I thought about a Activity where you enter the Package Name and the desired name. Later on I want to use a list view to show all apps, from where you can choose one to rename(Like App Settings etc.). To show the renamed apps I want to use a ListView. Now I am stuck with a problem: My xposed code works with an array to check and rename. The list view can be used with an array or an arraylist, but I need a way to store the preferences(which are stored in a array).
Do you have a good idea or a sample how to realise this? And does somebody know a nice App List type of thing(I googled, but the project there aren't usable with my kind of approach.)
Click to expand...
Click to collapse
Ah the data storage problem... I think we all came across this at least once . I suppose you read this guide on the different options available? Well there are actually three options: SharedPreferences, text or csv file and SQL.
The first one would need some work around and is probably the slowest. You would save a separate string directly into the SharedPreferences (maybe in a new file to avoid collisions?) with the array name and its index somehow in the key. That's just two methods of coding but not the nicest way to do it.
The text or csv file however is the more common way, here you'd save your array in one line of the file, each item separated with a ; or some other char. Needs a bit more coding and also the WRITE_EXTERNAL_STORAGE permission on preKitKat if I remember correctly.
The third one is the nicest and most modular one. Because it makes use of SQL it needs quite a bit of knowledge and some coding (but less than the text file).
I guess for simple things that you want to do it is better to stay away from SQL for now unless you know how to use it and use the SharedPreferences.
Edit: take a look at the answers to this question, they give you the code as well... And you can use StringSets in ICS and above if the order of your list doesn't matter !
I'd say go down the SQLite DB way, chances are that if you plan on expanding your coding knowledge and want to keep creating apps you'll be needing to learn this in the future anyway so why delay?
Google AndroidHive and look at their SQL tutorial - I used it when learning and found it very informative
Sent from my HTCSensation using Tapatalk
Thank you very much! As coming from windows, first of all I thought about SQL as well, but it seems oversized for the set of data i want to store. I also took a look at the stackoverflow thread you linked. It looks easy to implement, but the need to use an external class file made me look for another way. I found this one, which works pretty well for me, as I look forward to interchange the method of saving the data with a better one using the SharedPreferences(which actually should be really easy with my code).
Maybe you can tell me yet another thing: Is there a way of declaring an object(like the ArrayList) to make it accessible from every class except from giving every class(activity) it's own "load the preferences" and "save the preferences" code block or sending intents all over the place? This would make saving much easier and allow me to update the preferences during runtime and without a reboot
Edit: This was my answer to.SimplicityApks ^^ I'll take a closer look at SQL now, since you, Jonny, told me that it' nevertheless necessary.
GalaxyInABox said:
Thank you very much! As coming from windows, first of all I thought about SQL as well, but it seems oversized for the set of data i want to store. I also took a look at the stackoverflow thread you linked. It looks easy to implement, but the need to use an external class file made me look for another way. I found this one, which works pretty well for me, as I look forward to interchange the method of saving the data with a better one using the SharedPreferences(which actually should be really easy with my code).
Maybe you can tell me yet another thing: Is there a way of declaring an object(like the ArrayList) to make it accessible from every class except from giving every class(activity) it's own "load the preferences" and "save the preferences" code block or sending intents all over the place? This would make saving much easier and allow me to update the preferences during runtime and without a reboot
Edit: This was my answer to.SimplicityApks ^^ I'll take a closer look at SQL now, since you, Jonny, told me that it' nevertheless necessary.
Click to expand...
Click to collapse
Welcome
You mean you want to make your ArrayList, which is an instance variable in the activity, accessible to every other class within your package without having an instance of your activity at hands? Well the basic solution would be to make the ArrayList static. But that is not recommended because it won't be created and garbage collected at the same time as your activity and also it's not a nice way .
If you had an instance of the activity it would be just using a public getter for it, but without I'd put your ArrayList into a separate class following the Singleton pattern. That way you have only one global instance which contains the ArrayList.
Thanks again for your reply! I changed my mind about the ArrayList and created a method, where everything is stored in the SharedPreferences and the ArrayList's only purpose is the use with the ListView and Adapter. This way I don't have to write the ArrayList to the SharedPreferences and changes will be much easier to control. Although I had to implement another type of save/load method to interact with the class thats being loaded by xposed. That was needed because of the restriction that you can only load SharedPreferences with a context, which my class doesn't have. It's an inconvenient way, but it works

Categories

Resources