Thursday, December 26, 2013

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 voicemail when on Verizon.

Well now since switching to T-Mobile I can no longer get Voice to function as my voicemail. When I download and setup the app and then call my phone it will ring but then when voicemail should come up I just get an error saying "We cannot complete your call as dialed" or something along those lines. When I switch back to carrier voicemail everything works.

So am I doing something wrong during setup? Is Voice even compatible with T-Mobile?



Read more

forum.xda-developers.com



Imediashare problems when it changed to flipps. [General]


Imediashare problems when it changed to flipps.



Hi Everyone, I have a nexus 7 and I used to be able to use Imediashare to connect and play music, videos etc. through my Samsunng Blu-ray player. However, when imediashare updated to flipps the devices do not connect anymore. Any thought on why this might be occuring? Are there other apps that might work better? Any input would be appreciated. Thanks.



Read more

forum.xda-developers.com



new kind of SPAM - straight in OS - not AirPush [General]


new kind of SPAM - straight in OS - not AirPush



So, Galaxy S4, Verizon, Android 4.2.2,

New kind of spam that shows up right on home screen or on top of running app. (see picture below)

Lookout didn't find anything. Airpush_Detector didn't find anything.

How do I find out on what app it piggybacked into my phone / how do I get rid of it? And why does Google allow these apps in the Marketplace anyway...

new kind of SPAM - straight in OS - not AirPush-2013-12-17-16.51.26.jpg



Read more

forum.xda-developers.com



Galaxy S4 GPE - noob questions [General]


Galaxy S4 GPE - noob questions



So my new S4 GPE arrives in 48 hours and I cannot wait to start tinkering, (currently on iphone 5). I purchased a SanDisk 32GB Extreme microSDHC card as well. How can I use the SanDisk card? Can I install apps to the card? I assume/hope that I can store pictures/videos/music on the card as well?

What is a launcher?

I'd like to be able to have email, SMS, Calendar, missed call/voicemail notifications directly on my lockscreen as I do now with my iphone. Is this possible? If so, how do I accomplish this?

Thanks.



Read more

forum.xda-developers.com



Trying to execute/debug an existing APK file with Eclipse [android help]


Trying to execute/debug an existing APK file with Eclipse



I have an existing .APK file without any sources. I want to debug it with Eclipse on Bluestacks (or other) emulator. Eventually, I'd like to set a breakpoint, but for now, I just want to get it to run on the emulator. I'm not talking about just using adb to install it on the emulator and then run there. I've been unsuccessful in getting the resulting .apk, built by Eclipse, to run on the emulator.


Here are the steps I've done:


  1. I renamed the .apk to .zip and unzip into a folder.

  2. In Eclipse, I created a new "Android project from existing code". In the next screen, "Import Projects", I browsed to the folder where the apk was unzipped.

But this project has errors in Eclipse! So I tried the next steps:


  1. I executed apktool on the .apk, and it created a folder which I use for the same import mentioned in step 2. Now the project no longer has errors.

  2. In Eclipse, I "run as" or "debug as" this project as an Android application, and it starts on the emulator.

No good! The logcat shows errors such as "dalvikv - thread exiting with uncaught exception". And there are other logcat messages about being unable to instantiate application and java.lang.ClassNotFoundException.


QUESTION 1: Can someone tell me what other steps are necessary to turn this into a "good" project? Is there something obvious that I'm missing about Classes?


Once I can get it to either "run as" or "debug as" successfully, then I will want to debug it by setting a breakpoint. But I can't seem to get the source folder right. I have .smali files as a result of the apktool step mentioned in step 3. Also, I've tried various tools, such as dex2jar and jd-gui, so that I have .java files. But whenever I point tell Eclipse the folder where these sources are (and I have "search subfolders" checked), Eclipse says "Source not found". And "Edit Source Lookup Path". I also tried putting the sources in the /src folder of the workspace.


QUESTION 2: Where can I put the sources so that Eclipse will find them? Can these source files be either .smali or .java?



Read more

stackoverflow.comm



Wednesday, December 25, 2013

How do I display a string in an Android app? [android help]


How do I display a string in an Android app?



I'm confused on exactly what your problem is here but you have a couple problems if you want your TextView to display the message. This line here



TextView textView = new TextView(this);


will create a new TextView, not reference the one you have in your xml. And it won't show because you haven't added it to your contentView. So, when you call setContentView(R.layout.activity_display_message); what will be shown is what is in activity_display_message. If you want to access that View then you need to give it an id in your xml file and access it with findViewById(). So give it an id



android:id="@+id/tv1" // give it an id here
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entered_message" />


then access it after calling setContentView(...)



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
setContentView(R.layout.activity_display_message);
TextView tv = (TextView) findViewById(R.id.tv1); // reference it here with the id you gave it in the xml

}


Now that you have referenced the TextView, you can call setText(), setTextSize(), etc.. if need be.


I'm not exactly sure what String you want where so its hard to give much more help without a better explanation. But note that



String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);


will assign the message variable to whatever is passed in your Intent from the calling Activity.



Read more

stackoverflow.comm



Gps Location updates in android is not working [android help]


