-
Notifications
You must be signed in to change notification settings - Fork 0
/
FurnitureSellingPage.java
67 lines (60 loc) · 2.31 KB
/
FurnitureSellingPage.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.example.hackmol;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import androidx.appcompat.app.AppCompatActivity;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import java.util.ArrayList;
import java.util.List;
public class FurnitureSellingPage extends AppCompatActivity {
Button button;
String address,uid;
String points;
String wastetype="";
FirebaseUser user;
private Spinner spinner;
DatabaseReference databaseReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_selling_page);
user= FirebaseAuth.getInstance().getCurrentUser();
uid=user.getUid();
spinner=findViewById(R.id.spinner);
List<String> type=new ArrayList<>();
type.add("Choose Waste Type");
type.add("Furniture");
type.add("Other");
ArrayAdapter<String> typeAdapter=new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,type);
typeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(typeAdapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String type=spinner.getSelectedItem().toString();
if (!type.equals("Choose Waste Type")){
wastetype=type;
}
else {
wastetype="";
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent =new Intent(FurnitureSellingPage.this,FinalPage2.class);
startActivity(intent);
}
});
}
}