Saturday, April 13, 2013

[android help] The import com.google.android.gms cannot be resolved



I checked off Google API as project build target.



That is irrelevant, as that is for Maps V1, and you are trying to use Maps V2.



I included .jar file for maps by right-clicking on my project, went to build path and added external archive locating it in my SDK: android-sdk-windows\add-ons\addon_google_apis_google_inc_8\libs\maps



This is doubly wrong.


First, never manually modify the build path in an Android project. If you are doing that, at best, you will crash at runtime, because the JAR you think you put in your project (via the manual build path change) is not in your APK. For an ordinary third-party JAR, put it in the libs/ directory of your project, which will add it to your build path automatically and add its contents to your APK file.


However, Maps V2 is not a JAR. It is an Android library project that contains a JAR. You need the whole library project.


You need to import the android-sdk-windows\add-ons\addon_google_apis_google_inc_8 project into Eclipse, then add it to your app as a reference to an Android library project.



.

stackoverflow.comm

[android help] how to costume android default classes(datepicker,numpicker,etc)


I want to make a custom date-picker for android and I need to change something in datepicker.class file in android.widget package. In fact, I want to change the year and month for solar hijri calendar.


I found source code of datepicker.java in http://alvinalexander.com/java/jwarehouse/android/core/java/android/widget/DatePicker.java.shtml - but I don't know how to change and replace it with default android class. Does anybody know how to do this?



.

stackoverflow.comm

[android help] Android: included layout not filling parent width


I have a main layout in which I include two inner layouts. I am specifying the width of the included layouts to match_parent but they don't occupy the entire width of the parent.


See example below: main_layout.xml



xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="5dp"
android:baselineAligned="false"
android:orientation="vertical" >

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.95" >

android:id="@+id/tableRow1"
android:layout_weight="0.8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp" >

android:layout_width="match_parent"
android:layout_height="wrap_content" />


android:id="@+id/tableRow2"
android:layout_weight="0.2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp" >

android:layout_width="match_parent"
android:layout_height="wrap_content" />



android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_weight="0.05"
android:gravity="center"
android:orientation="vertical">

android:layout_width="80dp"
android:layout_height="40dp"
android:textSize="14sp"
android:textStyle="bold"
android:text="Bottom" />





child_layout




android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

android:id="@+id/leftLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:orientation="vertical" >

android:layout_width="80dp"
android:layout_height="40dp"
android:textSize="14sp"
android:textStyle="bold"
android:text="Left" />


android:id="@+id/rightLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:orientation="vertical" >

android:layout_width="80dp"
android:layout_height="40dp"
android:textSize="14sp"
android:textStyle="bold"
android:text="Right" />





Notice that the left and right buttons are overlapped in the image.enter image description here. How do I expand the included layout to fill the entire width of the parent so that the left and right buttons appear on left and right. Thank You.



.

stackoverflow.comm

[android help] Dialog throwing "Unable to add window — token null is not for an application” with getApplication() as context


My Activity is trying to create an AlertDialog which requires a Context as a parameter. This works as expected if I use:



AlertDialog.Builder builder = new AlertDialog.Builder(this);


However, I am leery of using "this" as a context due to the potential for memory leaks when Activity is destroyed and recreated even during something simple like a screen rotation. From a related post on the Android developer's blog:



There are two easy ways to avoid context-related memory leaks. The most obvious one is to avoid escaping the context outside of its own scope. The example above showed the case of a static reference but inner classes and their implicit reference to the outer class can be equally dangerous. The second solution is to use the Application context. This context will live as long as your application is alive and does not depend on the activities life cycle. If you plan on keeping long-lived objects that need a context, remember the application object. You can obtain it easily by calling Context.getApplicationContext() or Activity.getApplication().



But for the AlertDialog() neither getApplicationContext() or getApplication() is acceptable as a Context, as it throws the exception: "Unable to add window — token null is not for an application” per references: 1, 2, 3, etc.


So, should this really be considered a "bug", since we are officially advised to use Activity.getApplication() and yet it doesn't function as advertised?


Jim



.

stackoverflow.comm

[General] A week ago I bought an android go phone, It now doesnt fully open up


So, About a week later, The screen will still turn on, But its still black, With a small amount of light coming through, Any help would be great, Wal mart nor AT&T wasn't any help at all.



.

forum.xda-developers.com

[General] IMEI number lost


I am porting JB rom from a phone which has similar specs and hardware as my phone I have tried the rom without making any changes to it but I lost my IMEI and network other than that the rom worked fine but the main purpose of the phone was lost. I am looking for a way to make this rom compatible with my phone so that I don't lose my IMEI number and thus the network. Is there any specific folder or file which I need to take care of while porting the rom to my phone, BTW my phone is on ICS and I want to port JB.