Gps Location updates in android is not working



From Android official site I have downloaded Location services example & did run in the real device. Every time onLocationChanged method is returning Network's Latitude & Longitude but not accurate GPS location. How to achieve accurate GPS locations from the new android Location API.


Here is my service code



package com.example.locationservice;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationRequest;

public class MDFYLocationUpdate extends Service implements
LocationListener,
GooglePlayServicesClient.ConnectionCallbacks,
GooglePlayServicesClient.OnConnectionFailedListener,
com.google.android.gms.location.LocationListener {

LocationClient mLocationClient;
private LocationRequest mLocationRequest;
public static Context c;
final String BROADCAST_ACTION ="current_location";
public static final String TAG="Location";
// Milliseconds per second
private static final int MILLISECONDS_PER_SECOND = 1000;
// Update frequency in seconds
public static final int UPDATE_INTERVAL_IN_SECONDS = 5;
// Update frequency in milliseconds
private static final long UPDATE_INTERVAL = 10000;
//MILLISECONDS_PER_SECOND * UPDATE_INTERVAL_IN_SECONDS;
// The fastest update frequency, in seconds
private static final int FASTEST_INTERVAL_IN_SECONDS = 1;
// A fast frequency ceiling in milliseconds
private static final long FASTEST_INTERVAL =
MILLISECONDS_PER_SECOND * FASTEST_INTERVAL_IN_SECONDS;

@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
mLocationRequest =LocationRequest.create();

mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
// Set the update interval to 5 seconds
mLocationRequest.setInterval(UPDATE_INTERVAL);
// Set the fastest update interval to 1 second
mLocationRequest.setFastestInterval(FASTEST_INTERVAL);
servicesConnected();
mLocationClient =new LocationClient(this, this, this);
}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}


@Override
public void onConnected(Bundle connectionHint) {
// TODO Auto-generated method stub

Log.d(TAG, "onconnected");
mLocationClient.requestLocationUpdates(mLocationRequest, this);
}
@Override
public void onDisconnected() {
// TODO Auto-generated method stub
Log.d(TAG, "onsisconnect");
// Destroy the current location client
mLocationClient = null;
}
@Override
public void onConnectionFailed(ConnectionResult result) {
// TODO Auto-generated method stub

}

private boolean servicesConnected() {
// Check that Google Play services is available
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
// If Google Play services is available
if (ConnectionResult.SUCCESS == resultCode) {

return true;
} else {

return false;
}
}

@Override
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
Log.d(TAG, "onLocationChanged");
Log.d(TAG, "Lat = " + location.getLatitude() + " Lng = " + location.getLongitude());
Logger.writeLog("Lat = " + location.getLatitude() + " Lng = " + location.getLongitude() + " == "+BasicDeviceInformation.getCurrentDate());

}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// TODO Auto-generated method stub
Log.d(TAG, "onStartCommand");
mLocationClient.connect();
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub

}
@Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub

}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub

}
}


Read more

stackoverflow.comm



Google Plus +1 an Google Play application? [android help]


Google Plus +1 an Google Play application?



My question is regarding the Google Play +1 button now available inside Android apps. I managed to include a fully functional +1 button inside my app, however it takes an URL as a parameter to "+1", and my question is regarding which URL should I use.


Watching the Google I/O I saw that Google will recommend apps based on what your friends +1'd, so what I'm trying to archive is creating an +1 button that will have the same behavior as +1'ing though the Google Play app details page.


Should I use the Google Play URL? What else can I do?


Thanks for responding.



Read more

stackoverflow.comm



How to begin with Android Programming? [android help]


How to begin with Android Programming?


How to begin with Android Programming? - Stack Overflow















Take the tour ×

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
















I'm an ASP Developer for a 2 years. now, i want to start with Android, but i don't know the essential of Android and have some questions about these as you seen below:


  1. What is the best reference to starting with Android?

  2. What is the best IDE to developing Android and testing the Android softwares. (my mobile is Nokia E-52 based on 'Symbian s60 v3' and i cannot test these Android softwares on a mobile platform)

  3. I want to starting Android on Windows


Big Thanks to everyone.


























What is the best reference to starting with Android? ans:- You can start with developer.android.com. It is very good whereyou can start android.


What is the best IDE to developing Android and testing the Android softwares. ans:- Eclipse IDE is best for android development and for testing you need not to buy any device at starting, you can use emulator for testing. Once you have done with training you may choose any androi ddevice depending on your requirements.


this might help you also... Android UI Design-https://www.facebook.com/groups/AndroidUI/ Android group- https://www.facebook.com/groups/andorid/ Joining here might help you.























I find this tutorial very good to start with Android: http://www.kilobolt.com/android-application-development-tutorial.html.


Official Google IDE for Android: http://developer.android.com/sdk/installing/studio.html (IntelliJ IDEA bundle). You can also use Eclipse and its Android plugin.




















default






Read more

stackoverflow.comm



Tuesday, December 24, 2013

Touch point coordinates with respect to Image after pinch zoom [android help]


Touch point coordinates with respect to Image after pinch zoom



