Monday, October 14, 2013

Looking for an app that opens Contacts when email link is tapped.[General]


Looking for an app that opens Contacts when email link is tapped.



Basically I just want to have an app which opens the Contact associated with that e-mail when someone taps on an e-mail address.
I know this would overwrite the function of Compose (if it is already selected), so the best option would be for this app to give two option.

Tap on email (in email to, sender, email body, or website, etc..)
Window pops up and has two options
-- CONTACTS
when Contact selected, it opens the contact in View mode so we can see contact details.
-- COMPOSE
when Compose is selected, it opens list of e-mail apps (OR if a default is selected already, runs that app)



Read more

forum.xda-developers.com



Contact Photos Terrible[General]


Contact Photos Terrible



I have read about similar problems but none of those threads were exactly my problem or contained anything that helped fix my issue which is this:
I use photos for contacts that are in my gallery on my Note3. The photos are very good quality and when I view them anywhere on this phone there are no problems at all with the resolution. Except, that is, when they display in contacts or are displayed when making a call or messaging. Then the photos are of such poor resolution as to be almost unrecognizable.

Does anyone have an idea what my problem might be? It's very frustrating. I guess I can live with lousy contact photo display for contacts that I don't use very often. But for the family I really would like the photos to look decent when they call or text.

Is there a way to fix this? Thanks!



Read more

forum.xda-developers.com



Help Pls Weird Problem with Phone[General]


Help Pls Weird Problem with Phone



LGP769 4.1.2 p76920H

Phone is not working properly:

Won't connect via usb to computer. Just pops up and then dissapears
Photos do not save to gallery. They dissappear
Google play apps will not download showing error 491 and , error message unfortunately the process android.process.media has stopped. When looking for android process media within apps on phone there isn't one to enable.
Screen (quick memo)shot doesn't work. Message unfortunately quick memo has stopped
Can't access file manager cannot read file file, manager will be closed please check media storage enable setting and try again

Any help will be appreciated..



Read more

forum.xda-developers.com



Anyone have SG3 on straight talk?[General]


Anyone have SG3 on straight talk?





Quote Originally Posted by longtime44 View Post

Samsug Galaxy S3 on Straight Talk. How's the service?

Sent from my SGH-S959G using AC Forums mobile app



Here are some articles related to Straight Talk that may be of help: Straight Talk | Android Central

Also, I would suggest checking in the Nexus 4 forums for Straight Talk coverage since a lot of N4 users use Straight Talk with their devices. Coverage also depends on location, so keep that in mind when going with the service. You should be able to check the Straight Talk coverage area to get an idea of support within your most frequented areas:


Read more

forum.xda-developers.com



YouTubePlayer doesn't work for some videos[android help]


YouTubePlayer doesn't work for some videos



i am using YouTubeAndroidPlayerApi.jar in my android application so i can read youtube videos.


This is working fine for most videos. I am getting error (No valid request) only when the video id contain a special letter like #.


I am getting the problem for this video for exemple: http://www.youtube.com/embed/eg1Jb_mSQZQ#t=0


The video exist on youtube site but i can't read it in my android device.



@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
boolean wasRestored) {
if (!wasRestored) {
player.cueVideo(id);
}
}

@Override
protected YouTubePlayer.Provider getYouTubePlayerProvider() {
return (YouTubePlayerView) findViewById(R.id.youtube_view);
}


Read more

stackoverflow.comm



Fragment Error in Google Maps V2[android help]


Fragment Error in Google Maps V2



I am trying to create a tourism app that involves a tab layout and a map. I got my tab layout using fragments and viewpager from androidhive and google map from wptrafficanalyzer. However I am experiencing a lot of errors, and I don't know how to deal with them since this is my first time dealing with fragments. I created my own version of the google maps from android hive, however, I can't integrate it in one of the tabs in my tab layout. Can anyone please help? I'll post the code If you need it. Thanks!


Here is my MainActivity.java (Google Map).



public class MainActivity extends FragmentActivity {

final Context context = this;
Button routes;
double latitude = 14.635576;
double longitude = 121.033115;
LatLng latlng = new LatLng(14.6353475, 121.0327501);
LatLngBounds QC = new LatLngBounds(
new LatLng(14.656669, 120.998598), new LatLng(14.666965, 121.098934));
MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Shell").snippet("Sa tabi ng Estuar Building");
Marker mark;
GoogleMap map;
ArrayList markerPoints;
TextView tvDistanceDuration;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

routes = (Button) findViewById (R.id.buttonRoutes);
routes.setBackgroundResource(R.drawable.drivinghires);

tvDistanceDuration = (TextView) findViewById(R.id.tv_distance_time);


routes.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {

// custom dialog
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.options);
dialog.setTitle("Title...");

// set the custom dialog components - text, image and button
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.jeep);
ImageView image1 = (ImageView) dialog.findViewById(R.id.image1);
image1.setImageResource(R.drawable.drivinghires);


Button dialogButton = (Button) dialog.findViewById(R.id.buttonOk);
// if button is clicked, close the custom dialog
dialogButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});

