-
Notifications
You must be signed in to change notification settings - Fork 0
/
EighteenActivity.java
114 lines (99 loc) · 4.29 KB
/
EighteenActivity.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package test.ojassoft.com.ys;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
public class EighteenActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
Toolbar toolbar;
String size[]={"M","L","XL","XXL"};
String color[]={"Red","Black","Blue"};
ImageView imageView;
TextView textView;
TextView textView1;
TextView textView2;
Button button;
ProgressDialog pd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_eighteen);
pd=new ProgressDialog(EighteenActivity.this);
pd.setTitle("Loading Activity");
pd.setMessage("Please Wait ...");
pd.setMax(5);
pd.setIndeterminate(false);
pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
toolbar=(Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("SHOPPING.COM");
setSupportActionBar(toolbar);
button=(Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new AsyncTask<Integer, Long, Boolean>() {
@Override
protected Boolean doInBackground(Integer... params) {
publishProgress(0L);
long start = System.currentTimeMillis();
long waitTime = params[0] * 1000;
try {
while (System.currentTimeMillis() - start < waitTime) {
Thread.sleep(500);
publishProgress(System.currentTimeMillis() - start);
}
} catch (Exception e) {
return false;
}
return true;
}
@Override
protected void onProgressUpdate(Long... values) {
if (values[0] == 0) {
pd.show();
} else {
pd.setProgress((int) (values[0] / 1000));
}
}
@Override
protected void onPostExecute(Boolean result) {
pd.dismiss();
Intent intent=new Intent(EighteenActivity.this,EleventhActivity.class);
startActivity(intent);
}
}.execute(5);}});
imageView = (ImageView) findViewById(R.id.imageview);
textView = (TextView) findViewById(R.id.textview);
textView1 = (TextView) findViewById(R.id.textview1);
textView2 = (TextView) findViewById(R.id.textview2);
Intent intent = getIntent();
imageView.setImageResource(intent.getIntExtra("imageview", 0));
String itemN = intent.getStringExtra("textview");
textView.setText(itemN);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setOnItemSelectedListener(this);
Spinner spinner1=(Spinner) findViewById(R.id.spinner1);
spinner1.setOnItemSelectedListener(this);
ArrayAdapter aa = new ArrayAdapter(this, android.R.layout.simple_spinner_item, size);
ArrayAdapter aaa=new ArrayAdapter(this,android.R.layout.simple_spinner_item,color);
aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//Setting the ArrayAdapter data on the Spinner
spinner.setAdapter(aa);
spinner1.setAdapter(aaa);
}
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long id) {
// Toast.makeText(getApplicationContext(),size[position],Toast.LENGTH_LONG).show();
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}}