How to calculate the coordinates with respect to image after zoom the image? To zoom the image I followed the url: https://github.com/MikeOrtiz/TouchImageView/blob/master/src/com/example/touch/TouchImageView.java.


if we touch the image at particular point before Zoom then corresponding values are



point:(3,2)
top left corner of image:(0,0)
top left corner of screen:(0,0)
scale factors:(1.25,0.98)


After zoom the image:


if we drag the image until the image top left corner coincides the screen top left corner and touch image exactly at same touch point(before pinch) then



point:(540,220)
top left corner of image:(0,0)
top left corner of screen:(0,0)
scale factors:(4.78,2.67)


if we drag the image until the image top right corner coincides with the screen top right corner and touch image exactly at same touch point(before pinch) then



point:(1080,340)
top left corner of screen:(0,0)
top left corner of image:(-2430,0)
scale factors:(4.78,2.67)


if we drag the image until the image bottom left corner coincides with the screen bottom left corner and touch image exactly at same touch point(before pinch) then



point:(670,80)
top left corner of screen:(0,0)
top left corner of image:(0,-890)
scale factors:(4.78,2.67)


if we drag the image until the image bottom right corner coincides with the screen bottom right corner and touch image exactly at same touch point(before pinch) then



point:(456,274)
top left corner of screen:(0,0)
top left corner of image:(-2430,-890)
scale factors:(4.78,2.67)


if we set the image over the screen [ not to set the any corner]



point:(743,146)
top left corner of screen:(0,0)
top left corner of image:(-1280,-423)
scale factors:(4.78,2.67)


In all the above scenarios I am getting the coordinates in touch event as



x_cord=event.getX();
y_cord=event.getY();


The touch points I am getting are with respect to the screen.


How can I calculate the touch points according to the Image?


Thanks & Regards mini.



Read more

stackoverflow.comm



Saturday, November 30, 2013

Activate setting not showing during ActiveSync config [General]


Activate setting not showing during ActiveSync config



Hi all,

I have a phone where Im trying to configure ActiveSync. It all goes "smoothly" because the account can be configured. The problem is when I try to view email on the configured account. It says that security policies have to be updated but I dont know where to go. I tried to remove and add the account again but I never see the "Activate" prompt where Im supposed to accept the security policies. Therefore, I dont see the Email app as a device administrator as I do on all the other users I have configured their accounts for.

Thanks in advance!



Read more

forum.xda-developers.com



Widget for Official Twitter App Not Updating [General]


Widget for Official Twitter App Not Updating



i noticed the widget for the official twitter app does not update at startup unless i open the app. yes, sync data is on and sync interval is set. in addition, the phone was reset and reformatted with no avail. also installed it on another device with same results. even though the widget does not update, i still get dm, mention, favorite, and retweet notifcations. strange.

the facebook widget will always update at startup. i also use the seesmic widget which updates at startup. difference between facebook and seesmic is that seesmic has an option in the settings, "launch at startup" in "misc". after the device is turned on and completes loading up, the app does not open but starts running in the background. going back to facebook, it doesnt have an option like that. regardless, it starts running in background.

finally, the question. how do we get the twitter app to run in the background at startup so the widget can update?

btw, already tried 3 different startup manager apps but they open the twitter app at startup. it will get the widget to udpate because the app is now opened but thats not what im looking for.



Read more

forum.xda-developers.com



I need help asap! [General]


I need help asap!



I have a Samsung Galaxy S3, US Cellular SCH-R530. I recently switched from apple, and I was getting bad signal. My friend said that he would fix it, and he tried downgrading my phone from 4.3 Jelly Bean to 4.2 Jelly Bean. And now my phone is stuck in "Firmware upgrade encountered an issue. Please select recovery mode in Kies & try again. I use my phone daily, and for a lot of purposes. He said he didn't know how to fix it, and kind of left me hanging without a phone. SO I really need to know how to fix this. Please anyone help me!



Read more

forum.xda-developers.com



Return Nexus 4 to darker Holo theme post KitKat? Possible? [General]


Return Nexus 4 to darker Holo theme post KitKat? Possible?



Well, just got my Nexus 4 upgraded to KitKat and frankly the bright white backgrounds hurt the hell out of my eyes (I have bad eyes) especailly on the formerly nice and dark holo-themed Dialer app. Is there any way to get the lovely and easy to look at grey/black and blue holo theme back for the dialer? This new stark white nonsense that's been forced on me actually causes me physical pain. I know this won't be a problem for many, but I just want my dark theme back if anyone can point me in the right direction



Read more

forum.xda-developers.com



Friday, November 29, 2013

Phone-to-PC connection app [General]


Phone-to-PC connection app



Hi folks.

Big hands + small phone = need for a GOOD phone-to-PC connection app.

Phone is a Medion E4002 (bought from Aldi) running Android 4.1.1. Does everything I want and great value for money.

I've tried a few apps but so far not found anything that easily allows me to do all my phone editing on the PC screen – mainly extensive contacts editing, but also file transfer etc. Texting is a big one too, as I need to frequently send text messages to groups.

I want an app that loads when I want to use it, not when it thinks it's needed – some are really annoying in this respect.

