[Q] sysfs in android? - Java for Android App Development

Hi, Im trying to get the value of "/sys/class/power_supply/batter/current_now" in my app and display it on a textbox, how can i do that in android?! i tried doing it myself and failed! im not good at java, i mostly use C++/C and python!
I found a few code.google links but i can't accesses any dev/code.google websites ! they're forbidden in my country!

Related

Making Ultimate Search suitable for more countries

Hello,
I'm using the "Ultimate Search" Application ( http://www.gx-5.com/products/ultimatesearch ) and I really like it. It's a great help in my everyday situations when I want to search for something real quick.
Sadly the Application is more or less designed for the US. Dictionary, News, Movies, etc. functions are searching on US-specific sites, so that I cant really use those functions as a German. The bad thing about the application is, that you cant edit the sites the program searches at. So my wish would be for example: that I can change the "google function" from searching at google.com to google.de,... or the "news function" from yahoo.com to n24.de, and so on.
Would it be illegal to modify the program? Does anybody know how to do that?
Best
Don

HTTP Server on WM6

Hi Guys!
I'd like to create a webserver on wm6 so I can contact to Localhost (127.0.0.1) to retrieve Phone info.
Purpose is a Flash app which uses GPS and Camera (Those or not accessable with actionscript)
I want the server to put GPS and Camera information on the localhost.
I know Freestyl (aka WhoNeedsAnIphone) uses a http server to pass some device variables to their flash app. But the project stopt and no code was released.
For Nokia Phone there's a Tool called KuneriLite to acces phone info with Flash.
I Also found Depeche But I don't really understand it....
Any Help/Code/App is welcome.
Jeff
Hi, take a look here: http://goahead.com/products/webserver/download.aspx
I played around with it some time ago.
It has a lot of features like cgi and so on.
Nice Solution....
It Works but im more into C# then C++..
Is there a C# solution for this?
All help is welcome
Depending on how many of the HTTP verbs you really need to support (ie, do you just want to respond to a HTTP get for a certain url?) you could knock up a simple HTTP server in C# in an hour or two tops.
There's tonnes of examples of simple HTTP servers in C# on the web...
Sounds good,
But i'm only able to find C# webservers for PC, not for windows mobile...
The only thing the server has to do is respond from the code, so i dont have to load actual ASP/HTML pages...
Just a listener on Localhost, if i request localhost/req?GetVar=Cam
I can do something like WriteRespone("Cam=" + SomeSysVar)
Here you go
Attached is a C# simple http server application that I knocked up based on the MSDN sample at http://msdn.microsoft.com/en-us/library/bb397809.aspx.
I've not tested it on a phone.
The sample is for the compact framework.
Should work without any hassle.
Complete source included and the simplest parsing possible (currently responds to a http GET request for / with a chunk of HTML with "1" as the body).
Good luck, have fun.
(Oh and I just noticed there's a confusingly commented out line that says "write response" in the source, remove / ignore it.)
You can test the windows app from a web browser by pointing at http://localhost:83
edit:
apologies, i meant to close another thread.
Thnx Alot
Found this solution: http://bansky.net/blog/2007/10/compact-web-server-in-compact-framework/
It Worked for me ;-)
That looks like a good general purpose solution
My example is tailored towards specific custom processing over HTTP rather than serving of files -> in the style of a RESTful API.
From the look of it you can do a similar thing with the Compact Web server by hooking up what the author labels a "Special file type" and adding your custom handling code in there.
[edit]
That said, you could actually edit my example to File.Open whatever was passed as a parameter off the disk and stream that back to the client, providing a more standard HTTP server without configuration.
Nice simple solution u've got!
I will try to get it to work the way i want,
lookin' @ the amount of code it should be a lot faster then my previous solution.
Just noticed a very small bug. I'm refactoring the code to be a little better engineered. I'll upload a new sample shortly (you may have already managed to make use of it).
Right, I've re-engineered the code a little.
While the example now isn't contained in a single file, the source is now far more logical, readable and maintainable.
You'll notice the code that actually deals with the request is now hidden away in the HttpVerbs namespace.
Basically if you look at the file HttpGet.cs there's a good working example of how to implement whatever behaviour you like based off of a HTTP Get request to the server.
Code's pretty decent now, slightly more ready for prime time than previously, generally more type-safe and doesn't rely on string parsing all over the place.
Enjoy.
Binary?
Can you please put here binary (exe file) for Windows Mobile 6.1?
Thanks

java http to pull website data

