mehak
- Forum posts: 1
Apr 9, 2013, 7:11:40 PM via Website
Apr 9, 2013 7:11:40 PM via Website
Samples: Reset
<- ->
Start Stop Save
Hiii...The interface is something like above but in the form of a square box with appropriate rows and columns.I couldnt attach the image of it.So somehow i just managed to draw it like this.
This is the calibration part for android. In which start, stop, save and reset are the buttons. The backward and forward arrows are for adjusting the points. And the samples will get collected in that very box as mentioned above. So far i have done this much coding though incomplete. Can someone please help me out.
package peopleTracking;
import android.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
public class peopleTracking extends activity {
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.peopleTracking);
// Dashboard events button
// Button btn_start = (Button) findViewById(R.id.btn_start);
View startButton = findViewById(R.id.start_Button);
// startButton.setOnClickListener((OnClickListener) this);
// Dashboard events button
// Button btn_save = (Button) findViewById(R.id.btn_save);
View saveButton = findViewById(R.id.save_button);
// saveButton.setOnClickListener((OnClickListener) this);
// Dashboard events button
// Button btn_stop = (Button) findViewById(R.id.btn_stop);
View stopButton = findViewById(R.id.stop_button);
// stopButton.setOnClickListener((OnClickListener) this);
// Dashboard events button
// Button btn_reset = (Button) findViewById(R.id.btn_reset);
View resetButton = findViewById(R.id.reset_button);
// resetButton.setOnClickListener((OnClickListener) this);
// Dashboard events button
View ForwardButton = findViewById(R.id.forward_button);
// Dashboard events button
View BackwardButton = findViewById(R.id.backward_button);
startButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Launching News Feed Screen
Intent i = new Intent(getApplicationContext(), startActivity.class);
startActivity(i);
}
});
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Launching News Feed Screen
Intent i = new Intent(getApplicationContext(), saveActivity.class);
startActivity(i);
}
});
stopButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Launching News Feed Screen
Intent i = new Intent(getApplicationContext(), stopActivity.class);
stopActivity(i);
}
});
resetButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Launching News Feed Screen
Intent i = new Intent(getApplicationContext(), resetActivity.class);
resetActivity(i);
}
});
ForwardButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View view){
Intent i = new Intent(getApplicationContext(),ForwardActivity.class);
ForwardActivity(i);
}
});
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
AND FOR WIFI as follows:
package peopleTracking;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import android.R;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
public class peopleTracking extends activity implements onClickListener {
WifiManager wifi;
ListView lv;
TextView textStatus;
Button buttonScan;
int size = 0;
List<ScanResult> results;
String ITEM_KEY = "key";
ArrayList<HashMap<String, String>> arraylist = new ArrayList<HashMap<String, String>>();
SimpleAdapter adapter;
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textStatus = (TextView) findViewById(R.id.textStatus);
buttonScan = (Button) findViewById(R.id.startButton);
buttonScan.setOnClickListener((OnClickListener) this);
lv = (ListView)findViewById(R.id.list);
wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (wifi.isWifiEnabled() == false)
{
Toast.makeText(getApplicationContext(), "wifi is disabled..making it enabled", Toast.LENGTH_LONG).show();
wifi.setWifiEnabled(true);
}
this.adapter = new SimpleAdapter(WiFiDemo.this, arraylist, R.layout.row, new String[] { ITEM_KEY }, new int[] { R.id.list_value });
lv.setAdapter(this.adapter);
registerReceiver(new BroadcastReceiver()
{
@Override
public void onReceive(Context c, Intent intent)
{
results = wifi.getScanResults();
size = results.size();
}
}new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
}
public void onClick(View view)
{
ArrayList.clear();
wifi.startScan();
Toast.makeText(this, "Scanning...." + size, Toast.LENGTH_SHORT).show();
try
{
size = size - 1;
while (size >= 0)
{
HashMap<String, String> item = new HashMap<String, String>();
item.put(ITEM_KEY, results.get(size).SSID + " " + results.get(size).capabilities);
arraylist.add(item);
size--;
adapter.notifyDataSetChanged();
}
}
catch (Exception e)
{ }
}
}
<- ->
Start Stop Save
Hiii...The interface is something like above but in the form of a square box with appropriate rows and columns.I couldnt attach the image of it.So somehow i just managed to draw it like this.
This is the calibration part for android. In which start, stop, save and reset are the buttons. The backward and forward arrows are for adjusting the points. And the samples will get collected in that very box as mentioned above. So far i have done this much coding though incomplete. Can someone please help me out.
package peopleTracking;
import android.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
public class peopleTracking extends activity {
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.peopleTracking);
// Dashboard events button
// Button btn_start = (Button) findViewById(R.id.btn_start);
View startButton = findViewById(R.id.start_Button);
// startButton.setOnClickListener((OnClickListener) this);
// Dashboard events button
// Button btn_save = (Button) findViewById(R.id.btn_save);
View saveButton = findViewById(R.id.save_button);
// saveButton.setOnClickListener((OnClickListener) this);
// Dashboard events button
// Button btn_stop = (Button) findViewById(R.id.btn_stop);
View stopButton = findViewById(R.id.stop_button);
// stopButton.setOnClickListener((OnClickListener) this);
// Dashboard events button
// Button btn_reset = (Button) findViewById(R.id.btn_reset);
View resetButton = findViewById(R.id.reset_button);
// resetButton.setOnClickListener((OnClickListener) this);
// Dashboard events button
View ForwardButton = findViewById(R.id.forward_button);
// Dashboard events button
View BackwardButton = findViewById(R.id.backward_button);
startButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Launching News Feed Screen
Intent i = new Intent(getApplicationContext(), startActivity.class);
startActivity(i);
}
});
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Launching News Feed Screen
Intent i = new Intent(getApplicationContext(), saveActivity.class);
startActivity(i);
}
});
stopButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Launching News Feed Screen
Intent i = new Intent(getApplicationContext(), stopActivity.class);
stopActivity(i);
}
});
resetButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Launching News Feed Screen
Intent i = new Intent(getApplicationContext(), resetActivity.class);
resetActivity(i);
}
});
ForwardButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View view){
Intent i = new Intent(getApplicationContext(),ForwardActivity.class);
ForwardActivity(i);
}
});
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
AND FOR WIFI as follows:
package peopleTracking;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import android.R;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
public class peopleTracking extends activity implements onClickListener {
WifiManager wifi;
ListView lv;
TextView textStatus;
Button buttonScan;
int size = 0;
List<ScanResult> results;
String ITEM_KEY = "key";
ArrayList<HashMap<String, String>> arraylist = new ArrayList<HashMap<String, String>>();
SimpleAdapter adapter;
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textStatus = (TextView) findViewById(R.id.textStatus);
buttonScan = (Button) findViewById(R.id.startButton);
buttonScan.setOnClickListener((OnClickListener) this);
lv = (ListView)findViewById(R.id.list);
wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (wifi.isWifiEnabled() == false)
{
Toast.makeText(getApplicationContext(), "wifi is disabled..making it enabled", Toast.LENGTH_LONG).show();
wifi.setWifiEnabled(true);
}
this.adapter = new SimpleAdapter(WiFiDemo.this, arraylist, R.layout.row, new String[] { ITEM_KEY }, new int[] { R.id.list_value });
lv.setAdapter(this.adapter);
registerReceiver(new BroadcastReceiver()
{
@Override
public void onReceive(Context c, Intent intent)
{
results = wifi.getScanResults();
size = results.size();
}
}new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
}
public void onClick(View view)
{
ArrayList.clear();
wifi.startScan();
Toast.makeText(this, "Scanning...." + size, Toast.LENGTH_SHORT).show();
try
{
size = size - 1;
while (size >= 0)
{
HashMap<String, String> item = new HashMap<String, String>();
item.put(ITEM_KEY, results.get(size).SSID + " " + results.get(size).capabilities);
arraylist.add(item);
size--;
adapter.notifyDataSetChanged();
}
}
catch (Exception e)
{ }
}
}
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.