I sit at my desk all day with phone beside me so connection will always be via USB cable. Don't care about other connection types (Bluetooth, etc).

Any suggestions?



Read more

forum.xda-developers.com



Get the length of video recorded so far (or get accurate start time) [android help]


Get the length of video recorded so far (or get accurate start time)


java - Get the length of video recorded so far (or get accurate start time) - 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 want to synchronize other sensor data with the video I'm recording, and so I'd like to record "how far am I into the video" when the sensor is triggered. Is there any way to do this? I couldn't find an appropriate method on the MediaRecorder class.


Another solution would be to just get the precise start time of the video recording, but my tests show that the video starts ~1sec after calling mediarecorder.start, but it's not consistent.


























You have raised an interesting topic.
If you refer to the documentation in the developer page, the following diagram states the recording is supposed to start when the start() method is called.


enter image description here
Your solution is supposed to be correct albeit there is a lag up to 1 sec. I would do it the same way
I went through the MediaRecorder class methods, the only method that seems to be useful is the callback setOnInfoListener().
Set it and see if you will get some kind of information when the recording starts! I haven't tried it yet though.




















lang-java






Read more

stackoverflow.comm



Gesture OnFling not called in ListView [android help]


Gesture OnFling not called in ListView



I need some help with handling the gestures on a listview. I have an videoview that I want to be able to detect left and right swipes on the layout below:


Link to a drawing of the current gesture and what is expected


The onFling method that i used to capture the event is not called



public class OnSwipeTouchListener implements OnTouchListener {

private final GestureDetector gestureDetector;
private FeedAdapter callback;

public OnSwipeTouchListener(Context context, FeedAdapter callback) {
gestureDetector = new GestureDetector(context, new GestureListener());
this.callback = callback;
}
@Override
public boolean onTouch(final View view, final MotionEvent motionEvent) {
return gestureDetector.onTouchEvent(motionEvent);
}

private final class GestureListener extends SimpleOnGestureListener {

private static final int SWIPE_THRESHOLD = 30;

@Override
public boolean onDown(MotionEvent e) {
return true;
}


public boolean onSingleTapUp(MotionEvent e) {
Log.v("Tom", "tap");
triggerTouch();
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
boolean result = false;
Log.v("Swipe","is called"); // this is not called when swipe is not perfectly straight
try {
float diffX = e2.getX() - e1.getX();
if (Math.abs(diffX) > SWIPE_THRESHOLD) {
if (diffX > 0) {
onSwipeRight();
} else {
onSwipeLeft();
}
}
} catch (Exception exception) {
exception.printStackTrace();
}
return result;
}
}

public void onSwipeRight() {
}

public void onSwipeLeft() {
}

public void triggerTouch() {
}

public void onSwipeBottom() {
}
}


So how to make the onFling be called when user swipes slightly off horizontal?


Thank you for your help!


Tommy



Read more

stackoverflow.comm



Push notification to send from admin app to user app in android [android help]


Push notification to send from admin app to user app in android



I am working on android applications. I have two apps, user app and admin app. My requirement is the user sends request to admin app, and when the admin finds if the request is useful then it will accept the request and will send a notification to the user.


Due to some problems I cant use either php or .net webservice to send the push notification to user app. So I used third party library to send the notification. I followed the tutorial of parse push notification from https://parse.com/tutorials/android-push-notifications and worked on that example. I am able to send the notification to my application.


But here according to my requirement, when the admin app sends a request to user app, how will it uniquely identifies the user. There will be so many users who use my app. Once the admin accepts the request of a particular user it will send a notificatin to only that particular user. How can I achieve this task using parse push notification.


I am storing the user details and admin details in server database.


Will be really thankful for any suggestions.



Read more

stackoverflow.comm



Thursday, November 28, 2013

How to have a getStringExtra message before onCreate method? [android help]


How to have a getStringExtra message before onCreate method?


java - How to have a getStringExtra message before onCreate method? - 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 have two activities which in the first one I make a message and by putExtra I move it to next activity. But as you know to get the message in the secind activity I need to have getStringExtra in onCreate method. In the other hand I really need to have that message before onCreate starts. So how can I have that.



public class Result extends Activity {
String url; // <<< I need the message to put it here

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_result);

Intent intent = getIntent();
String mainURL = intent.getStringExtra(SingleSearchPage.EXTRA_MESSAGE); // Here is the message

url = mainURL; //Tried to change the value of URL but did not work

