-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJAVA CODE
More file actions
73 lines (55 loc) · 2.2 KB
/
Copy pathJAVA CODE
File metadata and controls
73 lines (55 loc) · 2.2 KB
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
package com.newproj.multipicationtable;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
ListView listView;
TextView textView;
SeekBar seekBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
textView = findViewById(R.id.textView);
listView = findViewById(R.id.myListView);
seekBar = findViewById(R.id.seekBar);
seekBar.setMax(200);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
Toast.makeText(MainActivity.this,"Populating table of "+ i,Toast.LENGTH_SHORT).show();
populate(i);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
public void populate(int table){
ArrayList<String>multable=new ArrayList<>();
for(int i=1;i<=10;i++){
multable.add(table+" X "+ i +"= "+ table*i);
}
ArrayAdapter<String>arrayAdapter= new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,multable);
listView.setAdapter(arrayAdapter);
textView.setText("Multipication Table Of "+table);
}
}