Search Results

Search found 10 results on 1 pages for 'nicktfried'.

Page 1/1 | 1 

  • Get Eclipse to recognize the maps api

    - by NickTFried
    Hi I'm developing an Android app and trying to incorporate maps into one of my sub-activities. Having followed all of the instructions from Android, my java file will not recognize the "MapActivity" or the import statements to include the needed api. Here is my XML manifest and my class file. <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permissions.INTERNET"/> <uses-permission android:name="android.permissions.ACCESS_FINE_LOCATION"/> <application android:icon="@drawable/icon" android:label="@string/app_name"> <uses-library android:name="com.google.android.maps" /> <activity android:name=".CadetCommand" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="RedLight"></activity> <activity android:name="PTCalculator"></activity> </application> <uses-sdk android:minSdkVersion="7"/> here is my java file: package edu.elon.cs.mobile; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; import android.os.Bundle; public class LandNav extends MapActivity{ } Any suggestion would help.

    Read the article

  • Why isn't my bundle getting passed?

    - by NickTFried
    I'm trying to pass a bundle of two values from a started class to my landnav app, but according to the debug nothing is getting passed, does anyone have any ideas why? package edu.elon.cs.mobile; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class PointEntry extends Activity{ private Button calc; private EditText longi; private EditText lati; private double longid; private double latd; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pointentry); calc = (Button) findViewById(R.id.coorCalcButton); calc.setOnClickListener(landNavButtonListener); longi = (EditText) findViewById(R.id.longitudeedit); lati = (EditText) findViewById(R.id.latitudeedit); } private void startLandNav() { Intent intent = new Intent(this, LandNav.class); startActivityForResult(intent, 0); } private OnClickListener landNavButtonListener = new OnClickListener() { @Override public void onClick(View arg0) { Bundle bundle = new Bundle(); bundle.putDouble("longKey", longid); bundle.putDouble("latKey", latd); longid = Double.parseDouble(longi.getText().toString()); latd = Double.parseDouble(lati.getText().toString()); startLandNav(); } }; } This is the class that is suppose to take the second point package edu.elon.cs.mobile; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.MyLocationOverlay; import com.google.android.maps.Overlay; import android.content.Context; import android.graphics.drawable.Drawable; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; import android.widget.EditText; import android.widget.TextView; public class LandNav extends MapActivity{ private MapView map; private MapController mc; private GeoPoint myPos; private SensorManager sensorMgr; private TextView azimuthView; private double longitudeFinal; private double latitudeFinal; double startTime; double newTime; double elapseTime; private MyLocationOverlay me; private Drawable marker; private GeoPoint finalPos; private SitesOverlay myOverlays; public LandNav(){ startTime = System.currentTimeMillis(); } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.landnav); Bundle bundle = this.getIntent().getExtras(); if(bundle != null){ longitudeFinal = bundle.getDouble("longKey"); latitudeFinal = bundle.getDouble("latKey"); } azimuthView = (TextView) findViewById(R.id.azimuthView); map = (MapView) findViewById(R.id.map); mc = map.getController(); sensorMgr = (SensorManager) getSystemService(Context.SENSOR_SERVICE); LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); int longitude = (int)(location.getLongitude() * 1E6); int latitude = (int)(location.getLatitude() * 1E6); finalPos = new GeoPoint((int)(latitudeFinal*1E6), (int)(longitudeFinal*1E6)); myPos = new GeoPoint(latitude, longitude); map.setSatellite(true); map.setBuiltInZoomControls(true); mc.setZoom(16); mc.setCenter(myPos); marker = getResources().getDrawable(R.drawable.greenmarker); marker.setBounds(0,0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight()); me = new MyLocationOverlay(this, map); myOverlays = new SitesOverlay(marker, myPos, finalPos); map.getOverlays().add(myOverlays); } @Override protected boolean isRouteDisplayed() { return false; } @Override protected void onResume() { super.onResume(); sensorMgr.registerListener(sensorListener, sensorMgr.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_UI); me.enableCompass(); me.enableMyLocation(); //me.onLocationChanged(location) } protected void onPause(){ super.onPause(); me.disableCompass(); me.disableMyLocation(); } @Override protected void onStop() { super.onStop(); sensorMgr.unregisterListener(sensorListener); } private SensorEventListener sensorListener = new SensorEventListener() { @Override public void onAccuracyChanged(Sensor arg0, int arg1) { // TODO Auto-generated method stub } private boolean reset = true; @Override public void onSensorChanged(SensorEvent event) { newTime = System.currentTimeMillis(); elapseTime = newTime - startTime; if (event.sensor.getType() == Sensor.TYPE_ORIENTATION && elapseTime > 400) { azimuthView.setText(Integer.toString((int) event.values[0])); startTime = newTime; } } }; }

    Read the article

  • How to get predecessor and successors from an adjacency matrix

    - by NickTFried
    Hi I am am trying to complete an assignment, where it is ok to consult the online community. I have to create a graph class that ultimately can do Breadth First Search and Depth First Search. I have been able to implement those algorithms successfully however another requirement is to be able to get the successors and predecessors and detect if two vertices are either predecessors or successors for each other. I'm having trouble thinking of a way to do this. I will post my code below, if anyone has any suggestions it would be greatly appreciated. import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; public class Graph<T> { public Vertex<T> root; public ArrayList<Vertex<T>> vertices=new ArrayList<Vertex<T>>(); public int[][] adjMatrix; int size; private ArrayList<Vertex<T>> dfsArrList; private ArrayList<Vertex<T>> bfsArrList; public void setRootVertex(Vertex<T> n) { this.root=n; } public Vertex<T> getRootVertex() { return this.root; } public void addVertex(Vertex<T> n) { vertices.add(n); } public void removeVertex(int loc){ vertices.remove(loc); } public void addEdge(Vertex<T> start,Vertex<T> end) { if(adjMatrix==null) { size=vertices.size(); adjMatrix=new int[size][size]; } int startIndex=vertices.indexOf(start); int endIndex=vertices.indexOf(end); adjMatrix[startIndex][endIndex]=1; adjMatrix[endIndex][startIndex]=1; } public void removeEdge(Vertex<T> v1, Vertex<T> v2){ int startIndex=vertices.indexOf(v1); int endIndex=vertices.indexOf(v2); adjMatrix[startIndex][endIndex]=1; adjMatrix[endIndex][startIndex]=1; } public int countVertices(){ int ver = vertices.size(); return ver; } /* public boolean isPredecessor( Vertex<T> a, Vertex<T> b){ for() return true; }*/ /* public boolean isSuccessor( Vertex<T> a, Vertex<T> b){ for() return true; }*/ public void getSuccessors(Vertex<T> v1){ } public void getPredessors(Vertex<T> v1){ } private Vertex<T> getUnvisitedChildNode(Vertex<T> n) { int index=vertices.indexOf(n); int j=0; while(j<size) { if(adjMatrix[index][j]==1 && vertices.get(j).visited==false) { return vertices.get(j); } j++; } return null; } public Iterator<Vertex<T>> bfs() { Queue<Vertex<T>> q=new LinkedList<Vertex<T>>(); q.add(this.root); printVertex(this.root); root.visited=true; while(!q.isEmpty()) { Vertex<T> n=q.remove(); Vertex<T> child=null; while((child=getUnvisitedChildNode(n))!=null) { child.visited=true; bfsArrList.add(child); q.add(child); } } clearVertices(); return bfsArrList.iterator(); } public Iterator<Vertex<T>> dfs() { Stack<Vertex<T>> s=new Stack<Vertex<T>>(); s.push(this.root); root.visited=true; printVertex(root); while(!s.isEmpty()) { Vertex<T> n=s.peek(); Vertex<T> child=getUnvisitedChildNode(n); if(child!=null) { child.visited=true; dfsArrList.add(child); s.push(child); } else { s.pop(); } } clearVertices(); return dfsArrList.iterator(); } private void clearVertices() { int i=0; while(i<size) { Vertex<T> n=vertices.get(i); n.visited=false; i++; } } private void printVertex(Vertex<T> n) { System.out.print(n.label+" "); } }

    Read the article

  • Make my radio buttons become selected in Android

    - by NickTFried
    When I run this could and click on the dialog box my radiobuttons do not become selected like intended package edu.elon.cs.mobile; import edu.elon.cs.mobile.R; import edu.elon.cs.mobile.R.id; import edu.elon.cs.mobile.R.layout; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.text.Editable; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; public class PTCalculator extends Activity{ private RadioButton maleRadioButton; private RadioButton femaleRadioButton; private EditText ageEdit; private EditText pushUpsEdit; private EditText sitUpsEdit; private EditText mileMinEdit; private EditText mileSecEdit; private Button calculate; private TextView score; protected AlertDialog genderAlert; private int currScore; private int age; private int sitUps; private int runTime; private int pushUps; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pt); maleRadioButton = (RadioButton) findViewById(R.id.male); femaleRadioButton = (RadioButton) findViewById(R.id.female); ageEdit = (EditText) findViewById(R.id.ageEdit); pushUpsEdit = (EditText) findViewById(R.id.pushupEdit); sitUpsEdit = (EditText) findViewById(R.id.situpEdit); mileMinEdit = (EditText) findViewById(R.id.minEdit); mileSecEdit = (EditText) findViewById(R.id.secEdit); calculate = (Button) findViewById(R.id.calculateButton); calculate.setOnClickListener(calculateButtonListener); score = (TextView) findViewById(R.id.scoreView); genderAlert = makeGenderDialog().create(); } private OnClickListener calculateButtonListener = new OnClickListener() { @Override public void onClick(View arg0) { age = (Integer.parseInt(ageEdit.getText().toString())); pushUps = (Integer.parseInt(pushUpsEdit.getText().toString())); sitUps = (Integer.parseInt(sitUpsEdit.getText().toString())); int min = (Integer.parseInt(mileMinEdit.getText().toString())*60); int sec = (Integer.parseInt(mileSecEdit.getText().toString())); runTime = min + sec; if(maleRadioButton.isChecked()){ MalePTTest mPTTest = new MalePTTest(age, pushUps, sitUps, runTime); currScore = mPTTest.malePTScore(); score.setText((Integer.toString(currScore))); }else if(femaleRadioButton.isChecked()){ FemalePTTest fPTTest = new FemalePTTest(age, pushUps, sitUps, runTime); currScore = fPTTest.femalePTScore(); score.setText((Integer.toString(currScore))); }else genderAlert.show(); } }; public AlertDialog.Builder makeGenderDialog(){ AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Select a Gender") .setCancelable(false) .setPositiveButton("Female", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { femaleRadioButton.setSelected(true); FemalePTTest fPTTest = new FemalePTTest(age, pushUps, sitUps, runTime); currScore = fPTTest.femalePTScore(); score.setText((Integer.toString(currScore))); } }) .setNegativeButton("Male", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { maleRadioButton.setSelected(true); MalePTTest mPTTest = new MalePTTest(age, pushUps, sitUps, runTime); currScore = mPTTest.malePTScore(); score.setText((Integer.toString(currScore))); } }); return builder; } } Any suggestions?

    Read the article

  • Does anyone know why my maps only show grid

    - by NickTFried
    I've doubled checked my API key is right and that is right I doubled checked that it was correct. Here is my source and XML could anyone check to see what is wrong. Also I make sure I have internet. <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permissions.INTERNET"/> <uses-permission android:name="android.permissions.ACCESS_FINE_LOCATION"/> <application android:icon="@drawable/icon" android:label="@string/app_name"> <uses-library android:name="com.google.android.maps" /> <activity android:name=".CadetCommand" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="RedLight"></activity> <activity android:name="PTCalculator"></activity> <activity android:name="LandNav"></activity> </application> <uses-sdk android:minSdkVersion="4"/> package edu.elon.cs.mobile; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; import android.os.Bundle; public class LandNav extends MapActivity{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.landnav); } @Override protected boolean isRouteDisplayed() { return false; } }

    Read the article

1