new GetJSONTask().execute(url);

}
class GetJSONTask extends AsyncTask {


protected JSONObject doInBackground(String... urls) {
// Creating new JSON Parser
JSONParser jParser = new JSONParser();

// Getting JSON from URL
JSONObject json = jParser.getJSONFromUrl(url);

return json;
}


Any idea to have the value of intent message before the onCreate?



















lang-java






Read more

stackoverflow.comm



Android SDK Eclipse Issue with Running in Emulator [android help]


Android SDK Eclipse Issue with Running in Emulator



I am building the layout for an android app. I am not getting any errors when running the app; however, I am getting an error right away when the app launches in the emulator. I am assuming it is a layout rendering fault. Where can I view the error, because no errors are shown in Eclipse.



Read more

stackoverflow.comm



Using get() and put() to access pixel values in OpenCV for JAVA [android help]


Using get() and put() to access pixel values in OpenCV for JAVA



I am a beginner in using OpenCV for JAVA. I want to access individual pixel values of an image matrix. Since, JAVA jar for OpenCV doesn't offer nice functions like C++, I ran into some trouble. After lot of searching, I found out two different methods to do that though they are not explained properly (not even in documentation). We can do that either using get() and put() functions or by converting the mat data into a primitive java type such as arrays. I tried both but getting different output results! Please help explaining what am I doing wrong. Am I using them wrong or some other silly problem. I am still a newbie so please forgive if its a stupid question. :)


CASE 1: Using get() function



Mat A = Highgui.imread(image_addr); \\"image_addr" is the address of the image
Mat C = A.clone();
Size sizeA = A.size();
for (int i = 0; i < sizeA.height; i++)
for (int j = 0; j < sizeA.width; j++) {
double[] data = A.get(i, j);
data[0] = data[0] / 2;
data[1] = data[1] / 2;
data[2] = data[2] / 2;
C.put(i, j, data);
}


CASE 2: Using Array



Mat A = Highgui.imread(image_addr); \\"image_addr" is the address of the image
Mat C = A.clone();
int size = (int) (A.total() * A.channels());
byte[] temp = new byte[size];
A.get(0, 0, temp);
for (int i = 0; i < size; i++)
temp[i] = (byte) (temp[i] / 2);
C.put(0, 0, temp);


Now according to my understanding they both should do the same thing. They both access the individual pixel values (all 3 channels) and making it half. I am getting no error after running. But, the output image I am getting is different in these two cases. Can someone please explain what is the issue? May be I don't understand exactly how get() function works? Is it because of the byte() casting? Please help.


Thanks!



Read more

stackoverflow.comm



Monday, November 25, 2013

Error #1009: Cannot access a property or method of a null object reference. -AS3 [android help]


Error #1009: Cannot access a property or method of a null object reference. -AS3



i got this error:



TypeError: Error #1009: Cannot access a property or method of a null object reference.
at TriviaGameDeluxe/saveScore()[TriviaGameDeluxe::frame102:19]


This is my code:



//**//
playAgainbutton.addEventListener(MouseEvent.CLICK,saveScore);


function saveScore(event:MouseEvent) { // Save the score


if (savedSN == null) { // Check if a game save is created. If it is not, create one
trace("New game save created");
savedSN = { // Set the varible 'savedSN'
name1:"-",
name2:"-",
name3:"-",
name4:"-",

score1:"-",
score2:"-",
score3:"-",
score4:"-"};
soSavedScNa.data.nameScore = savedSN; // Set the data in the save file to the
savedSN variable
soSavedScNa.flush(); // Overwrite existing save file

}

//**// Save the score
if ((gameScore > savedSN.score1 || savedSN.score1 == "-") &&
gameScore != 0) {
trace("Score 1");
savedSN = { // Set the date the savedSN varible will have
name1:PName.text,
name2:savedSN.name1,
name3:savedSN.name2,
name4:savedSN.name3,
score1:gameScore,
score2:savedSN.score1,
score3:savedSN.score2,
score4:savedSN.score3};
soSavedScNa.data.nameScore = savedSN; // Set the data in
the save file to the savedSN variable
soSavedScNa.flush(); // Overwrite existing save file
playAgainbutton.removeEventListener(MouseEvent.MOUSE_UP,
saveScore);
cleanUp();
gotoAndStop(1); // Go to the start menu
} else if ((gameScore > savedSN.score2 || savedSN.score2 == "-") &&
gameScore != 0) {
trace("Score 2");
savedSN = { // Set the date the savedSN varible will have
name1:savedSN.name1,
name2:PName.text,
name3:savedSN.name2,
name4:savedSN.name3,
score1:savedSN.score1,
score2:gameScore,
score3:savedSN.score2,
score4:savedSN.score3};
soSavedScNa.data.nameScore = savedSN; // Set the data in
the save file to the savedSN variable
soSavedScNa.flush(); // Overwrite existing save file
playAgainbutton.removeEventListener(MouseEvent.MOUSE_UP,
saveScore);
cleanUp();
gotoAndStop(1);
// Go to the start menu
} else if ((gameScore > savedSN.score3 || savedSN.score3 == "-") &&
gameScore != 0) {
trace("Score 3");
savedSN = { // Set the date the savedSN varible will have
name1:savedSN.name1,
name2:savedSN.name2,
name3:PName.text,
name4:savedSN.name3,
score1:savedSN.score1,
score2:savedSN.score2,
score3:gameScore,
score4:savedSN.score3};
soSavedScNa.data.nameScore = savedSN; // Set the data in
the save file to the savedSN variable
soSavedScNa.flush(); // Overwrite existing save file
playAgainbutton.removeEventListener(MouseEvent.MOUSE_UP,
saveScore);

cleanUp();
gotoAndStop(1); // Go to the start menu
} else if ((gameScore > savedSN.score4 || savedSN.score4 == "-") &&
gameScore != 0) {
trace("Score 4");
savedSN = { // Set the date the savedSN varible will have
name1:savedSN.name1,
name2:savedSN.name2,
name3:savedSN.name3,
name4:PName.text,
score1:savedSN.score1,
score2:savedSN.score2,
score3:savedSN.score3,
score4:gameScore};
soSavedScNa.data.nameScore = savedSN; // Set the data in
the save file to the savedSN variable
soSavedScNa.flush(); // Overwrite existing save file
playAgainbutton.removeEventListener(MouseEvent.MOUSE_UP,
saveScore);
cleanUp();
gotoAndStop(1); // Go to the start menu
}
}


I cannot find where the error is.. Hope anybody can help. Thanks.



Read more

stackoverflow.comm



File object can't find the file when there is one [android help]


File object can't find the file when there is one



In my app After user clicks on a button ,the download manager starts to download a file from internet and saving it to the internal sd card using this code:



void startDownload()
{
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).mkdirs();
download_req.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE)
.setAllowedOverRoaming(false)
.setTitle(PersianReshape.reshape("Downloading"))
.setDescription(PersianReshape.reshape("currently downloading the file..."))
.setDestinationInExternalPublicDir(Environment.getExternalStorageDirectory().getAbsolutePath() , packageId + ".sqlite");
download_ID = mgr.enqueue(download_req);
}


