-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainActivity.java
51 lines (47 loc) · 1.67 KB
/
MainActivity.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
package test.ojassoft.com.ys;
import android.content.Context;
import android.content.Intent;
import android.net.NetworkInfo;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import android.net.ConnectivityManager;
public class MainActivity extends AppCompatActivity {
private static int SPLASH_TIME_OUT=4000;
TextView textView;
Context context;
NetworkInfo info;
Context sContext;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView=(TextView) findViewById(R.id.textview);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent=new Intent(MainActivity.this,LoginActivity.class);
startActivity(intent);
finish();
}
},SPLASH_TIME_OUT);
}}
// public void isNetworkAvailable() {
// try {
// ConnectivityManager connectivity = (ConnectivityManager) sContext.getSystemService(Context.CONNECTIVITY_SERVICE);
// if (connectivity != null) {
// NetworkInfo[] info = connectivity.getAllNetworkInfo();
// if (info != null)
// for (int i = 0; i < info.length; i++)
// if (info[i].getState() == NetworkInfo.State.CONNECTED) {
//present your UI
// }
//}
// } catch (Exception e) {
// e.printStackTrace();
// }
//exit the app
// finish();
// }
//}