forked from aanchal298/location
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JobList.java
81 lines (65 loc) · 2.31 KB
/
JobList.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
package com.example.location;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.app.Fragment.SavedState;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class JobList extends Activity{
public static String job2,job1;
boolean a;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.joblist);
Button b =(Button)findViewById(R.id.button1);
a=isMyServiceRunning(LocationModified.class);
String str = String.valueOf(a);
//Toast.makeText(getApplicationContext(),str, Toast.LENGTH_SHORT).show();
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText et2= (EditText)findViewById(R.id.editText2);
job2 = et2.getText().toString();
EditText et1= (EditText)findViewById(R.id.editText1);
job1 = et1.getText().toString();
Intent ii = new Intent(JobList.this,GeocodingActivity.class);
startActivity(ii);
//Toast.makeText(getApplicationContext(), "please", Toast.LENGTH_SHORT).show();
// TODO Auto-generated method stub
}
});
Button b2=(Button)findViewById(R.id.button2);
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i =new Intent(JobList.this,MyActivity.class);
startActivity(i);
Toast.makeText(getApplicationContext(), "sahi ", Toast.LENGTH_LONG).show();
}
});
}
private boolean isMyServiceRunning(Class<?> serviceClass) {
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.getName().equals(service.service.getClassName())) {
return true;
}
}
return false;
}
}