After it is downloaded, I plan to check its existance everytime app runs with this code:



String DatabaseAddress =
Environment.getExternalStorageDirectory().getAbsolutePath() +
"/ee.sqlite";
File file = new File(DatabaseAddress);
Log.d("PATH File: ", DatabaseAddress);
if (file.exists()){
Toast.makeText(getApplicationContext(), "found", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getApplicationContext(), "not found", Toast.LENGTH_SHORT).show();
}


Now when I run this code it returns "not found" message whereas the file is already there (I checked its existance using a file manager).


the device I test on is nexus 7 and path used in saving the download file is: /storage/emulated/0/ee.sqlite


ee.sqlite is the filename of downloaded file.


/storage/emulated/0/ is the default path returned by app


Permissions added to manifest for this code are:







Q: Why does file.exists() returns false when there is a file?



Read more

stackoverflow.comm



Disable checkbox if X are checked in android [android help]


Disable checkbox if X are checked in android



I have 15 CheckBox and I must to stuck user when he checks more than 5 CheckBox. Is it possible? I used the method OnCheckedChangeListener to know if an item was checked... but I don't know how to make a limit after 5 items selected. See what I've tried to do below:


I instante my integer:



int lengthBox = 15;
int lenghtMax = 5;


I select all my View in onCreate():



View[] tagsItem = new View[] {
findViewById(R.id.TagsCheckAA),
findViewById(R.id.TagsCheckBB),
findViewById(R.id.TagsCheckCC),
findViewById(R.id.TagsCheckDD),
findViewById(R.id.TagsCheckEE),
findViewById(R.id.TagsCheckFF),
findViewById(R.id.TagsCheckGG),
findViewById(R.id.TagsCheckHH),
findViewById(R.id.TagsCheckII),
findViewById(R.id.TagsCheckJJ),
findViewById(R.id.TagsCheckKK),
findViewById(R.id.TagsCheckLL),
findViewById(R.id.TagsCheckMM),
findViewById(R.id.TagsCheckNN),
findViewById(R.id.TagsCheckOO)
};


I create 15 CheckBox:



final CheckBox[] tagsCheck = new CheckBox[lengthBox];


Create the method (and it's here where I don't know what to do exactly):



OnCheckedChangeListener checker = new OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton cb, boolean b) {
if(tagsCheck[0].isChecked() || tagsCheck[1].isChecked() ||
tagsCheck[2].isChecked() || tagsCheck[3].isChecked() ||
tagsCheck[4].isChecked() || tagsCheck[5].isChecked() ||
tagsCheck[6].isChecked() || tagsCheck[7].isChecked() ||
tagsCheck[8].isChecked() || tagsCheck[9].isChecked() ||
tagsCheck[10].isChecked() || tagsCheck[11].isChecked() ||
tagsCheck[12].isChecked() || tagsCheck[13].isChecked() ||
tagsCheck[14].isChecked()) {
if(lenghtCount < 5){
// How can I get the String of the CheckBox
// which just checked?
String tags = (String) tagsCheck[].getText();
Toast.makeText(getApplicationContext(),
tags + " checked", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getApplicationContext(),
"Limit reached!!!", Toast.LENGTH_SHORT).show();
}
}
}
};


After this, I set my View id to my CheckBox and call the method:



for(int i = 0; i < lengthBox; i++) {
tagsCheck[i] = (CheckBox) tagsItem[i];
tagsCheck[i].setOnCheckedChangeListener(checker);
}


Can someone point me in the right way, please?


Thanks, any help will be appreciate.



UPDATE:


I found an inelegant way with an if(tagsCheck[0].isChecked() || ...). But I have still a problem: how can I get the CheckBox which just checked? Cause of my if(), I don't know how can I do this.


Thanks!



Read more