Kindly help me I desparetly waiting for a response!



.

forum.xda-developers.com

[General] Unrooting Note2 that only comes to CWM- based recovery


I have to get it repaired because I can't charge it anymore, it stopped detecting the cable or charging yesterday. But if I plug it in I can still come to recovery (0% battery ). I am scared of voiding my warranty because it is rooted. Can I connect it to my computer somehow? If I try to boot it up completely it shuts down because of not enough power.



.

forum.xda-developers.com

[General] Phone or system


I have an LG My Touch with Android OS 2.3.6 Phone lately weirding out . I reboot everyday and clear cache. It seems what ever I do its slow and stuff opens and closes at times
What should I try next
Paul



.

forum.xda-developers.com

[General] Need help with using an upgrade on ATT


Sorry if this has already been discussed, but I did a search of this forum and a few others, as well as a general Google search, and found nothing. Here's the situation:

We have a five-phone account with ATT. Three of the lines are smartphones with data plans (one large, two minimum, so no "unlimited" to worry about keeping). My wife and I are the two small-data plans. Our two phones are not eligible for upgrade until June 1st. My wife has had it with her phone and wants a new one, pronto. (She even threw it onto the floor of the car last week, out of frustration; that was a FIRST!)

Our other two lines are dumb-phones with no data, for mom and dad. Those are eligible for upgrade right now. I have heard some people say that you can use your upgrade (and, of course, sign a new 2-year extension) for one of these dumb-phone lines, but activate the phone on your line. Is it as easy as that, or do I have to jump through a bunch of hoops? If the former, I'll get something in the coming week; if not, I'll have to wait until June, assuming she doesn't toss it out the window before then.

Thanks for any assistance you can give!



.

forum.xda-developers.com

[General] Problem With Play Store on GS3


My GF and I have GS3's and the other day when the Disney games went free, she attmepted to download Where's My Water. Halfway through, she decided she didn't want it and canceled the download. Then she went to download Where's My Perry and Play Store closed. She went to open it back up and it just closes. After several tries, this message pops up.

"Unfortunately, Google Play Store has stopped."

After restarting phone, installing the new play store, and removing the battery, the problem persists.

Once and awhile it will say...

"Billing is not supported on this version of Android Market."

Now when she tries, it says...

"Unfortunately, the process com.google.process.gapps has stopped."

I have tried to research a solution but I keep coming up with nothing. I'm hoping to not have to do a hard reset but I will if I have to fix the problem.

I downloaded the games and I am having no problems at all. My GS3 runs perfectly.

Does anyone have any idea of how to fix this situation short of a hard reset?

Help is very very appreciated.

Over all I have done the following...

-Clear App Data and Cache
-Cleared everything, rebooted, and installed a fresh APK of Google Play Store
-Power Cycled the phone



.

forum.xda-developers.com

[android help] ViewPager & ImageView zooming issue


Yes I too had the same problem not with TouchImageView.


Too solved the problem what i did is disabled the ViewPager when my view is getting the focus.



public class EnableDisableViewPager extends ViewPager {

private boolean enabled = true;

public EnableDisableViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}

@Override
public boolean onInterceptTouchEvent(MotionEvent arg0) {
if(enabled)
return super.onInterceptTouchEvent(arg0);

return false;
}

public boolean isEnabled() {
return enabled;
}

public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}


so in TouchImageView implement your listener to trigger an event whether its zooming or dragging.


set listener to your view object in your Activity. So when those event occur just disable the view Pager.


Note: you will also need a mouse up event to enable the viewpager.


EDITED


This will work only for Zoom, so for ViewPager to swipe pages you should zoom back to original.


Add these code to your TouchImageView



public class TouchImageView extends ImageView {

...
private TouchEventListener touchEventListener;

private void sharedConstructing(Context context) {
...

setOnTouchListener(new OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
...
case MotionEvent.ACTION_UP:
...
if(touchEventListener != null)
{
if(saveScale == 1.0)
touchEventListener.onZoomToOriginal();
else
touchEventListener.onZoom();
}
break;

...
}
...
}

});
}

...

public TouchEventListener getTouchEventListener() {
return touchEventListener;
}

public void setTouchEventListener(TouchEventListener touchEventListener) {
this.touchEventListener = touchEventListener;
}


public interface TouchEventListener
{
void onZoom();
void onZoomToOriginal();
}
}


.

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