Re: [android-developers] Help me get this code working!!

2016-01-31 Thread Chuck Crisler
The error says it all and is clear. The class ProcessRegister *MUST*
contain a method doinBackground. This is simple Java. Read about abstract
classes/interfaces and you will understand.

On Sat, Jan 30, 2016 at 4:11 PM, Jetlabb Service  wrote:

> I am still new to android development, as well as Java. I was following a
> tutorial on how to make a login, and I am using some of their code right
> now, but I can't get this to work at all. I am getting a lot of errors.
>
> The errors I am getting are:
>
> Method does not override method from its superclass
> Class "ProcessRegister" must either be declared abstract or implement
> abstract method 'doInBackground(params) in AsycTask
>  NOTE: THE SAME GOES FOR class NetCheck
>
> Hopefully someone can help me, because I have no clue what I am doing
> wrong here...
>
> import android.app.Activity;
> import android.app.PendingIntent;
> import android.app.ProgressDialog;
> import android.content.Context;
> import android.content.Intent;
> import android.drm.ProcessedData;
> import android.net.ConnectivityManager;
> import android.net.NetworkInfo;
> import android.os.AsyncTask;
> import android.os.Bundle;
> import android.view.View;
> import android.widget.Button;
> import android.widget.EditText;
> import android.widget.TextView;
>
> import wishlist.com.gimme.library.UserFunctions;
>
> import org.json.JSONException;
> import org.json.JSONObject;
>
> import java.io.IOException;
> import java.net.HttpURLConnection;
> import java.net.MalformedURLException;
> import java.net.URL;
>
>
> public class PasswordReset extends Activity {
>
> private static String KEY_SUCCESS = "success";
> private static String KEY_ERROR = "error";
>
> EditText email;
> TextView alert;
> Button resetpass;
>
> /**
>  * Called when the activity is first created.
>  */
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
>
> setContentView(R.layout.passwordreset);
>
> Button login = (Button) findViewById(R.id.bktolog);
> login.setOnClickListener(new View.OnClickListener() {
> public void onClick(View view) {
> Intent myIntent = new Intent(view.getContext(), Login.class);
> startActivityForResult(myIntent, 0);
> finish();
> }
>
> });
>
> email = (EditText) findViewById(R.id.forpas);
> alert = (TextView) findViewById(R.id.alert);
> resetpass = (Button) findViewById(R.id.respass);
> resetpass.setOnClickListener(new View.OnClickListener() {
> @Override
> public void onClick(View view) {
>
> NetAsync(view);
>
> }
>
> });}
>
> private class NetCheck extends AsyncTask
>
> {
> private ProgressDialog nDialog;
>
> @Override
> protected void onPreExecute(){
> super.onPreExecute();
> nDialog = new ProgressDialog(PasswordReset.this);
> nDialog.setMessage("Loading..");
> nDialog.setTitle("Checking Network");
> nDialog.setIndeterminate(false);
> nDialog.setCancelable(true);
> nDialog.show();
> }
>
> @Override
> protected Boolean doInBackground(String... args){
>
> ConnectivityManager cm = (ConnectivityManager) 
> getSystemService(Context.CONNECTIVITY_SERVICE);
> NetworkInfo netInfo = cm.getActiveNetworkInfo();
> if (netInfo != null && netInfo.isConnected()) {
> try {
> URL url = new URL("http://www.google.com;);
> HttpURLConnection urlc = (HttpURLConnection) 
> url.openConnection();
> urlc.setConnectTimeout(3000);
> urlc.connect();
> if (urlc.getResponseCode() == 200) {
> return true;
> }
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> return false;
>
> }
> @Override
> protected void onPostExecute(Boolean th){
>
> if(th == true){
> nDialog.dismiss();
> new ProcessRegister().execute();
> }
> else{
> nDialog.dismiss();
> alert.setText("Error in Network Connection");
> }
> }
> }
>
> private class ProcessRegister extends AsyncTask {
>
> private ProgressDialog pDialog;
>
> String forgotpassword;
> @Override
> protected void onPreExecute() {
> super.onPreExecute();
> forgotpassword 

[android-developers] Help me get this code working!!

2016-01-30 Thread Jetlabb Service
I am still new to android development, as well as Java. I was following a 
tutorial on how to make a login, and I am using some of their code right 
now, but I can't get this to work at all. I am getting a lot of errors.

The errors I am getting are:

Method does not override method from its superclass
Class "ProcessRegister" must either be declared abstract or implement 
abstract method 'doInBackground(params) in AsycTask
 NOTE: THE SAME GOES FOR class NetCheck

Hopefully someone can help me, because I have no clue what I am doing wrong 
here...

import android.app.Activity;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.drm.ProcessedData;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import wishlist.com.gimme.library.UserFunctions;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;


public class PasswordReset extends Activity {

private static String KEY_SUCCESS = "success";
private static String KEY_ERROR = "error";

EditText email;
TextView alert;
Button resetpass;

/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.passwordreset);

Button login = (Button) findViewById(R.id.bktolog);
login.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), Login.class);
startActivityForResult(myIntent, 0);
finish();
}

});

email = (EditText) findViewById(R.id.forpas);
alert = (TextView) findViewById(R.id.alert);
resetpass = (Button) findViewById(R.id.respass);
resetpass.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

NetAsync(view);

}

});}

private class NetCheck extends AsyncTask

{
private ProgressDialog nDialog;

@Override
protected void onPreExecute(){
super.onPreExecute();
nDialog = new ProgressDialog(PasswordReset.this);
nDialog.setMessage("Loading..");
nDialog.setTitle("Checking Network");
nDialog.setIndeterminate(false);
nDialog.setCancelable(true);
nDialog.show();
}

@Override
protected Boolean doInBackground(String... args){

ConnectivityManager cm = (ConnectivityManager) 
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnected()) {
try {
URL url = new URL("http://www.google.com;);
HttpURLConnection urlc = (HttpURLConnection) 
url.openConnection();
urlc.setConnectTimeout(3000);
urlc.connect();
if (urlc.getResponseCode() == 200) {
return true;
}
} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return false;

}
@Override
protected void onPostExecute(Boolean th){

if(th == true){
nDialog.dismiss();
new ProcessRegister().execute();
}
else{
nDialog.dismiss();
alert.setText("Error in Network Connection");
}
}
}

private class ProcessRegister extends AsyncTask {

private ProgressDialog pDialog;

String forgotpassword;
@Override
protected void onPreExecute() {
super.onPreExecute();
forgotpassword = email.getText().toString();

pDialog = new ProgressDialog(PasswordReset.this);
pDialog.setTitle("Contacting Servers");
pDialog.setMessage("Getting Data ...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}

@Override
protected JSONObject doInBackground(String... args) {

UserFunctions userFunction = new UserFunctions();
JSONObject json =