stackoverflow.comm



MediaRecorder crash [android help]


MediaRecorder crash




Very beginner in Android/Java, coming from C and Symbian, I started from the Hellworld example to try to display the sound level (the project is to record this level in a text file for hours). This code is written in the MainActivity file, as a method inside the MainActivity Class :



public void GetAFlevel(View view) throws IllegalStateException, IOException {
float audiolevel = 0, maxal = 0;
MediaRecorder mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.setOutputFile("/dev/null");
mRecorder.prepare();
mRecorder.start();
for (int i = 0; i < 1000; i++) {
audiolevel = mRecorder.getMaxAmplitude();
if (audiolevel > maxal)
maxal = audiolevel;
}
EditText editText1 = (EditText) findViewById(R.id.editText1);
editText1.setText(String.valueOf(maxal));
mRecorder.stop();
mRecorder.release();
mRecorder = null;
}


The result is a crash of the application on the target :



11-17 00:23:09.859: D/AndroidRuntime(22096): Shutting down VM

11-17 00:23:09.859: W/dalvikvm(22096): threadid=1: thread exiting with uncaught exception (group=0x40018578)

11-17 00:23:09.921: E/AndroidRuntime(22096): FATAL EXCEPTION: main

11-17 00:23:09.921: E/AndroidRuntime(22096): java.lang.IllegalStateException: Could not execute method of the activity


No crash if I remove the following MediaRecorder functions : setAudioSource, setOutputFormat, setAudioEncoder, setOutputFile, prepare, start and stop, but getMaxAmplitude returns 0, of course.


As soon as I add only setAudioSource (normaly the only necessary for getMaxAmplitude), crash !


Any idea ?


Thanks in advance.



Read more

stackoverflow.comm



Sunday, November 24, 2013

Why can't I take screenshots in Android Emulator after installing Genymotion? [android help]


Why can't I take screenshots in Android Emulator after installing Genymotion?


Why can't I take screenshots in Android Emulator after installing Genymotion? - 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've installed Genyomtion android emulator. Then I realized I can't take screenshots in Eclipse DDMS view. After that, I tried to take a screenshot with standard android emulator that comes with the SDK. It didn't work. Eclipse shows me a black image instead of screenshot. It worked before I installed Genymotion! It's suspicious that Genymotion hacked my ADB, because screenshot taking is part of PAID version of GenyMotion!


Has anyone experienced the same problem? How can I get Eclipse taking screenshots again without reinstalling it?


Thanks in advance!


























It's a known bug on 4.3 images, they are working on a fix. On a 4.2.2 image it's working for me, you can try to create a 4.2.2 device to take screenshot in the meantime.


Source: On twitter @genymotion responded to @Littledot1230 on this question :)























I have just used Genymotion and Eclipse DDMS today to take a screenshot for an app store submission.


So it works on at least these versions on my Win8 Pro machine:


  • Genymotion v1.1.0

  • Android 4.2.2 10" image

  • Eclipse ADT v22.0.1

Edit: so 4.2.2 is why mine worked - thanks Bonrry























default






Read more

stackoverflow.comm



Screen becomes blank for long time while loading SherlockFragmentActivity with fragments [android help]


Screen becomes blank for long time while loading SherlockFragmentActivity with fragments



I am implementing jeremyfeinstein sliding menu library. for this I have an activity which extends SherlockFragmentActivity. for this activity I have two fragments one is for left menu and another is for Main screen. Everything is working fine and smooth but still I have a problem that is when my Sliding menu activity starts, it becomes blank for 8-10 seconds. after 8-10 seconds my main screen fragment becomes visible. this is my base class:



public class SlidingFragmentActivity extends SherlockFragmentActivity implements SlidingActivityBase {

private SlidingActivityHelper mHelper;

/* (non-Javadoc)
* @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mHelper = new SlidingActivityHelper(this);
mHelper.onCreate(savedInstanceState);
}

/* (non-Javadoc)
* @see android.app.Activity#onPostCreate(android.os.Bundle)
*/
@Override
public void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mHelper.onPostCreate(savedInstanceState);
}

/* (non-Javadoc)
* @see android.app.Activity#findViewById(int)
*/
@Override
public View findViewById(int id) {
View v = super.findViewById(id);
if (v != null)
return v;
return mHelper.findViewById(id);
}

/* (non-Javadoc)
* @see android.support.v4.app.FragmentActivity#onSaveInstanceState(android.os.Bundle)
*/
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mHelper.onSaveInstanceState(outState);
}

/* (non-Javadoc)
* @see android.app.Activity#setContentView(int)
*/
@Override
public void setContentView(int id) {
setContentView(getLayoutInflater().inflate(id, null));
}

/* (non-Javadoc)
* @see android.app.Activity#setContentView(android.view.View)
*/
@Override
public void setContentView(View v) {
setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}

/* (non-Javadoc)
* @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
*/
@Override
public void setContentView(View v, LayoutParams params) {
super.setContentView(v, params);
mHelper.registerAboveContentView(v, params);
}

/* (non-Javadoc)
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
*/
public void setBehindContentView(int id) {
setBehindContentView(getLayoutInflater().inflate(id, null));
}

