1
+ package id .kataponcoe .rotgridview ;
2
+
3
+ import android .app .AlertDialog ;
4
+ import android .content .Context ;
5
+ import android .content .DialogInterface ;
6
+ import android .content .Intent ;
7
+ import android .net .ConnectivityManager ;
8
+ import android .net .NetworkInfo ;
9
+ import android .net .Uri ;
10
+ import android .support .v7 .app .AppCompatActivity ;
11
+ import android .os .Bundle ;
12
+ import android .view .MenuItem ;
13
+ import android .view .View ;
14
+ import android .view .Window ;
15
+ import android .widget .AdapterView ;
16
+ import android .widget .GridView ;
17
+ import android .widget .TextView ;
18
+
19
+ public class MainActivity extends AppCompatActivity {
20
+
21
+ private static final String TAG = MainActivity .class .getSimpleName ();
22
+
23
+ final String Email = "poncoe4mac@gmail.com" ;
24
+
25
+ GridView grid ; //Grid
26
+ GridAdapter adapter ; //grid
27
+ String [] Judul ; // grid
28
+ int [] image ; // grid
29
+ private TextView messageView ;
30
+
31
+ @ Override
32
+ public void onCreate (Bundle savedInstanceState ) {
33
+ super .onCreate (savedInstanceState );
34
+
35
+ requestWindowFeature (Window .FEATURE_NO_TITLE );
36
+ setContentView (R .layout .activity_main );
37
+
38
+ // GridView Awal
39
+
40
+ Judul = new String []{"Situs Resmi" , "Letak Lokasi" , "Official Kaskus" , "Official Twitter" , "Telesandi News" , "Situs Tomcat" ,
41
+ "Tels Radio" , "Telesandi Art" , "Telesandi Services" , "English Club" ,
42
+ "Osis Telesandi" , "Official Telesandi" , "Telesandi Futsal" , "Angklung Tels" , "Ultras Telkom74" ,
43
+ "Ultras Telkom74" , "Tomcat Telesandi" , "Osis Telesandi" , "Paskibra Telesandi" ,
44
+ "Brigatels" , "Traditels" , "Rohis Telesandi" , "Pramuka Telesandi" , "Seni Media" };
45
+
46
+ image = new int []{R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher ,
47
+ R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher ,
48
+ R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher ,
49
+ R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher ,
50
+ R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher , R .mipmap .ic_launcher };
51
+
52
+ grid = (GridView ) findViewById (R .id .gridview );
53
+ adapter = new GridAdapter (getApplicationContext (), Judul , image );
54
+ grid .setAdapter (adapter );
55
+
56
+ // kasih fungsi jika diklik
57
+ grid .setOnItemClickListener (new AdapterView .OnItemClickListener () {
58
+
59
+ @ Override
60
+ public void onItemClick (AdapterView <?> parent , View view ,
61
+ int position , long id ) {
62
+
63
+ /* KETERANGAN!!
64
+
65
+ kalo di gridview mau dikasih activity / intent pake kodingan ini :
66
+
67
+ myIntent = new Intent(view.getContext(), SitusSekolah.class);
68
+
69
+ cuma kalo mau main ACTION_VIEW silahkan pake ini :
70
+
71
+ myIntent = new Intent (Intent.ACTION_VIEW, Uri.parse("https://twitter.com/official_Tels"));
72
+
73
+ sesuain kebutuhan aja..
74
+
75
+ --> image & judul bisa kalian ubah, intinya 1 gridview itu 1 judul & image.
76
+
77
+ */
78
+
79
+ Intent myIntent = null ;
80
+ if (position == 0 ) {
81
+ //myIntent = new Intent(view.getContext(), SitusSekolah.class); <!-- contoh Kalo Mau Kasih Intent -->
82
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://twitter.com/official_Tels" ));
83
+ }
84
+ if (position == 1 ) {
85
+ //myIntent = new Intent(view.getContext(), LetakSekolah.class); <!-- contoh Kalo Mau Kasih Intent -->
86
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://twitter.com/official_Tels" ));
87
+ }
88
+ if (position == 2 ) {
89
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("http://www.kaskus.co.id/thread/56a6e4cc529a45cc398b4568/official-smk-telekomunikasi-telesandi-bekasi-tempat-ngobrolsharing--berkumpul" ));
90
+ }
91
+ if (position == 3 ) {
92
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://twitter.com/official_Tels" ));
93
+ }
94
+ if (position == 4 ) {
95
+ // myIntent = new Intent(view.getContext(), TelsNews.class); <!-- contoh Kalo Mau Kasih Intent -->
96
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://twitter.com/official_Tels" ));
97
+ }
98
+ if (position == 5 ) {
99
+ //myIntent = new Intent(view.getContext(), SitusTomcat.class); <!-- contoh Kalo Mau Kasih Intent -->
100
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://twitter.com/official_Tels" ));
101
+ }
102
+
103
+
104
+ if (position == 6 ) {
105
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/telsradio/" ));
106
+ }
107
+ if (position == 7 ) {
108
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/tels_art/" ));
109
+ }
110
+ if (position == 8 ) {
111
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/telservices/" ));
112
+ }
113
+ if (position == 9 ) {
114
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/ec.tels/" ));
115
+ }
116
+
117
+
118
+ if (position == 10 ) {
119
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/osistels/" ));
120
+ }
121
+ if (position == 11 ) {
122
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/officialtels/" ));
123
+ }
124
+ if (position == 12 ) {
125
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/futsaltels2008/" ));
126
+ }
127
+ if (position == 13 ) {
128
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/angklungtels/" ));
129
+ }
130
+ if (position == 14 ) {
131
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/ultrastelkom74/" ));
132
+ }
133
+
134
+
135
+ if (position == 15 ) {
136
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://twitter.com/ultrastelkom74" ));
137
+ }
138
+ if (position == 16 ) {
139
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://twitter.com/TomcatSquad_" ));
140
+ }
141
+ if (position == 17 ) {
142
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://twitter.com/Osis_Tels" ));
143
+ }
144
+ if (position == 18 ) {
145
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://twitter.com/Brigastels_CGE" ));
146
+ }
147
+
148
+
149
+ if (position == 19 ) {
150
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/brigastels/" ));
151
+ }
152
+ if (position == 20 ) {
153
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/traditels/" ));
154
+ }
155
+ if (position == 21 ) {
156
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/rohistels89/" ));
157
+ }
158
+ if (position == 22 ) {
159
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/aljawira/" ));
160
+ }
161
+ if (position == 23 ) {
162
+ myIntent = new Intent (Intent .ACTION_VIEW , Uri .parse ("https://www.instagram.com/senimedia_/" ));
163
+ }
164
+
165
+ startActivity (myIntent );
166
+
167
+ }
168
+
169
+ });
170
+ }
171
+
172
+ //GridView Akhir
173
+
174
+ public void onBackPressed () {
175
+ finish ();//Pergi ke method exit
176
+ }
177
+ }
0 commit comments