dialog.show();
}
});


// Initializing
markerPoints = new ArrayList();

// Getting reference to SupportMapFragment of the activity_main
SupportMapFragment fm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);

// Getting Map for the SupportMapFragment
map = fm.getMap();



// Set Compass Enabled

map.getUiSettings().setCompassEnabled(true);
map.getUiSettings().setRotateGesturesEnabled(true);

// create marker


// Changing marker icon
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.gasten));
map.moveCamera(CameraUpdateFactory.newLatLngZoom(QC.getCenter(), 12));

// Enable MyLocation Button in the Map
map.setMyLocationEnabled(true);

mark = map.addMarker(marker);

//button






map.setOnCameraChangeListener(new OnCameraChangeListener() {

@Override
public void onCameraChange(CameraPosition arg0) {

// adding marker

if(arg0.zoom <16){
mark.setVisible(false);}
else
mark.setVisible(true);

if(arg0.zoom > 17){
mark.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.gasten));
}




}
});

// Setting onclick event listener for the map
map.setOnMapClickListener(new OnMapClickListener() {

@Override
public void onMapClick(LatLng point) {

// Already two locations
if(markerPoints.size()>1){
markerPoints.clear();
map.clear();

MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Shell").snippet("Sa tabi ng Estuar Building");

// Changing marker icon
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.gasstation));

// adding marker
map.addMarker(marker);
}

// Adding new item to the ArrayList
markerPoints.add(point);

// Creating MarkerOptions
MarkerOptions options = new MarkerOptions();

// Setting the position of the marker
options.position(point);

/**
* For the start location, the color of marker is GREEN and
* for the end location, the color of marker is RED.
*/
if(markerPoints.size()==1){
options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
}else if(markerPoints.size()==2){
options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
}

// Add new marker to the Google Map Android API V2
map.addMarker(options);

// Checks, whether start and end locations are captured
if(markerPoints.size() >= 2){
LatLng origin = markerPoints.get(0);
LatLng dest = markerPoints.get(1);

// Getting URL to the Google Directions API
String url = getDirectionsUrl(origin, dest);

DownloadTask downloadTask = new DownloadTask();

// Start downloading json data from Google Directions API
downloadTask.execute(url);
}
}
});
}

private String getDirectionsUrl(LatLng origin,LatLng dest){

// Origin of route
String str_origin = "origin="+origin.latitude+","+origin.longitude;

// Destination of route
String str_dest = "destination="+dest.latitude+","+dest.longitude;

// Sensor enabled
String sensor = "sensor=false";

// Building the parameters to the web service
String parameters = str_origin+"&"+str_dest+"&"+sensor;

// Output format
String output = "json";

// Building the url to the web service
String url = "https://maps.googleapis.com/maps/api/directions/"+output+"?"+parameters;

return url;
}

/** A method to download json data from url */
private String downloadUrl(String strUrl) throws IOException{
String data = "";
InputStream iStream = null;
HttpURLConnection urlConnection = null;
try{
URL url = new URL(strUrl);

// Creating an http connection to communicate with url
urlConnection = (HttpURLConnection) url.openConnection();

// Connecting to url
urlConnection.connect();

// Reading data from url
iStream = urlConnection.getInputStream();

BufferedReader br = new BufferedReader(new InputStreamReader(iStream));

StringBuffer sb = new StringBuffer();

String line = "";
while( ( line = br.readLine()) != null){
sb.append(line);
}

data = sb.toString();

br.close();

}catch(Exception e){
Log.d("Exception while downloading url", e.toString());
}finally{
iStream.close();
urlConnection.disconnect();
}
return data;
}

// Fetches data from url passed
private class DownloadTask extends AsyncTask{

// Downloading data in non-ui thread
@Override
protected String doInBackground(String... url) {

// For storing data from web service
String data = "";

try{
// Fetching the data from web service
data = downloadUrl(url[0]);
}catch(Exception e){
Log.d("Background Task",e.toString());
}
return data;
}

// Executes in UI thread, after the execution of
// doInBackground()
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);

ParserTask parserTask = new ParserTask();

// Invokes the thread for parsing the JSON data
parserTask.execute(result);
}
}

