LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 July 20 2014

geekevo
Member

Android Application

Well I've been trying to set up an Android app which sends a complain along with a name, a phone number and email using eclipse. I have no programming knowledge and i can't seem to get the examples off of the internet working. I've been trying for a couple of days now and I don't think i will be able to do it without working on my knowledge from zero but i don't have the time for that because i took on this project as a sort of bet.
The first problem i'm facing is that i have no idea where i should send the collected data, but i thought i'll figure this out later and jumped to the next step which i believe is setting up the httpclient. but even though i added the httpclient jar to the library i keep getting cannot be resolved as a type.
Any help,tips, or links to guides would be appreciated.

Offline

#2 July 20 2014

Johnaudi
Member

Re: Android Application

How about you send a PHP POST query? Since it's just a complaint.

Offline

#3 July 20 2014

Joe
Member

Re: Android Application

@geekevo: You will not get any kind of meaningful help with a post like yours. It's almost impossible to know what you're doing wrong and what you should do to get what you want. The simplest way to help us help you is to show us a piece of code, explain how you run it, and show us the error message you get, or if you don't have any, show us the result you get and tell us what's the result you expected.

If you really want to do your part, give us an SSCCE.

Offline

#4 July 20 2014

geekevo
Member

Re: Android Application

Well I wanted to use the HTTP post request so I created the class and imported the library .
I then copied this sample code into my mainactivity.java

code wrote:

public class HTTPHelp{
         HttpClient httpclient = new DefaultHttpClient();
         HttpPost httppost = new HttpPost("http://example.com/mypage.php");
           try {
         List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(4);

         nameValuePairs.add(new BasicNameValuePair("fname", "vinod"));
         nameValuePairs.add(new BasicNameValuePair("fphone", "1234567890"));
         nameValuePairs.add(new BasicNameValuePair("femail", "abc@gmail.com"));
         nameValuePairs.add(new BasicNameValuePair("fcomment", "Help"));
         httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
         httpclient.execute(httppost);

The code however keeps giving me httpclient can't be resolved to a type, a google search for my problem told that i wasn't importing the library but that isn't the case.

Last edited by geekevo (July 20 2014)

Offline

#5 July 20 2014

Johnaudi
Member

Re: Android Application

All of these aren't in a method, how are you executing them?

At least use a constructor if the class isn't static.

Offline

#6 July 20 2014

rtp
Member

Re: Android Application

i guess the moral of the story is to never take on bets you are not sure you can win  plus the house always wins (i had to add this)

the guy already stated he has no knowledge of programming and you are throwing "constructor" and "static" at him lol

Last edited by rtp (July 20 2014)

Offline

#7 July 20 2014

Johnaudi
Member

Re: Android Application

rtp wrote:

i guess the moral of the story is to never take on bets you are not sure you can win  plus the house always wins (i had to add this)

the guy already stated he has no knowledge of programming and you are throwing "constructor" and "static" at him lol

With all due respect, but if he has no knowledge with programming then why did he start Java programming and Android development at first glance? Giving him a copy/paste solution isn't what will get him to learn most-likely, searching of the meaning of these words will help him out.

@OP If you're not much interested in programming and only want that one application, just IM or PM me via the forum, I'll do it for you.

Last edited by Johnaudi (July 20 2014)

Offline

#8 July 20 2014

rtp
Member

Re: Android Application

geekevo wrote:

I have no programming knowledge...i took on this project as a sort of bet.

Offline

#9 July 20 2014

geekevo
Member

Re: Android Application

rtp lesson learned, I thought it would be simple as in i just had to pick up some samples from the internet. Didn't work out too well.

Last edited by geekevo (July 20 2014)

Offline

#10 July 21 2014

rtp
Member

Re: Android Application

geekevo wrote:

rtp lesson learned, I thought it would be simple as in i just had to pick up some samples from the internet. Didn't work out too well.

its ok to admit defeat and move on, not all battles can be won... learn to choose them wisely

Last edited by rtp (July 21 2014)

Offline

#11 July 21 2014

hussam
Member

Re: Android Application

It is normal for people who have not been exposed to computer programming to just assume everything is procedural at first glance. That means place things in a file and they get executed in that order. The concept of object oriented programming doesn't exist yet in their minds.

Last edited by hussam (July 21 2014)

Offline

#12 September 25 2014

Odaym
Member

Re: Android Application

OP I don't know if you've managed to run this yet but when you do it's going to crash with a NetworkOnMainThread exception; use AsyncTask

Offline

#13 September 26 2014

Johnaudi
Member

Re: Android Application

Odaym wrote:

OP I don't know if you've managed to run this yet but when you do it's going to crash with a NetworkOnMainThread exception; use AsyncTask

Giving full rights prioritized to the Main Thread won't give you the need to use ASyncTask.

Offline

#14 October 24 2014

Odaym
Member

Re: Android Application

Johnaudi wrote:
Odaym wrote:

OP I don't know if you've managed to run this yet but when you do it's going to crash with a NetworkOnMainThread exception; use AsyncTask

Giving full rights prioritized to the Main Thread won't give you the need to use ASyncTask.

full rights prioritised to the main thread? Not sure I understood that, could you give an example?

Offline

Board footer