-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
renatho
committed
Nov 10, 2013
1 parent
91bdd78
commit b0f8fba
Showing
10 changed files
with
136 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.app.places; | ||
|
||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
import java.sql.ResultSet; | ||
import java.sql.Statement; | ||
|
||
public class DatabaseHelper { | ||
Connection conn = null; | ||
String url = "jdbc:mysql://174.123.233.90:3306/"; | ||
String dbName = "toctoc_places"; | ||
String driver = "com.mysql.jdbc.Driver"; | ||
String userName = "toctoc_places"; | ||
String password = "places123"; | ||
Statement statement; | ||
|
||
public ResultSet executeQuery(String sql) { | ||
ResultSet rs = null; | ||
try { | ||
rs = statement.executeQuery(sql); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
return rs; | ||
} | ||
|
||
public void executeUpdate(String sql) { | ||
try { | ||
statement.executeUpdate(sql); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public void open() { | ||
try { | ||
Class.forName(driver).newInstance(); | ||
conn = DriverManager.getConnection(url+dbName,userName,password); | ||
statement = conn.createStatement(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public void close() { | ||
try { | ||
conn.close(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.app.places; | ||
|
||
import java.util.ArrayList; | ||
|
||
import android.content.Context; | ||
import android.graphics.drawable.Drawable; | ||
|
||
import com.google.android.maps.ItemizedOverlay; | ||
import com.google.android.maps.OverlayItem; | ||
|
||
public class MapItemizedOverlay extends ItemizedOverlay { | ||
|
||
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>(); | ||
private Context mContext; | ||
|
||
public MapItemizedOverlay(Drawable defaultMarker, Context context) { | ||
super(boundCenterBottom(defaultMarker)); | ||
mContext = context; | ||
} | ||
|
||
public void addOverlay(OverlayItem overlay) { | ||
mOverlays.add(overlay); | ||
populate(); | ||
} | ||
|
||
@Override | ||
protected OverlayItem createItem(int i) { | ||
return mOverlays.get(i); | ||
} | ||
|
||
@Override | ||
public int size() { | ||
return mOverlays.size(); | ||
} | ||
|
||
@Override | ||
protected boolean onTap(int index) { | ||
OverlayItem item = mOverlays.get(index); | ||
Util.alert(item.getTitle(), item.getSnippet(), mContext); | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.app.places; | ||
|
||
import android.app.AlertDialog; | ||
import android.content.Context; | ||
|
||
public class Util { | ||
public static void alert(String title, String message, Context ctx) { | ||
AlertDialog alertDialog = new AlertDialog.Builder(ctx).create(); | ||
alertDialog.setTitle(title); | ||
alertDialog.setMessage(message); | ||
alertDialog.show(); | ||
} | ||
} |