I just want to sort my data by using sort and compare two value.
Here is my code:
ArrayAdapter arrayAdapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_list_item_1, myData);
arrayAdapter.sort(myData, new Comparator<myData>() {
#Override
public int compare(myData o1, myData o2) {
return Integer.compare(o1.getFinalScore(), o2.getFinalScore());
}
});
arrayAdapter.notifyDataSetChanged();
dataList.setAdapter(arrayAdapter);
But I got the error said sort(java.util.Comparator) in ArrayAdapter cannot be applied to (java.lang.string[], anonymousjava.util.Comparator)
Can anyone tell what is the problem??
myData class
public class myData {
public int getFinalScore() {
return finalScore;
}
public void setFinalScore(int finalScore) {
this.finalScore = finalScore;
}
private String customeName;
private String carName;
private String appointmentDate;
private String email;
private String issueDescribe;
private String timeForJob;
private String costForJob;
private String reliableOnCar;
private String distanceJob;
private int finalScore;
public myData(String customeName, String carName, String appointmentDate, String email, String issueDescribe, String timeForJob, String costForJob,
String reliableOnCar, String distanceJob, int finalScore) {
this.customeName = customeName;
this.carName = carName;
this.appointmentDate = appointmentDate;
this.email = email;
this.issueDescribe = issueDescribe;
this.timeForJob = timeForJob;
this.costForJob = costForJob;
this.reliableOnCar = reliableOnCar;
this.distanceJob = distanceJob;
this.finalScore = finalScore;
}
}
If you look at the sort() documentation for an ArrayAdapter, you can see that it takes only one argument, a comparator.
So you have to update your code like this :
arrayAdapter.sort(new Comparator<myData>() {
#Override
public int compare(myData o1, myData o2) {
return Integer.compare(o1.getFinalScore(), o2.getFinalScore());
}
});
Hope it helps !
Related
The String variable finalMapSearchUrl gets concatenated with another String (mapUrlParam) in the constructor and the Log shows the expected value : Final map URL : https://www.google.com/maps/search/?api=1&query=Spilia%20Beach (here the mapUrlParam = Spilia Beach). However, when i call the getMapSearchUrl() method from outside the class and monitor the Log, the finalMapSearchUrl's value is now back to the default https://www.google.com/maps/search/?api=1&query=. Log in getMapSearchUrl() : finalMapSearchUrl = https://www.google.com/maps/search/?api=1&query=. Any ideas on when,why and how it's value is not preserved outside of the constructor?
PlaceObject.java class:
public class PlaceObject implements Parcelable { // Implementing the Parcelable interface to allow for cleaner and faster code
private static final String TAG = PlaceObject.class.getSimpleName();
private static final String baseMapSearchUrl = "https://www.google.com/maps/search/?api=1&query="; // Base url for launching a Map activity with a Search Intent
// Using int so that the values can be accessed via R.string etc.
private int name;
private int description;
private int category;
private String locationDistance;
private String finalMapSearchUrl = baseMapSearchUrl;
PlaceObject(int name, int description, int category , String locationDistance, String mapUrlParam) {
this.name = name;
this.description = description;
this.locationDistance = locationDistance;
this.category = category;
finalMapSearchUrl += Uri.encode(mapUrlParam);
Log.d(TAG,"Final map URL : " + finalMapSearchUrl);
}
private PlaceObject(Parcel in) {
name = in.readInt();
description = in.readInt();
locationDistance = in.readString();
category = in.readInt();
}
public static final Creator<PlaceObject> CREATOR = new Creator<PlaceObject>() {
#Override
public PlaceObject createFromParcel(Parcel in) {
return new PlaceObject(in);
}
#Override
public PlaceObject[] newArray(int size) {
return new PlaceObject[size];
}
};
#Override
public int describeContents() {
return 0;
}
#Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(name);
parcel.writeInt(description);
parcel.writeString(locationDistance);
parcel.writeInt(category);
}
public int getName() {
return name;
}
public int getDescription() {
return description;
}
public String getLocationDistance() {
return locationDistance;
}
public int getCategory() {
return category;
}
public String getMapSearchUrl() {
Log.d(TAG,"finalMapSearchUrl = " + finalMapSearchUrl);
return finalMapSearchUrl; //TODO:sp figure out why the variable's value gets lost after the constructor is done
}
}
Because you're simply getting the base url and not the one Parceled.
Solution:
Add it to parcel and pay attention to the order of writing,
Like this:
private PlaceObject(Parcel in) {
name = in.readInt();
description = in.readInt();
category = in.readInt();
locationDistance = in.readString();
finalMapSearchUrl = in.readString();
}
and don't forget to fix this as well:
#Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(name);
parcel.writeInt(description);
parcel.writeInt(category);
parcel.writeString(locationDistance);
parcel.writeString(finalMapSearchUrl);
}
i'm writing a function to create xls sheets from JFXTableView.
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet("user details");
XSSFRow header = sheet.createRow(0);
String arrayOfHeaders [] = {"Sr. No.","Name of the Member", "Customized workout card status","Contact No.","Current programme taken","Current package taken",
"Purpose of taking customized workout card", "body type identified"," Current Body weight","Current height","payment amount",
"Mode of payment"};
for(int i=0; i<arrayOfHeaders.length; i++){
header.createCell(i).setCellValue(arrayOfHeaders[i]);
}
int index=1;
for(Member item: tableView.getItems()){
XSSFRow row = sheet.createRow(index);
int cellIndex=0;
for (Method m : item.getClass().getMethods()) {
// The getter should start with "get"
// I ignore getClass() method because it never returns null
if (m.getName().startsWith("get") && !m.getName().equals("getClass")) {
row.createCell(cellIndex).setCellValue((String) m.invoke(item));
}
cellIndex++;
}
index++;
}
With the above code, i'm able to retrieve values from the table through the getters, but the problems is item.getClass().getMethods() returns getters in a random order and that is not acceptable as i want the values according to the headers as defined.
I have many such tables, each with their own Class and getters, and writing different functions for each one of them seems too lengthy. So, what i'm planning to do is write a function where i could pass on the getters of each different table object in an array, so it could loop through all the getters of the particular tableView object. Something like this:
createSheets(arrayOfHeaders, tableView.getItems(), arrayOfGetters);
The example of one such Member Class being used by my current tableView is:
public static class Member{
private final SimpleStringProperty name;
private final SimpleStringProperty status;
private final SimpleStringProperty contact;
private final SimpleStringProperty programme;
private final SimpleStringProperty packages;
private final SimpleStringProperty purpose;
private final SimpleStringProperty bodyType;
private final SimpleStringProperty weight;
private final SimpleStringProperty height;
private final SimpleIntegerProperty paymentAmount;
private final SimpleStringProperty paymentMode;
public Member (String name, String status, String contact, String programme, String packages, String purpose,
String bodyType, String weight, String height, int paymentAmount, String paymentMode){
this.name = new SimpleStringProperty(name);
this.status = new SimpleStringProperty(status);
this.contact = new SimpleStringProperty(contact);
this.programme = new SimpleStringProperty(programme);
this.packages = new SimpleStringProperty(packages);
this.purpose = new SimpleStringProperty(purpose);
this.bodyType = new SimpleStringProperty(bodyType);
this.weight = new SimpleStringProperty(weight);
this.height = new SimpleStringProperty(height);
this.paymentAmount = new SimpleIntegerProperty(paymentAmount);
this.paymentMode = new SimpleStringProperty(paymentMode);
}
public String getName() {
return name.get();
}
public String getStatus() {
return status.get();
}
public String getContact() {
return contact.get();
}
public String getProgramme() {
return programme.get();
}
public String getPackages() {
return packages.get();
}
public String getPurpose() {
return purpose.get();
}
public String getBodyType() {
return bodyType.get();
}
public String getWeight() {
return weight.get();
}
public String getHeight() {
return height.get();
}
public int getPaymentAmount() {
return paymentAmount.get();
}
public String getPaymentMode() {
return paymentMode.get();
}
}
I'm trying to deal with this baking JSON:
in android app so this is the class to bring the JSON data from link:
OpenBakingJsonUtils.java:
public final class OpenBakingJsonUtils {
public static ArrayList<ArraysLists> getSimpleBakingStringsFromJson(Context context, String bakingJsonString)
throws JSONException {
final String ID = "id";
final String NAME = "name";
final String SERVINGS = "servings";
final String INGREDIENTS = "ingredients";
final String STEPS = "steps";
final String QUANTITY = "quantity";
final String MEASURE = "measure";
final String INGREDIENT = "ingredient";
final String IDSTEPS = "id";
final String SHORTDESCRIPTION = "shortDescription";
final String DESCRIPTION = "description";
final String VIDEOURL = "videoURL";
final String THUMBNAILURL = "thumbnailURL";
ArrayList<ArraysLists> parsedRecipeData = new ArrayList<ArraysLists>();
ArrayList<BakingItem> Baking = new ArrayList<BakingItem>();
JSONArray recipeArray = new JSONArray(bakingJsonString);
for (int i = 0; i < recipeArray.length(); i++) {
int id;
String name;
int servings;
double quantity;
String measure;
String ingredient;
int idSteps;
String shortDescription;
String description;
String videoURL;
String thumbnailURL;
JSONObject recipeObject = recipeArray.getJSONObject(i);
id = recipeObject.getInt(ID);
name = recipeObject.getString(NAME);
servings = recipeObject.getInt(SERVINGS);
ArrayList<IngredientsItem> Ingredients = new ArrayList<IngredientsItem>();
JSONArray ingredientsArray = recipeObject.getJSONArray(INGREDIENTS);
for(int j = 0 ; j< ingredientsArray.length(); j++) {
JSONObject ingredientsObject = ingredientsArray.getJSONObject(j);
quantity = ingredientsObject.getDouble(QUANTITY);
measure = ingredientsObject.getString(MEASURE);
ingredient = ingredientsObject.getString(INGREDIENT);
Ingredients.add(new IngredientsItem(quantity, measure, ingredient));
}
ArrayList<StepsItem> Steps = new ArrayList<StepsItem>();
JSONArray stepsArray = recipeObject.getJSONArray(STEPS);
for(int j = 0 ; j< stepsArray.length(); j++) {
JSONObject stepsObject = stepsArray.getJSONObject(j);
idSteps = recipeObject.getInt(IDSTEPS);
shortDescription = stepsObject.getString(SHORTDESCRIPTION);
description = stepsObject.getString(DESCRIPTION);
videoURL = stepsObject.getString(VIDEOURL);
thumbnailURL = stepsObject.getString(THUMBNAILURL);
Steps.add(new StepsItem(idSteps, shortDescription, description, videoURL, thumbnailURL));
}
Baking.add(new BakingItem(id, name, servings, Ingredients, Steps));
parsedRecipeData.add(new ArraysLists(Baking, Ingredients, Steps));
}
return parsedRecipeData;
}
}
as you see there are 3 ArrayList classes:
ArrayList<BakingItem>
ArrayList<IngredientsItem>
ArrayList<StepsItem>
and this is the code for each one:
BakingItem.java:
public class BakingItem implements Parcelable {
private int id;
private String name;
private int servings;
private ArrayList<IngredientsItem> ingredients = new ArrayList<IngredientsItem>();
private ArrayList<StepsItem> steps = new ArrayList<StepsItem>();
public BakingItem(int id, String name, int servings, ArrayList<IngredientsItem> ingredients, ArrayList<StepsItem> steps) {
this.id = id;
this.name = name;
this.servings = servings;
this.ingredients = ingredients;
this.steps = steps;
}
#Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(id);
out.writeString(name);
out.writeInt(servings);
out.writeTypedList(ingredients);
out.writeTypedList(steps);
}
private BakingItem(Parcel in) {
this.id = in.readInt();
this.name = in.readString();
this.servings = in.readInt();
ingredients = new ArrayList<IngredientsItem>();
in.readTypedList(ingredients, IngredientsItem.CREATOR);
}
public BakingItem() {
}
#Override
public int describeContents() {
return 0;
}
public static final Parcelable.Creator<BakingItem> CREATOR = new Parcelable.Creator<BakingItem>() {
#Override
public BakingItem createFromParcel(Parcel in) {
return new BakingItem(in);
}
#Override
public BakingItem[] newArray(int i) {
return new BakingItem[i];
}
};
public int getId() {
return id;
}
public String getName() {
return name;
}
public int getServings() {
return servings;
}
}
IngredientsItem.java:
public class IngredientsItem implements Parcelable {
private double quantity;
private String measure;
private String ingredient;
public IngredientsItem(double quantity, String measure, String ingredient) {
this.quantity = quantity;
this.measure = measure;
this.ingredient = ingredient;
}
#Override
public void writeToParcel(Parcel out, int flags) {
out.writeDouble(quantity);
out.writeString(measure);
out.writeString(ingredient);
}
private IngredientsItem(Parcel in) {
this.quantity = in.readDouble();
this.measure = in.readString();
this.ingredient = in.readString();
}
public IngredientsItem() {
}
#Override
public int describeContents() {
return 0;
}
public static final Parcelable.Creator<IngredientsItem> CREATOR = new Parcelable.Creator<IngredientsItem>() {
#Override
public IngredientsItem createFromParcel(Parcel in) {
return new IngredientsItem(in);
}
#Override
public IngredientsItem[] newArray(int i) {
return new IngredientsItem[i];
}
};
public double getQuantity() {
return quantity;
}
public String getMeasure() {
return measure;
}
public String getIngredient() {
return ingredient;
}
}
as well as the StepsItem class
and the forth is the ArraysLists.java which contain all the 3 arrays above and returned by the OpenBakingJsonUtils.java:
Then I'm trying to call these JSON data in different activities
so in MainActivity.java in loadInBackground:
Override
public ArrayList<BakingItem> loadInBackground() {
URL recipeRequestUrl = NetworkUtils.buildUrl();
try {
String jsonBakingResponse = NetworkUtils.getResponseFromHttpUrl(recipeRequestUrl);
ArrayList<ArraysLists> simpleJsonBakingData = OpenBakingJsonUtils.getSimpleBakingStringsFromJson(MainActivity.this, jsonBakingResponse);
return simpleJsonBakingData;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
I call the returned ArrayList from OpenBakingJsonUtils.java which is in this case the ArraysLists,
then in DetailActivity.java in doInBackground:
#Override
protected ArrayList<ArraysLists> doInBackground(Object... params) {
if (params.length == 0) {
return null;
}
URL reviewsRequestUrl = NetworkUtils.buildUrl();
try {
String jsonReviewResponse = NetworkUtils.getResponseFromHttpUrl(reviewsRequestUrl);
ArrayList<ArraysLists> simpleJsonReviewData = OpenBakingJsonUtils.getSimpleBakingStringsFromJson(DetailsActivity.this, jsonReviewResponse);
return simpleJsonReviewData;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
here I call the ArrayList of ArraysLists too but the problem in adapters of MainActivity.java and DetailsActivity.java in onBindViewHolder:
holder.CommentContent.setText(String.valueOf(mCommentsItems.get(position).getQuantity()));
it just says that cannot resolve method getQuantity() which is in IngredientsItem.java while I used the ArraysLists.java that returned by OpenBakingJsonUtils.java
so what should I do to call methods from BakingItem.java and IngredientsItem.java while I use the returned ArraysLists.java ?
I'm not sure how to word this correctly, but I'd like to use this code and some others to be able to search up song results and then display its info when I select it. I've also implemented the last.fm api into my eclipse, but I am not sure where to go from there. Any advice would help. Thanks!
static final ItemFactory<Track> FACTORY = new TrackFactory();
public static final String ARTIST_PAGE = "artistpage";
public static final String ALBUM_PAGE = "albumpage";
public static final String TRACK_PAGE = "trackpage";
private String artist;
private String artistMbid;
protected String album;
private String albumMbid;
private int position = -1;
private boolean fullTrackAvailable;
private boolean nowPlaying;
private Date playedWhen;
protected int duration;
protected String location;
protected Map<String, String> lastFmExtensionInfos = new HashMap<String, String>();
protected Track(String name, String url, String artist) {
super(name, url);
this.artist = artist;
}
protected Track(String name, String url, String mbid, int playcount, int listeners, boolean streamable,
String artist, String artistMbid, boolean fullTrackAvailable, boolean nowPlaying) {
super(name, url, mbid, playcount, listeners, streamable);
this.artist = artist;
this.artistMbid = artistMbid;
this.fullTrackAvailable = fullTrackAvailable;
this.nowPlaying = nowPlaying;
}
public int getDuration() {
return duration;
}
public String getArtist() {
return artist;
}
public String getArtistMbid() {
return artistMbid;
}
public String getAlbum() {
return album;
}
public String getAlbumMbid() {
return albumMbid;
}
public boolean isFullTrackAvailable() {
return fullTrackAvailable;
}
public boolean isNowPlaying() {
return nowPlaying;
}
public String getLocation() {
return location;
}
public String getLastFmInfo(String key) {
return lastFmExtensionInfos.get(key);
public Date getPlayedWhen() {
return playedWhen;
}
public static Collection<Track> search(String track, String apiKey) {
return search(null, track, 30, apiKey);
}
public static Collection<Track> search(String artist, String track, int limit, String apiKey) {
Map<String, String> params = new HashMap<String, String>();
params.put("track", track);
params.put("limit", String.valueOf(limit));
MapUtilities.nullSafePut(params, "artist", artist);
Result result = Caller.getInstance().call("track.search", apiKey, params);
if(!result.isSuccessful())
return Collections.emptyList();
DomElement element = result.getContentElement();
DomElement matches = element.getChild("trackmatches");
return ResponseBuilder.buildCollection(matches, Track.class);
}
This question already has answers here:
Unfortunately MyApp has stopped. How can I solve this?
(23 answers)
Closed 6 years ago.
I've been trying to store doctor details in SQLite database using signup activity but my app crashes everytime i click on signup button.It shows no error. I've followed many online videos but it just doesn't work for my application
what is the error? Why does the app crash?
dsignup.java
DatabaseHelper1 helper1 = new DatabaseHelper1(this);
public void OnButton_regclick(View v)
{
if(v.getId()== R.id.button_reg)
{
EditText dname = (EditText)findViewById(R.id.dname);
EditText username = (EditText)findViewById(R.id.username);
EditText docemail = (EditText)findViewById(R.id.docemail);
EditText password = (EditText)findViewById(R.id.password);
EditText reg_num = (EditText)findViewById(R.id.reg_num);
EditText dcontact = (EditText)findViewById(R.id.dcontact);
EditText wcontact = (EditText)findViewById(R.id.wcontact);
RadioGroup gender = (RadioGroup) findViewById(R.id.gender);
int selectedid = gender.getCheckedRadioButtonId();
EditText address = (EditText)findViewById(R.id.address);
EditText pincode = (EditText)findViewById(R.id.pincode);
EditText specialization =(EditText)findViewById(R.id.specialization);
EditText experience = (EditText)findViewById(R.id.experience);
EditText category = (EditText)findViewById(R.id.category);
RadioButton rb = (RadioButton)findViewById(selectedid);
String dnamestr = dname.getText().toString();
String docemailstr = docemail.getText().toString();
String usernamestr = username.getText().toString();
String passwordstr = password.getText().toString();
String dcontactstr = dcontact.getText().toString();
String reg_numstr = reg_num.getText().toString();
String specializationstr = specialization.getText().toString();
String experiencestr = experience.getText().toString();
String categorystr = category.getText().toString();
String genderstr = rb.getText().toString();
String pincodestr = pincode.getText().toString();
String addressstr = address.getText().toString();
String wcontactstr = wcontact.getText().toString();
Contact c = new Contact();
c.setDname(dnamestr);
c.setDocemail(docemailstr);
c.setUsername(usernamestr);
c.setPassword(passwordstr);
c.setDcontact(dcontactstr);
c.setReg_num(reg_numstr);
c.setSpecialization(specializationstr);
c.setExperience(experiencestr);
c.setCategory(categorystr);
c.setGender(genderstr);
c.setPincode(pincodestr);
c.setAddress(addressstr);
c.setWcontact(wcontactstr);
helper1.insertContact(c);
}
DatabaseHelper1.java
public class DatabaseHelper1 extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "contacts.db";
private static final String TABLE_NAME1 = "doctors";
private static final String COLUMN_ID1 = "id1";
private static final String COLUMN_DNAME ="dname";
private static final String COLUMN_DCONTACT ="dcontact";
private static final String COLUMN_REG_NUM ="reg_num";
private static final String COLUMN_SPECIALIZATION ="specialization";
private static final String COLUMN_EXPERIENCE ="experience";
private static final String COLUMN_CATEGORY ="category";
private static final String COLUMN_AVAILABLEFROM ="availablefrom";
private static final String COLUMN_PASSWORD ="password";
private static final String COLUMN_USERNAME ="username";
private static final String COLUMN_AVAILABLETO ="availableto";
private static final String COLUMN_GENDER ="gender";
private static final String COLUMN_DOCEMAIL ="docemail";
private static final String COLUMN_PINCODE ="pincode";
private static final String COLUMN_ADDRESS ="address";
private static final String COLUMN_WCONTACT ="wcontact";
private static final String COLUMN_TIMETO ="timeto";
private static final String COLUMN_TIMEFROM ="timefrom";
private static final String COLUMN_LATITUDE ="latitude";
private static final String COLUMN_LONGITUDE ="longitude";
SQLiteDatabase db1;
private static final String TABLE_CREATE1 = "create table doctors (id integer primary key not null, dname text not null,reg_num integer not null , specialization text not null, experience text not null, category text not null," +
"available from text not null, username text not null, availableto text not null, gender text not null, email text not null, pincode integer not null, address text not null " +
" wcontact integer not null, timeto time, timefrom time, latitude float(10,6), longitude float(10,6));";
public DatabaseHelper1(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
#Override
public void onCreate(SQLiteDatabase db1) {
db1.execSQL(TABLE_CREATE1);
this.db1 = db1;
}
public void insertContact(Contact c) {
db1 = this.getWritableDatabase();
ContentValues values = new ContentValues();
String query = "select * from doctors";
Cursor cursor = db1.rawQuery(query , null);
int count = cursor.getCount();
values.put(COLUMN_ID1 , count);
values.put(COLUMN_DNAME, c.getDname());
values.put(COLUMN_DCONTACT, c.getDcontact());
values.put(COLUMN_REG_NUM, c.getReg_num());
values.put(COLUMN_SPECIALIZATION, c.getSpecialization());
values.put(COLUMN_EXPERIENCE, c.getExperience());
values.put(COLUMN_CATEGORY, c.getCategory());
values.put(COLUMN_AVAILABLEFROM, c.getAvailablefrom());
values.put(COLUMN_PASSWORD, c.getPassword());
values.put(COLUMN_USERNAME, c.getUsername());
values.put(COLUMN_AVAILABLETO, c.getAvailableto());
values.put(COLUMN_GENDER, c.getGender());
values.put(COLUMN_DOCEMAIL, c.getDocemail());
values.put(COLUMN_PINCODE, c.getPincode());
values.put(COLUMN_ADDRESS, c.getAddress());
values.put(COLUMN_WCONTACT, c.getWcontact());
//values.put(COLUMN_TIMETO, c.getTimeto());
// values.put(COLUMN_TIMEFROM, c.getTimefrom());
// values.put(COLUMN_LATITUDE, c.getLatitude());
//values.put(COLUMN_LONGITUDE, c.getLongitude());
db1.insert(TABLE_NAME1, null, values);
db1.close();
}
public String searchPass(String username)
{
db1 = this.getReadableDatabase();
String query = "select uname, pass from "+TABLE_NAME1;
Cursor cursor = db1.rawQuery(query , null);
String a, b;
b = "not found";
if(cursor.moveToFirst())
{
do{
a = cursor.getString(0);
if(a.equals(username))
{
b = cursor.getString(1);
break;
}
}
while(cursor.moveToNext());
}
return b;
}
#Override
public void onUpgrade(SQLiteDatabase db1, int oldVersion, int newVersion) {
String query = "DROP TABLE IF EXISTS "+TABLE_NAME1;
db1.execSQL(query);
this.onCreate(db1);
}
}
Contact.java
public class Contact {
String name ,email,uname,pass,gender1,dname,dcontact,reg_num,specialization, experience, category, availablefrom, password, username, availableto,gender,docemail,pincode,address,wcontact;
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return this.name;
}
public void setEmail(String email)
{
this.email = email;
}
public String getEmail()
{
return this.email;
}
public void setUname(String uname)
{
this.uname = uname;
}
public String getUname()
{
return this.uname;
}
public void setPass(String pass)
{
this.pass = pass;
}
public String getPass()
{
return this.pass;
}
public void setGender1(String gender)
{
this.gender1 = gender;
}
public String getGender1()
{
return this.gender1;
}
public void setDname(String dname)
{
this.dname = dname;
}
public String getDname()
{
return this.dname;
}
public void setReg_num(String reg_num)
{
this.reg_num = reg_num;
}
public String getReg_num()
{
return this.reg_num;
}
public void setDcontact(String dcontact)
{
this.name = dcontact;
}
public String getDcontact()
{
return this.dcontact;
}
public void setSpecialization(String specialization)
{
this.specialization = specialization;
}
public String getSpecialization()
{
return this.specialization;
}
public void setExperience(String experience)
{
this.experience = experience;
}
public String getExperience()
{
return this.experience;
}
public void setCategory(String category)
{
this.category = category;
}
public String getCategory()
{
return this.category;
}
public void setAvailablefrom(String availablefrom)
{
this.availablefrom = availablefrom;
}
public String getAvailablefrom()
{
return this.availablefrom;
}
public void setPassword(String password)
{
this.password = password;
}
public String getPassword()
{
return this.password;
}
public void setUsername(String username)
{
this.username = username;
}
public String getUsername()
{
return this.username;
}
public void setAvailableto(String availableto)
{
this.availableto = availableto;
}
public String getAvailableto()
{
return this.availableto;
}
public void setGender(String gender)
{
this.gender = gender;
}
public String getGender()
{
return this.gender;
}
public void setDocemail(String docemail)
{
this.docemail = docemail;
}
public String getDocemail()
{
return this.docemail;
}
public void setPincode(String pincode) {this.pincode = pincode;}
public String getPincode()
{
return this.pincode;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return this.address;
}
public void setWcontact(String wcontact)
{
this.wcontact = wcontact;
}
public String getWcontact()
{
return this.wcontact;
}
public void setTimeto(String timeto)
{
this.timeto = timeto;
}
public String getTimeto() {return this.timeto;}
public void setTimefrom(String timefrom)
{
this.timefrom = timefrom;
}
public String getTimefrom()
{
return this.timefrom;
}
}
Try to put some order on your code because is not easy read it. Also, create a method where you can inicialite your widgets, something like this:
public static void startCom(){
text1 = (textView) findById....
.
.
.
}
Only on the method onCreate you invoke startComp, just to save the order of the code.