• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

New android app help

durkinnj

Lurker
I only know C++ but I need to make a simple android app. I need it to access a web page that I created which displays text. From the text, the app will know what to display. All the app will be is buttons. If a button is pressed, all it does is sends an http request to my site which tells it to do something. It basically just accesses the website. So for example, if you hit the button names "ON" it would, in the background, go to mywebsite dot com slash on. The server will know what to do once it gets that request. I have already got that side working. I tested it with my phone by just using a web browser but I want to be able to do it better by using an application with simple buttons where it does everything in the background. Now as I was saying about reading the text.. the app should read the text from mywebsite dot com and change the UI accordingly. So if the text it reads in says off, it knows to gray out the off button and enable the on button. This is all very simple but I do not know how to make this work and I need some guidance. I have downloaded everything and have eclipse up and running but I am not sure what to do. Any help will be greatly appreciated.
 
See link: Andromo - Make an Android App. No Coding Required.
I used this before it changed hands a couple years ago. It is a non-code app generator. I haven't used it for quite a while but once you learned your way around it worked very nicely. I was able to create an app the played a short video from a person in your contact list, shot them a quick predefined text or sent a Help message to who ever you defined. It really wasn't that hard. Might work for what your trying to do.
 
I realize this may not be the proper thread, but I wanted to give the user a lending hand as I would be able to help the user with this, you will want to use onClick event handlers in eclipse for the buttons and setEnabled(true/false) on that.. for example your buttons are called myOnBtn and myOffBtn, and you used the same onClick for both buttons (on/off)

public void onClick(View v) { // On click handler for buttons
switch (v.getId()) // Gets the ID of the clicked button
{
case R.id.myOffBtn: // The ID's are effectively integers so great case statements
((Button)findViewById(R.id.myOffBtn)).setEnabled(false); // Set off button to disabled
((Button)findViewById(R.id.myOnBtn)).setEnabled(true); // Set on button to enabled
(new RequestTask()).execute(someURL); // Make web request
break;
case R.id.myOnBtn:
((Button)findViewById(R.id.myOffBtn)).setEnabled(true);
((Button)findViewById(R.id.myOnBtn)).setEnabled(false);
(new RequestTask()).execute(someURL);
}

someURL is a string that is the URL you want to goto. As I am a new user they wont let me post links which it caught when trying to use a dummy URL to demonstrate. just make one off and on respectively.

You will have to give the application Internet permission as well as keep in mind this does not care about any returned data from the website. This is merely to make a get request.

Hope this helps!

Chris
 
Back
Top Bottom