/** A class to parse the Google Places in JSON format */
private class ParserTask extends AsyncTask>> >{

// Parsing the data in non-ui thread
@Override
protected List>> doInBackground(String... jsonData) {

JSONObject jObject;
List>> routes = null;

try{
jObject = new JSONObject(jsonData[0]);
DirectionsJSONParser parser = new DirectionsJSONParser();

// Starts parsing data
routes = parser.parse(jObject);
}catch(Exception e){
e.printStackTrace();
}
return routes;
}

// Executes in UI thread, after the parsing process
@Override
protected void onPostExecute(List>> result) {
ArrayList points = null;
PolylineOptions lineOptions = null;
MarkerOptions markerOptions = new MarkerOptions();
String distance = "";
String duration = "";

if(result.size()<1){
Toast.makeText(getBaseContext(), "No Points", Toast.LENGTH_SHORT).show();
return;
}

// Traversing through all the routes
for(int i=0;i points = new ArrayList();
lineOptions = new PolylineOptions();

// Fetching i-th route
List> path = result.get(i);

// Fetching all the points in i-th route
for(int j=0;j HashMap point = path.get(j);

if(j==0){ // Get distance from the list
distance = (String)point.get("distance");
continue;
}else if(j==1){ // Get duration from the list
duration = (String)point.get("duration");
continue;
}

double lat = Double.parseDouble(point.get("lat"));
double lng = Double.parseDouble(point.get("lng"));
LatLng position = new LatLng(lat, lng);

points.add(position);
}

// Adding all the points in the route to LineOptions
lineOptions.addAll(points);
lineOptions.width(2);
lineOptions.color(Color.RED);
}

tvDistanceDuration.setText("Distance:"+distance + ", Duration:"+duration);

// Drawing polyline in the Google Map for the i-th route
map.addPolyline(lineOptions);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}


I try to put it in my TabTwo.java



public class TabTwo extends Fragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

View rootView = inflater.inflate(R.layout.activity_tab_two, container, false);

return rootView;
}

}


When I try to copy my MainActivity.java on my TabTwo, lot of errors appear (create method for setcontentview, create method findViewById etc..)



Read more

stackoverflow.comm



canvas.drawCircle sometimes working, sometimes not[android help]


canvas.drawCircle sometimes working, sometimes not



I bought the book Programming Android, and it's a little confusing and disappointing on how they have different code in their Github (https://github.com/bmeike/ProgrammingAndroid2Examples/tree/master/AndroidUIDemo) and their book. I'm stuck in an example that teaches how to draw a circle in a random point, with the color that is assigned to the button, like, when I click the RED button, it should draw a red circle in a view.


I did some extra code and somehow I managed to get it working. Here is my onDraw method:



@Override
protected void onDraw(Canvas canvas)
{
paint.setStyle(Style.STROKE);
paint.setColor(hasFocus() ? Color.BLUE : Color.GRAY);
canvas.drawRect(0, 0, getWidth() - 1, getHeight() - 1, paint);

if (this.points == null) return;

paint.setStyle(Style.FILL);

for (Point p : points.getAllPoints())
{
paint.setColor(p.getColor());
canvas.drawCircle(p.getX(), p.getY(),
p.getDiameter(), paint);
}
}


Sometimes it works, sometimes not, BUT when it works, it draws a thin, large oval shape.


p.getDiameter() is ALWAYS 6. Even if I put it to a fixed 6, the effect is the same.


Also, there is some strange thing happening: If I replace p.getY() and p.getX() by 50, it will never draw anything on the screen. 50 should not be out of the screen bounds.


Unfortunately I can't post a screenshot, my device is not rooted.


Here is some extra relevant code.


Setting the pointView size (the place where I draw points):



@Override
public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);

pointView.setLayoutParams(new android.widget.LinearLayout.LayoutParams(root.getWidth(), root.getHeight()/2));
}


Add an OnCLickListener to the button, so when I click it, it should draw a circle.



button1.setOnClickListener(new OnClickListener() //I'll not put the Red button here, for the sake of brevity.
{
@Override
public void onClick(View arg0)
{
makeDot(pointModel, pointView, Color.GREEN);
}
});


And the makeDot method:



private final Random rnd = new Random();
void makeDot(Points points, PointView pointView, int color)
{
points.addPoint(
rnd.nextFloat()*pointView.getWidth(),
rnd.nextFloat()*pointView.getHeight(),
color, POINT_DIAMETER /*always 6*/);

}


(I think POINT_DIAMETER should be POINT_RADIUS but it's OK for now.)


So, how can I get it to draw a round circle in a random position in the screen?



Read more

stackoverflow.comm



What is the best layout to use?[android help]


What is the best layout to use?


android - What is the best layout to use? - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
















I would like to replicate this layout in Android:


enter image description here


Basically, I need a layout which allows me to control each square by using left/top values. Each square will be added dynamically, therefore each square will be a Fragment. What layout can I use? I've done this in .Net in a metro app using UserControls for each square, all added to a Canvas layout. What would be the equivalent in Android?


























You should go for GridView.


For Gridview child item, Use Relative Layout so that you can easily place TextView at center and Bottom Right of the Layout.




















default






Read more

stackoverflow.comm



Admob Network mediation payout [on hold][android help]


Admob Network mediation payout [on hold]


android - Admob Network mediation payout - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
















In Admob, I have setup couple of mediation networks like millennium media and Appflood. I know that I will be paid by Admob for all the Ads from Admob but what happens to the ads served by any of the mediation networks like millennium media and Appflood added in Admob. Kindly advice from which company I will get my payout Admob or (mediation networks like millennium media and Appflood seperately)















put on hold as off-topic by Bill the Lizard 3 mins ago


  • This question does not appear to be about programming within the scope defined in the help center.

If this question can be reworded to fit the rules in the help center, please edit the question.





default






Read more

stackoverflow.comm



Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...