hello guys
i am having trouble understanding how such apps work and what i need to start developing one
i've learned that you can pull website information using it's API in JSON format and display it
but if the website does not provide an API is possible to get the JSON data of any website? is it done through http request ?
i was also trying to connect my application to several news websites that keeps posting news update is it possible to read the information each time it is updated ?
and what should i know besides java to be able to connect my app to any website get information from this website and display the result regarding if it has an API or not
example : connect to a news website pull the newly posted news and display it or connect to a gaming website get the top 10 games and display them
thank you for your help
ghattas.akkad said:
hello guys
i am having trouble understanding how such apps work and what i need to start developing one
i've learned that you can pull website information using it's API in JSON format and display it
but if the website does not provide an API is possible to get the JSON data of any website? is it done through http request ?
i was also trying to connect my application to several news websites that keeps posting news update is it possible to read the information each time it is updated ?
and what should i know besides java to be able to connect my app to any website get information from this website and display the result regarding if it has an API or not
example : connect to a news website pull the newly posted news and display it or connect to a gaming website get the top 10 games and display them
thank you for your help
Click to expand...
Click to collapse
If the site you're scraping doesn't provide JSON then you can query the site using HTTP. Something like this.
Code:
URL url = new URL(target);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
InputStream in = new BufferedInputStream(connection.getInputStream());
laidlow said:
If the site you're scraping doesn't provide JSON then you can query the site using HTTP. Something like this.
Code:
URL url = new URL(target);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
InputStream in = new BufferedInputStream(connection.getInputStream());
Click to expand...
Click to collapse
thank youu
html parsing is very annoying especially when dealing with a lot of websites in a single app
i was looking for an easier method in which i can access the websites databases pull data and post it but i think if they dont have an API for that they wont give me that permission
ghattas.akkad said:
thank youu
html parsing is very annoying especially when dealing with a lot of websites in a single app
i was looking for an easier method in which i can access the websites databases pull data and post it but i think if they dont have an API for that they wont give me that permission
Click to expand...
Click to collapse
If you want an awesome library that helps you using http requests, take a look at Volley, which is really easy to use on all API levels. I didn't raed through it, but to me it sounds like you want to have some kind of RSS reader functionaly, take a look at this tutorial for instance.

[Q] a few questions about webRTC on android