/* (non-Javadoc)
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
*/
public void setBehindContentView(View v) {
setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}

/* (non-Javadoc)
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
*/
public void setBehindContentView(View v, LayoutParams params) {
mHelper.setBehindContentView(v, params);
}

/* (non-Javadoc)
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
*/
public SlidingMenu getSlidingMenu() {
return mHelper.getSlidingMenu();
}

/* (non-Javadoc)
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#toggle()
*/
public void toggle() {
mHelper.toggle();
}

/* (non-Javadoc)
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showAbove()
*/
public void showContent() {
mHelper.showContent();
}

/* (non-Javadoc)
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showBehind()
*/
public void showMenu() {
mHelper.showMenu();
}

/* (non-Javadoc)
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
*/
public void showSecondaryMenu() {
mHelper.showSecondaryMenu();
}

/* (non-Javadoc)
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
*/
public void setSlidingActionBarEnabled(boolean b) {
mHelper.setSlidingActionBarEnabled(b);
}

/* (non-Javadoc)
* @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
*/
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
boolean b = mHelper.onKeyUp(keyCode, event);
if (b) return b;
return super.onKeyUp(keyCode, event);
}

}


Here is my Main activity which loads fragments



public class SliderMenuMainActivity extends SlidingFragmentActivity
{
private Fragment mContent;
ImageButton btnToggle,refresh;
String ns = Context.NOTIFICATION_SERVICE;
public static int msg_count = 0;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(obj==null)
obj=new Progress_Dialog(this);
obj.setCancelable(false);
obj.onPreExecute("MAIN Screen");
if (savedInstanceState != null)
mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
prepareScreen();
}
private void prepareScreen()
{
setContentView(R.layout.activity_slider_menu_main);

ActionBar ab = getSherlock().getActionBar();
LayoutInflater li = LayoutInflater.from(this);
View customView = li.inflate(R.layout.custom_titlebar, null);
customView.setLayoutParams(new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT ,ActionBar.LayoutParams.MATCH_PARENT));
ab.setCustomView(customView);
ab.setDisplayShowHomeEnabled(false);
ab.setDisplayShowCustomEnabled(true);
if (findViewById(R.id.menu_frame) == null)
{
setBehindContentView(R.layout.menu_frame);
getSlidingMenu().setSlidingEnabled(true);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
// show home as up so we can toggle
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
else
{
// add a dummy view
View v = new View(this);
setBehindContentView(v);
getSlidingMenu().setSlidingEnabled(false);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
}


if (mContent == null)
mContent = new MainScreenFragment();

getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, mContent).commit();

// set the Behind View Fragment
getSupportFragmentManager().beginTransaction().replace(R.id.menu_frame, new MenuFragment()).commit();

// customize the SlidingMenu
SlidingMenu sm = getSlidingMenu();
sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
sm.setShadowWidthRes(R.dimen.shadow_width);
sm.setShadowDrawable(R.drawable.shadow);
sm.setBehindScrollScale(0.25f);
sm.setFadeDegree(0.25f);
setSlidingActionBarEnabled(false);

}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
toggle();
}
return super.onOptionsItemSelected(item);
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
getSupportFragmentManager().putFragment(outState, "mContent", mContent);
}
public void switchContent(final Fragment fragment) {
mContent = fragment;
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, fragment)
.commit();
Handler h = new Handler();
h.postDelayed(new Runnable() {
public void run() {
getSlidingMenu().showContent();
}
}, 50);
}

@Override
public void onResume()
{
super.onResume();
if(obj!=null)
obj.onPostExecute();
}
}


So please help me with this and show me a way to overcome this problem. thanks in advance.



Read more

stackoverflow.comm



Tuesday, November 19, 2013

Samsung Galaxy-Q gets stuck on startscreen and recovery screen wont boot, HELP PLEASE. NEED PHONE! [General]


Samsung Galaxy-Q gets stuck on startscreen and recovery screen wont boot, HELP PLEASE. NEED PHONE!



Hey guys, just got a samsung galaxy-Q from a friend and shortly after recieving memory errors my phone got stuck on its startscreen so I looked online for help and it said to use the reboot option in the recovery screen but my phone wont launch it for some reason after trying over a thousand times.. PLEASE SOMEONE HELP!! I need my phone very urgently for buisness



Read more

forum.xda-developers.com



Monday, November 18, 2013

Android KitKat set language for Bluetooth voice dial [General]


Android KitKat set language for Bluetooth voice dial



Android KitKat set language for Bluetooth voice dial

Hi, i'm having a problem with my new Nexus 5. Please note this is my first android device.

I cant figure out how to change the input language for dialing with a bluetooth headset which is pretty annoying since most of my contacts have french names. Everything else works fine with french voice commands on the phone except for the bluetooth voice dialer which always specifies English on the top right.

Android KitKat set language for Bluetooth voice dial-bluetoothlang.jpg

Can anyone tell me how to change this? I would prefer to keep the menus un english if possible, but I have even tried removing english and setting french everywhere and it didn't change the voice dialing option.

Thank you



Read more

forum.xda-developers.com



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...