hi all,
I have a few questions about webRTC on android. I can say I'm new about android and webRTC but I can also say I made tooo much research about webRTC on android. But still have a few questions. (some of them because of I'm new, and some of them because of I'm okey but not fully)
I'm trying to make an android app which is going to communicate between web browser (first choice is chrome) and android device directly (p2p we can say). So I made too much research and I found webRTC is good for me. Do you advise me something other or is it okey you think? (also I am going to code a plugin for chrome).
Nearly every document says 'android is not directly support webRTC'. So I need something to provide me webRTC on android. What it is? Is it native android that I have to code? Is it native (NDK) library that I have to include my project? Or is it a java lib? Or should I go for cordova/crosswalk or sth like that? I researched all but didn't find something can help me. Yeah there are documents about it but not enough..
Some of documents says, I need chromium. But why and how? They show me lots of linux terminal commands and even there is no a line java or C or C++ code. Even some terminal commands and links that they give is not working.
I read/found/tried these things as a result of my research:
Apache cordova
Crosswalk
http://www.webrtc.org/
https://github.com/webrtc
http://webrtc.github.io/samples/
http://simonguest.com/2013/08/06/building-a-webrtc-client-for-android/
http://orcaman.blogspot.com.tr/2014/07/building-native-android-webrtc-source.html
https://github.com/pchab/ProjectRTC
https://github.com/pchab/AndroidRTC
in a nutshell I need help. Please give me your hand. Thank you. (because I'm really very helpless and tried to do my best)
Thank you.
Any idea? Any help?

Source for learning Java

Good day, fellow forum members.
I finally decided to get my hands dirty with programming. Since i had absolutely zero knowledge about coding i thought i should start from something basic so i downloaded SoloLearn's Java app. I have used it for just about a day (or 30 minutes) and I'm already quarter way through it. I think I'll finish by the end of week without interrupting my daily life chores because
String mythoughtssofar = ("This seems quite interesting and easier than I expected")
System.out.print(mythoughtssofar)
Haha. But I am sure there is a lot more to learn than what this application is telling me. So I wanted to ask where should I start learning for real? Any books? Blogs? Forums? Anything else? I am serious about doing it so I don't mind subscribing to paid content such as Lynda .com (Suggested by friend). But I thought I should ask here for some good advice from the pros before I actually begin. Hopefully someone can show me the path. Thanks for reading!
Google " thenewboston "
Learn the Java & Mid-Java tutorials, about 120 vids, and you will be "min-expert" in java language, you will be expert over the usage .
After that, navigate to slidenerd to learn how to develope Android Apps .
Java => Android .
anyone else wants to add something? I assume this is the correct section to ask for help regarding education?
jackcarter3456 said:
You can prefer any option among books, online tutorials, videos, paid content etc to learn programming language. However, all the options are good but I personally want to suggest you to prefer the online videos instead of reading books or following tutorials.
This is because the videos are the faster way to learn than any other media. Reading the whole content takes too much time, but if you will learn from the online videos then it would be quite easier to learn and understand the concepts. I am suggesting the videos option, because I have also used it for learning Java, C and C++ and I think it is much easier to grab the concepts with the help of visual content instead of written content.
I hope you like my opinion.
Click to expand...
Click to collapse
It is true that there are a lot of different sources to learn programming languages and most of them will be good. Maybe try something that is about android programming when you are done with your java stuff
I personally prefer reading some online tutorials so i guess everyone learns best in different ways.
Check out the following links for Java tutorials:
Oracle Tutorial
tutorialspoint Tutorial
thenewboston video Tutorials Beginner
thenewboston video Tutorials Intermediate
mmdeveloper10 said:
Check out the following links for Java tutorials:
Oracle Tutorial
tutorialspoint Tutorial
thenewboston video Tutorials Beginner
thenewboston video Tutorials Intermediate
Click to expand...
Click to collapse
ive noticed some of his code is out of date and gives me errors is there an easier/simple way to fix them?
Veid71 said:
ive noticed some of his code is out of date and gives me errors is there an easier/simple way to fix them?
Click to expand...
Click to collapse
What link are you referring to? I gave 4 links. And could you please quote the code that is out of date? And what errors do you get? Please be more specific. How can we suggest you how to fix something if we don't know what it is?
mmdeveloper10 said:
What link are you referring to? I gave 4 links. And could you please quote the code that is out of date? And what errors do you get? Please be more specific. How can we suggest you how to fix something if we don't know what it is?
Click to expand...
Click to collapse
sorry the new boston youtube ones ive gotten stuck on video #10 and video #14 on 14 it doesnt even give me an error code it just refuses to launch
02-17 21:14:26.655 2867-2867/com.example.veid71.floatinginterface4 I/art: Not late-enabling -Xcheck:jni (already on)
02-17 21:14:26.746 2867-2867/com.example.veid71.floatinginterface4 W/System: ClassLoader referenced unknown path: /data/app/com.example.veid71.floatinginterface4-1/lib/x86
02-17 21:14:26.894 2867-2867/com.example.veid71.floatinginterface4 D/AndroidRuntime: Shutting down VM
02-17 21:14:26.895 2867-2867/com.example.veid71.floatinginterface4 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.veid71.floatinginterface4, PID: 2867
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.veid71.floatinginterface4/com.example.veid71.floatinginterface4.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.support.v7.widget.Toolbar.getTitle()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.support.v7.widget.Toolbar.getTitle()' on a null object reference
at android.support.v7.widget.ToolbarWidgetWrapper.<init>(ToolbarWidgetWrapper.java:98)
at android.support.v7.widget.ToolbarWidgetWrapper.<init>(ToolbarWidgetWrapper.java:91)
at android.support.v7.app.ToolbarActionBar.<init>(ToolbarActionBar.java:73)
at android.support.v7.app.AppCompatDelegateImplV7.setSupportActionBar(AppCompatDelegateImplV7.java:205)
at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:99)
at com.example.veid71.floatinginterface4.MainActivity.onCreate(MainActivity.java:28)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)*
at android.app.ActivityThread.-wrap11(ActivityThread.java)*
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)*
at android.os.Handler.dispatchMessage(Handler.java:102)*
at android.os.Looper.loop(Looper.java:148)*
at android.app.ActivityThread.main(ActivityThread.java:5417)*
at java.lang.reflect.Method.invoke(Native Method)*
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)*
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)*
on video #10 and on this video i get this error for this line "cannot resolve symbol setonclicklistener" "cannot resolve symbol view" "variable onclick is never used"
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
public void onClick(View view); {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
I also discovered SOLOLEARN which I found so far useful. I'm in the same boat as you xlife18
Start with tutorialsguide and go to the android section, they explain it from beginners up
Had same issues with bostons videos. He wasnt using the oncreate default code that needed to be written for android. Thats what i discovered to be the issue. For alot of my errors.

Categories

Resources