on Friday, October 31, 2014


Is there a way to change a PolygonOption's fill color after it has been drawn and update a Google map without clearing and redrawing it?


What I'm currently doing is



polygonOptions.fillColor(context.getResources().getColor(R.color.polygonSolidFill));
polygonOptions.strokeWidth(2);
polygonOptions.strokeColor(Color.BLACK);
// Add some LatLngs
googleMap.addPolygon(polygonOptions);


When the user is at a certain location I want to change the fill color. What I'm doing to achieve the color update is



polygonOptions.fillColor(context.getResources().getColor(R.color.polygonSolidFill2));
googleMap.clear();
googleMap.addPolygon(polygonOptions);


However there is a small flicker in the map when its cleared and redrawn which I would like to avoid.




I want to remove all of the shared preferences (and files) inside of my application using one button. Essentially simulating an uninstall. I understand that SharedPreferences.Editor has a clear() method, but it doesn't seem to actually delete the xml file created by SharedPreferences.




I'm trying to pull a php page to string on android. The problem is that I can't get the response_str variable outside of the try. Whatever I'm doing it keep returning null. The URL return 1 or 0.


this is my code:



public String IsLoggedIn() {
String url_text = "http://klh-dev.com/lehava/lehava/system/isloggedin.php";
String response_str = null;
try {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url_text.toString());
ResponseHandler<String> responseHandler = new BasicResponseHandler();
response_str = client.execute(request, responseHandler);
}
catch (Exception e) {
}
return response_str;
}


Thank you, Morha13




The reason is that ones i fill in my user name, and password and click login button it is loads again at page requires tu fill user name, and password here is my source code


public class MainActivity extends Activity {



private EditText mTextUserName;
private EditText mTextPassword;
public String user_name;
public String pass_word;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTextUserName = (EditText) findViewById(R.id.textUserName);
mTextPassword = (EditText) findViewById(R.id.textPassword);


final Button mButtonLogin = (Button) findViewById(R.id.buttonLogin);
mButtonLogin.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {

user_name = mTextUserName.getText().toString();
pass_word = mTextPassword.getText().toString();
// i am passing this intent
Intent goToNextActivity = new Intent(getApplicationContext(), ViewActivity.class);

goToNextActivity.putExtra("username", user_name);
goToNextActivity.putExtra("password", pass_word);

startActivity(goToNextActivity);


}
});
}


and in mine ViewActivity also public class ViewActivity extends Activity {



private WebView webView;
public String pass_word;
public String user_name;

public void onCreate(Bundle savedInstanceState) {


super.onCreate(savedInstanceState);
setContentView(R.layout.view);
webView = (WebView) findViewById(R.id.webView);

webView.getSettings().setUseWideViewPort(true);
webView.setScrollbarFadingEnabled(false);
webView.getSettings().setDefaultFontSize(20);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());

//here i get them
getIntent().getStringExtra("username");
getIntent().getStringExtra("password");




webView.loadUrl("http://intranet.mdis.uz/");




}


but this doest works(( i spended 8 hours on research but nothing helped me




I am trying to port Linux-PAM module from http://www.linux-pam.org/library/Linux-PAM-1.1.8.tar.gz to Android Jellybean 4.2.2 platform version.


I've tried one solution from post Linux Pam creates static library instead of shared library, but didnt work, not sure why.


Facing following error "may be due to some changes still required" in configure and makefile as per Android install directories:


Failure log....


------------------------------------------------------------------------------------------------Making install in libpam


make[1]: Entering directory `/home/ravi/workspace/vendor/external/Linux-PAM-1.1.8/libpam'


/bin/bash ../libtool --tag=CC --mode=compile arm-linux-androideabi-gcc --sysroot=/home/ravi/workspace/prebuilts/ndk/current/platforms/android-9/arch-arm -DHAVE_CONFIG_H -I. -I.. -DDEFAULT_MODULE_PATH=\"/home/ravi/workspace/vendor/external/Linux-PAM-1.1.8/out/lib/security/\" -DLIBPAM_COMPILE -I./include -DPAM_VERSION=\"1.1.8\" -g -O2 -MT pam_audit.lo -MD -MP -MF .deps/pam_audit.Tpo -c -o pam_audit.lo pam_audit.c


libtool: compile: arm-linux-androideabi-gcc --sysroot=/home/ravi/workspace/prebuilts/ndk/current/platforms/android-9/arch-arm -DHAVE_CONFIG_H -I. -I.. -DDEFAULT_MODULE_PATH=\"/home/ravi/workspace/vendor/external/Linux-PAM-1.1.8/out/lib/security/\" -DLIBPAM_COMPILE -I./include -DPAM_VERSION=\"1.1.8\" -g -O2 -MT pam_audit.lo -MD -MP -MF .deps/pam_audit.Tpo -c pam_audit.c -o pam_audit.o


In file included from pam_modutil_private.h:14:0,


from pam_audit.c:12:


./include/security/pam_modutil.h:53:20: fatal error: shadow.h: No such file or directory


compilation terminated.


make[1]: *** [pam_audit.lo] Error 1


make[1]: Leaving directory `/home/ravi/workspace/vendor/external/Linux-PAM-1.1.8/libpam'


make: *** [install-recursive] Error 1


sravisss@buildlsp002:~/workspace/vendor/external/Linux-PAM-1.1.8$




Looks like some more modification need within configure file (something like adding host=eabi), but not sure how and where ?


Anyone succeeded to port Linux-PAM on Android or shall i use some other module for Pluggable Authentication Module to integrated with Secure Shell (OpenSSH) in Android ?




I'm trying to fully embed a page inside an iframe in another page. The page where it's embedded is supposed to look exactly like when browsing the source page directly.


I've tried many different frame/iframe and style combinations that I've found, all either here from stackoverflow or from various blogs, they all work on desktop but all look different on mobile.


Comparison between the two sites on android:



It looks the same on desktop browsers, but on mobile the page inside the iframe always looks smaller and doesn't fill the whole screen.


From what I unterstand the problem comes from the css on the src page, but I can't edit that. Is it possible to get this working on mobile browsers without making changes to the embedded site itself?




I had a doubt regarding parallel activities that occur in the system. How can we represent those in the diagram? Is there always a need of fork or the decision element can also be used? Eg.: The user can choose among "Add Book" , "Search Book", "Search User" and "Update profile". So after the user logs in the system he can choose among the above operations.activity diagram Below is the image of my activity diagram.




i have an edittext field and when I am trying to use the toString to fill it in it seems like I am returning null. I'm using a toast to try to figure out the value of it. The edittext field is input from the softkeyboard.



String fav=disp_label.getText().toString();
Toast toast =Toast.makeText(this," "+fav+fav.length(),Toast.LENGTH_SHORT);
toast.show();


if i try adding



disp.setText(fav);


it still returns nothing


this is what i used to get an integer out of an edittext field which works correctly...is there something similar for a string?



channel=Integer.parseInt(disp.getText().toString());



Flot Tooltips doesn't seem to be working for Androids. I have a Galaxy S3, and the "plothover" event fires but the item parameter is null. I used Chrome's remote debugging tool to investigate.


I have tried this site on my iPhone and it works fine.


http://www.pureexample.com/jquery-flot/tooltip-chart.html


Anyone have any issues with Androids and Flot Tooltips?




Hi I am making a game where there is a share button. If a user clicks it, it will take the current screen as a PNG image and share it through share intent. I am able to take the screenshot and save it to storage and then I wish to invoke the share intent through startActivity(). I have two functions for that: captureImage() will save the screenshot, then I am calling shareImage() to invoke the startActivity(). My problem is whenever I click on the button it invokes the shareActivity() first and then tries to capture the screenshot. I mean they are running in two different threads, while a thread tries to capture image, another thread invokes startActivity(), so it tries to collect the image from the predefined path before it is actually saved. Here I am facing the problem as its always giving me the error. Following are my codes: I put two different toasts to find out which one is running first. I found shareImage() toast is always coming first. I am trying to find a way to make shareImage() run until captureImage() is finished.



final Sprite sShare = new Sprite(Constants.CAMERA_WIDTH - 50 , 20, this.mShare, this.vertexBufferObjectManager) {
@Override
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
if(pSceneTouchEvent.getAction() == MotionEvent.ACTION_DOWN) {
captureImage();
shareImage();
}
return true;
}
};


My two methods are as follow:



private void captureImage() {
final int viewWidth = MenuActivity.this.mRenderSurfaceView.getWidth();
final int viewHeight = MenuActivity.this.mRenderSurfaceView.getHeight();
screenCapture.capture(viewWidth, viewHeight, FileUtils.getAbsolutePathOnExternalStorage(MenuActivity.this, "screenshot.png"), new IScreenCaptureCallback() {
@Override
public void onScreenCaptured(final String pFilePath) {
MenuActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MenuActivity.this, "Screenshot: " + pFilePath + " taken!", Toast.LENGTH_SHORT).show();
}
});
}

@Override
public void onScreenCaptureFailed(final String pFilePath, final Exception pException) {
MenuActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MenuActivity.this, "FAILED capturing Screenshot: " + pFilePath + " !", Toast.LENGTH_SHORT).show();

}
});
}
});
}

private void shareImage() {
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("image/png");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareMessage);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(FileUtils.getAbsolutePathOnExternalStorage(MenuActivity.this, "screenshot.png")));
MenuActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MenuActivity.this, "Path: " + Uri.parse(FileUtils.getAbsolutePathOnExternalStorage(MenuActivity.this, "screenshot.png")), Toast.LENGTH_SHORT).show();
}
});
startActivity(Intent.createChooser(shareIntent, "Share via"));
}


Thank you in advance.




In Android, is it possible to generate a FileDescriptor directly from a byte array, without having to open a file first?


In Android 2.2, I am generating a MIDI file on the fly, and then playing it back using MediaPlayer. I've included the text of the Main.java file that does this successfully below. So far so good.


However, this process first calls...



FileOutputStream outputStream = openFileOutput(file, MODE_PRIVATE);
outputStream.write(byteStream);
outputStream.close();


... to write out the file, and then calls...



FileInputStream inputStream = new FileInputStream(midifile);
FileDescriptor fileDescriptor = inputStream.getFD();


... to read it back in, before calling:



mediaPlayer.setDataSource(fileDescriptor);


This seems to me to be wasteful. Can I create the FileDescriptor directly from the byteArray, so that the MIDI stream can be played immediately?




== Working code ==



package com.example.midi;

import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import android.app.Activity;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;

public class Main extends Activity {

private String file = "midi.mid";
MediaPlayer mediaPlayer;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

createNewMIDIFile();
playNewMIDIFile();
}

public void createNewMIDIFile() {
Integer[] stream = new Integer[]{
//
0x4d, 0x54, 0x68, 0x64, // MThd = MIDI file designator
0x00, 0x00, 0x00, 0x06, // Standard MIDI File (SMF)
0x00, 0x01, 0x00, 0x02, // multiple-track format: 2 tracks
0x00, 0x40, // 64 ticks per beat (quarter note)
0x4D, 0x54, 0x72, 0x6B, // Header for track 1
0x00, 0x00, 0x00, 0x0B, // 11 bytes to describe the track
0x00, 0xFF, 0x51, 0x03, // set tempo:
0x0F, 0x42, 0x40, // 1,000,000 microseconds / beat: 60 bpm
0x00, 0xFF, 0x2F, 0x00, // End of track 1
0x4D, 0x54, 0x72, 0x6B, // Header for track 2
0x00, 0x00, 0x00, 0x0F, // 15 bytes to describe the track
0x00, // Immediately
0xC1, 0x01, // change instrument for track 2 to piano
0x00, // Immediately
0x91, 0x3C, 0x7F, // play middle C with a velocity of 127
0x30, // 48 ticks later (dotted eighth note)
0x81, 0x3C, 0x00, // stop playing the middle C
0x00, 0xFF, 0x2F, 0x00 // End of track 2
};

int length = stream.length;
byte[] byteStream = new byte[length];
for (int ii = 0; ii < length; ii++) {
byteStream[ii] = (byte) (stream[ii] % 256);
}

try {
FileOutputStream outputStream = openFileOutput(file, MODE_PRIVATE);
outputStream.write(byteStream);
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}

public void play(View view) {
/* Triggered by a button defined in activity_main.xml as
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="play"
android:text="Play MIDI" />
*/
playNewMIDIFile();
}

public void playNewMIDIFile() {
try {
String filename = getFilesDir() + "/" + file;
File midifile = new File(filename);
FileInputStream inputStream = new FileInputStream(midifile);
FileDescriptor fileDescriptor = inputStream.getFD();
mediaPlayer.reset();
mediaPlayer.setDataSource(fileDescriptor);
inputStream.close();
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}



I'm new in Android development, so sorry if my question is really silly hehe I want to design a graphic like this:


https://www.dropbox.com/s/40a300cyav4ypx2/example.JPG?dl=0


But I don´t know how to use grids with different thickness :/




I have Android Studio 0.8.9. Until now, It could sync with gradle files successfully, But today when I opened it, It gives me this error:



UnsupportedMethodException
Failed to set up Android modules in project 'Project': Unsupported method: SourceProvider.getJniDirectories().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.


Can you help me solve this? Thanks.




i wanted to scrap a text from this webpage "www.hellybean.com" using this XPATH expression



//*[@id='Content']/h1


which should give



"Android Hellybean Rom"


Can you tell me how to do this on android?


Thanks.




Hey I have a social networking site like facebook same features . I am trying to create an app like facebook in which I need a left drawable menu on clicking that it should go to my websites location . I am finding it very hard to find to use drawable and webview . I want users to login before seeing the actual data is there anyone who can help me . I am new to this java and android field .




I am using Parse backend for my android app. I need to query the database for a record that has a field with a specific string value. following is the Parse code


strObjectId is a String initialised with a Parse ObjectId as follows



String strObjectId = MyParseObject.getObjectId();


Parse code



ParseQuery<ParseObject> query = ParseQuery.getQuery("MyDataTable");
query.whereEqualTo("code", Code);
query.getFirstInBackground(new GetCallback<ParseObject>()
{
public void done(ParseObject object, ParseException e)
{
if (object == null)
{
return;
}
else
{
ShowToast("Record found!");
}
}
});


The problem is that it works perfectly okay when 'Code' is hardcoded as follows prior to running above query



String Code = "KrErdfgdfghdfh";


But it DOES NOT work when Code is assigned Parse ObjectId as follows



String Code = strObjectId;


Your help will be appreciated


Thanks




I want to add a custom indicator that indicates which is the active tab in a PagerTabStrip. I've searched the internet but I cannot find any example on how can I implement such a thing, without using a library.


As i see I can only change the highlight color but I cannot add a share or a resource instead.


Here is what im looking for: enter image description here




i create my first Android app that use local SQLite database for showing contents. As you know any user can dump database from phone and see its structure and data. Does exist any way to prevent database dump from Android phones? I avoid that anynone can have a look at database data (and then copy it) using any SQLite explorer.


Thank you.




From HomeActivity Im trying to get a result from CreateProfileActivity. Here what i do to start the activity



Intent createProfile = new Intent(this, CreatePreacherActivity.class);
startActivityForResult(createProfile, 1);


Here the implementation of onActivityResult method in HomeActivity:



@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {


if (requestCode == 1)
{

Log.d("DEV","HomeActivity is reciving data");
if (resultCode == RESULT_OK)
{

// this code here execute at the second call
// but why there are two calls when i just call setResult once???

User user = new User();

String[] userInfo = data.getStringArrayExtra("preacher");

//parsing and saving and database code...

Log.d("DEV","HomeActivity data received->"+user);

CurrentUser.set(this, user);
fillCurrentUserInforms();
}

// if while searching for the preacher list
// and none was found on database. Then tell the user
// to create a new profile
else if (resultCode == RESULT_CANCELED)
{
Intent createPreacherIntent = new Intent( this, CreatePreacherActivity.class );
startActivityForResult(createPreacherIntent,1);
}
}


When im done and press save in CreateProfileActivity here is what I do to send the data back to HomeActivity:



**private void createProfile()
{
// some parsing and inserting the new data code..
User u = new User();
u.setName(newPreacher.getName());
u.setLastName(newPreacher.getLastName());
u.setId(newPreacher.getId());
u.setSex(newPreacher.getSex());
CurrentUser.set(this,u);
if (getParent() == null)
{
setResult(RESULT_OK,createPreacherDataIntent(newPreacher));
}
else
{
getParent().setResult(RESULT_OK,createPreacherDataIntent(newPreacher));
}
Log.d("DEV","Exiting from CreatePreacherActivity");
finish();
}**


The setResult method is call one once on CreateProfileActivity but for some unknown reason when the data get to HomeActivity.onActivityResult method, get execute twice. The first result with the requestCode = 0 and the second one with requestCode = 1. After that, HomeActivity.onActivityResult gets execute, the CreateProfileActivity apears again since the first call the requestCode was 0.


Why then is onActivityResult executing twice??


What is 0 on the first call and then 1 on the second??


Notes: I've read the following question to see if im doing something wrong but i can see it:


Android onActivityResult is always 0


fragments startActivityForResult always return resultCode 0 and intent null on callback onActivityResult


And more..




I am building a responsive website using Foundation 5 and have a fixed mobile menu with buttons that move up and down erratically as you scroll. I have only found this problem on the Android KitKat Default Web Browser. I had this same problem on older versions of Android and resolved it using -webkit-backface-visibility:hidden; and by disabling user scale-ability in the viewport.


I have tested several Windows Phones, Apple iPhone and iPad and a Dell 7" Venue and none of them have this problem. I have also looked at Google Chrome Dev Tools Mobile Emulator to see if I could reproduce the problem there.


The temporary location of the site is http://foodfranchise.azurewebsites.net. I would like to know if anyone else has had this problem while building a responsive website and if there is any way to fix it. I would also like to know if there are other devices out there that also have the problem that I am not aware of.


Thank You,


Gary




In one of my applications, i need to create a border for a linear layout which would look like below


enter image description here


I do not want to have an image and set it as background. Because then i would need to create images of various size for different devices.


If i create the layout with a linear layout and place a textview using absolute positioning, it might not look as expected in different devices.


So What is the best way to achive this UI ?




From my Android application I need to use a RESTful web service that returns me a list of objects in json format. This list can be very long (about 1000/2000 object.).


What I need to do is to search and retrive just some of the objects inside the json file.


Due to the limited memory of mobile device, I was thinking that using object-binding (using for example GSON library) can be dangerous.


Which are the alternatives for solving this problem?




I noticed that bullet item size is different on iPhone for these two expressions:



<li><a>abc</a></li>
<li>def</li>


Even though the link is inside the bullet item, and it shouldn't affect its parent, right? I'm not sure if this just an iPhone bug. Someone told me same happens on new Samsung Galaxy s5, but it looks normal on my Samsung Galaxy s3. Has anyone run into this before? I can't seem to find anything about it anywhere.


I could fix it of course by removing list-style-type and using a backround image instead, but I'm curious if there's another way that makes more sense.




Steps to reproduce:



  • download setur.jar - http://libgdx.badlogicgames.com/download.html

  • generate project for desktop, Android, iOS, HTML

  • open Intellij IDEA, press Open, and select build.gradle

  • wait while gradle will do the staff and than run android project


I am facing some strange issue:



  • 15:32:20 Compilation completed successfully in 11 sec

  • 15:32:20 NullPointerException: null

  • 15:32:30 Error Report Error Submitting Feedback: null Consider creating an issue at Android Issue Tracker


if I press NullPointerException (link), there appears message and stacktrace:


message: Exception in plugin Android Support. x min ago. Occured 2 times since the last clear. Disable plugin... <-- this is a link (if I press this, than Android will be not visible by IDEA at all.


stacktrace:



java.lang.NullPointerException
at com.sun.proxy.$Proxy169.getMinSdkVersion(Unknown Source)
at com.android.tools.idea.model.AndroidModuleInfo.getMinSdkVersion(AndroidModuleInfo.java:71)
at org.jetbrains.android.facet.AndroidFacet.canRunOnDevice(AndroidFacet.java:560)
at org.jetbrains.android.facet.AndroidFacet.isCompatibleDevice(AndroidFacet.java:536)
at org.jetbrains.android.run.DeviceChooser$MyDeviceTableModel.getValueAt(DeviceChooser.java:352)
at javax.swing.JTable.getValueAt(JTable.java:2716)
at com.intellij.ui.table.JBTable.getRowHeight(JBTable.java:149)
at javax.swing.JTable.getRowHeight(JTable.java:993)
at javax.swing.JTable.getCellRect(JTable.java:2936)
at javax.swing.JTable.valueChanged(JTable.java:4697)
at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:184)
at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:164)
at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:211)
at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:405)
at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:415)
at javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:459)
at org.jetbrains.android.run.DeviceChooser.updateTable(DeviceChooser.java:227)
at org.jetbrains.android.run.DeviceChooser.init(DeviceChooser.java:150)
at org.jetbrains.android.run.ExtendedDeviceChooserDialog.<init>(ExtendedDeviceChooserDialog.java:124)
at org.jetbrains.android.run.AndroidRunningState.execute(AndroidRunningState.java:245)
at com.intellij.execution.runners.DefaultProgramRunner.doExecute(DefaultProgramRunner.java:38)
at org.jetbrains.android.run.AndroidDebugRunner.doExec(AndroidDebugRunner.java:144)
at org.jetbrains.android.run.AndroidDebugRunner.doExecute(AndroidDebugRunner.java:135)
at com.intellij.execution.runners.GenericProgramRunner$1.execute(GenericProgramRunner.java:48)
at com.intellij.execution.impl.ExecutionManagerImpl$2.run(ExecutionManagerImpl.java:208)
at com.intellij.openapi.project.DumbServiceImpl.runWhenSmart(DumbServiceImpl.java:95)
at com.intellij.execution.impl.ExecutionManagerImpl$1$1.run(ExecutionManagerImpl.java:172)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:697)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:524)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:335)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)



In Android 5.0 Lollipop


I have observed that a new folder is created for each system app, could you please tell me why ?


For example /system/app/Email/Email.apk




Good evening everyone, I'm getting just the SDK facebook for unity. I made a simple example where pressing buttons makes me log in, I print the name and allow me to publish a post. The problem is that when I start the page where my app is still the logo without loading the page. The "demo" is here http://testunity.altervista.org/Desktop.html and in settings where it asks for the url I put this unity https://testunity.altervista.org/Desktop.unity3d Someone can help me?




I am trying to figure out the best way to remove a permission in an Android Manifest, but only for the release build. I looked through the options of the manifest-update goal (http://books.sonatype.com/mvnref-book/reference/android-dev-sect-goals-useful.html), but couldn't find anything related to changing the permissions.




I am new to PhoneGap and Mobile Application Development. I want to create an application using PhoneGap so that I can get Android, iOS, BlackBerry versions of the same app.


I have installed PhoneGap in my windows 7 Desktop using tutorials given in https://www.youtube.com/watch?v=nqFpfrUrMM4


I have some questions regrading PhoneGap:



  1. Can we create multiple pages(HTML Files) or we only have index.html single file?

  2. Can we use jQuery UI plugins, Mobile jQuery UI and other iQuery plugins? Will PhoneGap cloud service be able to convert to mobile app?

  3. I have created Hello World example and uploaded zip file to PhoneGap and it converted to Android, Windows app but for iOS app it shows error certificate(P12) and provisioning file. I have windows 7, how can I get that legally? (My friend has Mac book. I can use it)

  4. I want to launch app to Play market and iTunes but I have no idea what I need to do after uploading zip to phonegap.


I will really appreciate if you can provide me with the suggestions, steps that I need to take or links that would ease whole process.


Thanks!




Both of these applications allow you to send SMS on your desktop/through a web browser as if it's coming from your phone (it really is coming from your phone). My question is:


How do they automatically send SMS through the Default SMS App (Messenger) without any user interaction (in the background/discretely) on Android 4.4?




i am currently trying to learn how to develop apps for android mobile phones using PhoneGap. i was able to get this book titled "PhoneGap 2x mobile application development". ths book is really nice and self explanatory but the problem i have is when the author want to create d project via the command line, he was using Unix commands because he is running a Unix PC. I am running Windows and to follow his commands using the CMD is a bit hard for me because i dont understand all of his commands.


Below was what he wrote:



mkdir $PROJECT_HOME
cd $PROJECT_HOME
mkdir Android iOS www
cd $PHONEGAP_HOME/lib/android/bin
./create $PROJECT_HOME/Android/QuizTime com.phonegaphotshot.
QuizTime QuizTime
cd $PHONEGAP_HOME/lib/ios/bin
./create $PROJECT_HOME/iOS com.phonegaphotshot.QuizTime QuizTime
cd $PROJECT_HOME
mkdir www/cordova
cp Android/QuizTime/assets/www/cordova-2.2.0.js www/cordova/
cordova-2.2.0-android.js
cp iOS/www/cordova-2.2.0.js www/cordova/cordova-2.2.0-ios.js
cd Android/QuizTime/assets
rm –rf www
ln –s ../../../www
cd ../../../iOS
rm –rf www
ln -s ../www
cd ..
cd www
cp –r $YASMF_DOWNLOAD/framework .
mkdir images models views style
cd ..
cd Android/QuizTime/src/com/phonegaphotshot/QuizTime
edit QuizTime.java
Change "index.html" to "index_android.html"
Save the file.
cd $PROJECT_HOME/iOS/QuizTime


can someone tell me how to do this on the windows cmd. i know what mkdir is but i need a total description and if possible a translation following that if you were to do this on a windows cmd.




is there any example, howto place any of charts in MPAndroidChart library to homescreen widget?


//i tried to use getChartbitmap(), but 1)bitmap is not created immediately after calling invalidate(), so it return null 2)i dont see way, howto initialize chart class without placing resources - which i cant do for widget.


anybody have some successful example ?




My Android app contains links, I want to share this link on Facebook. I used Intent.ACTION_SEND but why


Facebook icon is not shown on Activity Chooser, my code:



Intent sharing = new Intent(Intent.ACTION_SEND);

sharing.setType("text/html");

sharing.putExtra(Intent.EXTRA_SUBJECT, "Check out this video");

sharing.putExtra(Intent.EXTRA_TEXT,
"https://www.youtube.com/watch?v=" + videoUrl);

startActivity(Intent.createChooser(sharing, "What to share?"));



I want to have a menu button that allows the user to reset the app. As I've read that I shouldn't call onCreate() manually, I use the following code instead:



Intent intent = getIntent();
finish();
startActivity(intent);


My problem is that this triggers an animation where the window disappears and appears again, which I don't want to happen. How can I get rid of that?




I have this to draw a rectangle.



<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#00000000" />
<stroke android:width="1dp" android:color="#ffffff" android:dashWidth="0dp" android:dashGap="0dp" />
</shape>


But I want only 2 horizontal lines on the top and on the bottom. How do we achieve that?


Iwant to achieve no 2




android code:



protected String doInBackground(String... params) {
// TODO Auto-generated method stub

try {
SharedPreferences prefs = getActivity().getSharedPreferences("Login_Prefs", 0);

username = prefs.getString("username", "defValue");

String url = "http://www.iloveexpressions.com/eh/viewFriendList.php";

nameValuePairs = new ArrayList<NameValuePair>(1);

Log.d("Parameters ", username);

nameValuePairs.add(new BasicNameValuePair("username", username.trim()));

Log.d("name value pairs", nameValuePairs.toString());

JSONObject json = jsonParser.makeHttpRequest(url, "POST",
nameValuePairs);

Log.d("Printing after json", json.toString());

success = json.getString("success");

Log.d("Success : ", success);

} catch (Exception e) {
Log.d("Error : ", e.toString());
}


php code:



<?php

require 'connection.php';

$response = array();

if(isset($_POST["username"]))
{
$username = $_POST["username"];

$response["success"] = 1;

echo json_encode($response);
}
else
{
$response["success"] = 0;

echo json_encode($response);
}

?>


This is the error i get in log :



Parameters(30889): aaa

name value pairs(30889): [username=aaa]

Error :(30889): java.lang.NullPointerException


How do I solve this error ? I am using the same method to send and retrieve data using php on android and it works fine ? I am returning success if username is sent to php file correctly


I am using the doInBackground process in a fragment and calling the execute() method in the onCreateView() method is this possible ?




I need the Kiosk Mode because I really create an App for a kiosk.


So I've set these intents that starts the kiosk mode, but how can I switch between kiosk mode and normal mode? So that I have a hidden button in my app where I can turn on and off the kiosk mode?


Thanks!




I have service that check a event every 3 second in runnable.

I want to show a dialog or alert to user (any dialog even toast except Notification) from inside runnable. How can do this?




I am trying to start an Android service code and i have commented onStartCommand , so do the service will keep running or it will stop itself in the middle way.


MyCode:



@Override
public int onStartCommand(Intent intent, int flags, int startId)
{

//super.onStartCommand(intent, flags, startId);

return START_STICKY;


}


Please let me know , the possible situation during service running in the system.




I am trying to insert new contact into the android contacts database on API 19 (KITKAT) into Google contacts account. I use basically the same code as in documentation without any custom fields: https://developer.android.com/guide/topics/providers/contacts-provider.html#Access


The problem is - new inserted contact disappears from Contacts after about 30 seconds or so. I suspect the problem is with sync adapter, but I do not understand the cause.


There seems to be similar question, still without answer - kitkat (API 19) inserting contact?




I am having a problem with text in a button. When the text is more than one line, the size of the button is shortened from above and the text does not appear in the center and cut the bottom.


What can be my problem?


enter image description here


xml



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linear_botones"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<Button
android:id="@+id/boton_monumento_1"
android:layout_width="100dp"
android:layout_height="45dp"
android:layout_marginRight="1dp"
style="@style/botonMonumentos" />

<Button
android:id="@+id/boton_monumento_2"
android:layout_width="100dp"
android:layout_height="45dp"
android:layout_marginRight="1dp"
style="@style/botonMonumentos" />

</LinearLayout>


styles



<style name="botonMonumentos">
<item name="android:textSize">13sp</item>
<item name="android:ellipsize">end</item>
<item name="android:gravity">center</item>
<item name="android:maxLines">2</item>
</style>



I have seen this line of code in almost every example i have looked at. Right after onCreate is created super.onCreate is called with the same arguements. What does this line do? what is its purpose?



protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); //the line in question
.....
}



Here is my problem: enter image description here


I simply want to see if my_list contains the string it got from letters. At the bottom of the code I use a toast method, and it shows that I have correctly added the string to my_list. But for some reason when I try debugging the program it doesn't add my_list or letters to the variables section. The variable section is empty. And as you can see, I have put tons of breakpoints in the code but the program just runs with breaking.


I have been trying to debug this application straight from my phone. I have tried cleaning the project, restarting eclipse, building, changing code but the debugger just won't work.


Am I doing something wrong? Anybody know why these variables (my_list and letters) are not added to the variables perspective?


Please let me know if I need to provide more code or information.




My Android phonegap application has one scrollable div as below:


HTML



<div data-role="page" id="home">
<div data-role="content" id="mContent" >


CSS



div#home{
position: relative;
background-color: #EFEFEF;
overflow: scroll;
margin: 0;
padding: 0;
min-height:100%;
}

div#mContent{
width: 100%;
overflow:scroll;
margin: 0;
padding: 0;
background-color: #EFEFEF;
min-height:100%;
display: inline-block;
}


My problem is that the background color (only on some device) is present only for the height which is initially displayed but when I scroll the rest gets black.


I tried with all the solution proposed in this similar SO post (in my case, using min-height) but noone of them helped.


Before scrolling


enter image description here


After scrolling a bit (the more you scroll the more you get a dark background)


enter image description here




Someone can suggest me good tools for testing performance behavior of an android's APK & Iphone's application over mobile devices.


My basic requirements is for every action we perform in our application (for eg. Launching homepage, Login into an system, clicking on setting, Saving changes etc..). Tool should provide following details:



  1. Monitoring CPU utilization.

  2. Monitoring Memory Utilization.

  3. Monitoring battery Consumption.

  4. Monitoring Network bandwidth usage statistics.


Also, Tool should provide logs for above info in text format from which we can analyze data, create a graph if required and make a report and share the same with our client.


If one can provide free tool info for the above requirement then it will be well n good.


Advance Thanks for help!




I want to set the background of my application dynamically, depending on daytime. This should be checked periodically. Therefore I start this runOnUiThread():



class BackgroundMainThread implements Runnable {
// @Override
public void run() {
while (!Thread.currentThread().isInterrupted()) {
try {
Thread.sleep(1000);
doBackgroundImage();
Thread.sleep(30000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (Exception e) {
Log.e("log_tag2", "Error is " + e.toString());
}
}
}
}

public void doBackgroundImage() {
runOnUiThread(new Runnable() {
public void run() {
try {
//final FrameLayout framelayout_main_bild = (FrameLayout)findViewById(R.id.framelayout_main);
//framelayout_main_bild.setBackgroundResource(PictureresID);
findViewById(R.id.framelayout_main).setBackgroundDrawable(getResources().getDrawable(R.drawable.picture1));
} catch (Exception e) {

}
}
});
}


I'm running other Threads as well and everything works fine, but only when running this thread the following error occurs:



Skipped 40 frames! The application may be doing too much work on its main thread.



Any idea how to solve that?




I'm using Parse to handle push notification on my Android application. I'm also using a sticky service for playing music in the background, which doesn't get killed if my application is.


The problem is that if my application gets killed (from the task manager, for instance) when music is playing, the music keeps playing and Parse crashes in the background after a certain amount of time (or if I put my device to sleep and come back).


Here is what I get in the logs



Caused by: java.lang.RuntimeException: applicationContext is null. You must call Parse.initialize(context, applicationId, clientKey) before using the Parse library.


FYI, I'm initializing Parse in the onCreate method of the Application object, and it does get called (and the push service is working correctly).


Any idea? I'm feeling that the edge case where we keep a Service running without keeping the application context is not correctly handled by the library, but I'm also hoping that there is some kind of a fix.


Thanks!




I have an android application that need to connet to a wordpress db.


i'm new to this kind of connection and i discovered that wordpress dont enctry as usually the password with md5.


My application has to register a new users to the blog and also to autentificate them.


What i try :


I have a php script on server side :



include ('../wp-includes/wp-db.php');
include ('../wp-includes/class-phpass.php');
$my_hasher = new PasswordHash(8, TRUE);
echo $my_hasher->HashPassword("1234");


But on every refresh the result change. So ...that's not the way.


Can you please help me find the best, correct way to register a user password in a wordpress blog and also to compare the password for future autentification?


Thanks,




I make a simple demo of auto complete .it is working fine I need some issue in UI .


Please check image as autosuggest look..


here is my code ..



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg1" >

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="28dp"
android:layout_marginTop="42dp"
android:text="@string/chooseStation"
android:textColor="#000000"
android:textAppearance="?android:attr/textAppearanceMedium" />

<Button
android:id="@+id/item_buttonId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/okButton" />

<AutoCompleteTextView
android:id="@+id/item_autoComplete"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView1"
android:layout_alignBottom="@+id/textView1"
android:layout_alignParentRight="true"

android:textColor="#000000" />

</RelativeLayout>


Major concern is this code :



<AutoCompleteTextView
android:id="@+id/item_autoComplete"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView1"
android:layout_alignBottom="@+id/textView1"
android:layout_alignParentRight="true"

android:textColor="#000000" />


Actually first problem is that my cursor become white it is not visible .secondly how to make rectangle in text field so that it look good.in my view it show only base line .Thirdly how to give padding so that it not touch end point of width ..


enter image description here




Is there a way to set the orientation of the invitation friends dialogue and also the share dialogue to be oriented with the device orientation? Currently my Unity game is in landscape mode, and Facebook dialogues are never oriented or changed at all based on the device orientation... is that a bug in the SDK ?




I'm using Eclipse ADT and I'm having a problem with a layout file. I can open it the internal xml editor, but when I open the Graphical Layout tool, it doesn't show anything, as if there was no xml file there.


This is the xml code



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.hermes.view.activities.SubTaskActivity" >
<fragment
android:id="@+id/map_fragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="35"
android:layout_marginBottom="15dp"
android:name="com.hermes.view.fragments.MiniMapFragment"/>
<ListView
android:id="@+id/list_subtaks"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="60" />
</LinearLayout>


Note: I wanted to show a screenshot of the Graphical Layout tool, but StackOverflow doesn't allow it for reputation stuff :/


Is this an eclipse bug or am I doing something from with the xml file. I must also say that this only happens if I put a fragment in the xml file; if I remove the fragment tag, the problem disappear, but I need to see the design with the fragment in it !.


Thanks for the help


on Thursday, October 30, 2014


In XAMARIN, with MVVM approach sometimes when the user traverse back to a list view we are getting an error,



System.ArgumentException: 'jobject' must not be IntPtr.Zero.
Parameter name: jobject
at at Android.Runtime.JNIEnv.CallNonvirtualIntMethod (intptr,intptr,intptr) <IL 0x0001f, 0x000d8>
at at Android.Views.View.get_Visibility () <IL 0x00075, 0x002a3>
at at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateIsVisible () <IL 0x00021, 0x00127>
at at Xamarin.Forms.Platform.Android.VisualElementTracker.HandlePropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x002b3, 0x010d3>
at at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00044, 0x0009f>
at at Xamarin.Forms.BindableObject.OnPropertyChanged (string) <IL 0x00012, 0x000c7>
at at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty,object,bool,bool,bool) <IL 0x000a3, 0x004f3>
at at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty,object,bool,bool,bool) <IL 0x00213, 0x00aeb>
at at Xamarin.Forms.BindingExpression.ApplyCore (object,Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty,bool) <IL 0x00206, 0x01287>
at at Xamarin.Forms.BindingExpression.Apply (bool) <IL 0x00041, 0x0018b>
at at Xamarin.Forms.BindingExpression/BindingExpressionPart.<PropertyChanged>b__12 () <IL 0x00007, 0x00053>
at at Java.Lang.Thread/RunnableImplementor.Run () <IL 0x00011, 0x00097>
at at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <IL 0x0000a, 0x000a3>
at at (wrapper dynamic-method) object.77d235ff-7394-41cf-b895-17e2737816c1 (intptr,intptr) <IL 0x00011, 0x0003b>



I'm making an app using Android Studio as my IDE and Genymotion as my emulator and I see a difference between the preview of Android Studio and the real output of Genymotion but I wonder which one trust.


Both of them are using a 768 x 1280 phone but it seems the one in Genymotion is bigger.


enter image description here


enter image description here




How do I regard a task: open the task manager to see.


I have been thinking that it's impossible to start an external activity in the current task since long time ago. But I have found this is INCORRECT!


My app could start a twitter/facebook/sms in the same task (when clicking the task manger button, I could only see my task). But this doesn't apply to browsers. I have tried two browser app chrome and firefox. None of them works like twitter/facebook/sms


The following are the code for open a facebook client and a browser. Any comments would be really appreciated!



public Intent shareViaFacebook(Activity ctx) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
ActivityInfo appInfo = searchForApp(ctx, intent, "facebook");

if (appInfo == null)
return null;

intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setComponent(new ComponentName(appInfo.packageName, appInfo.name));

intent.putExtra(Intent.EXTRA_TEXT, "message");
return intent;
}


public Intent launchBrowser(Activity ctx, String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));

ActivityInfo appInfo = searchForApp(ctx, intent, null);
if (appInfo == null)
return null;
intent.setComponent(new ComponentName(appInfo.packageName, appInfo.name));
intent.addCategory(Intent.CATEGORY_LAUNCHER);
return intent;
}



I want to stream a live webcam video and display it on android device with the lowest latency possible. I am streaming video from a computer over rtsp protocol and I am able to watch the stream with ~50ms latency on the second computer using ffplay -fflags nobuffer rtsp://xxx.xxx.xxx.xxx:port/test.sdp command.


So far I have successfully compiled ffmpeg4android library. Unfortunately this library uses NDK which I am not familiar with. All I want to do is to be able to invoke the same command and display the video on the android SurfaceView.


How can I call for such command?




I have the following menu that i declare in Main activity :



public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);

//... populate with menu.add()

}


The menu icon looks like 3 dotts and it's position is on the action bar on the right side. In my app i use Fragments and i want to change the menu icon ( the icon i press to open de menu items ) depending on the fragment it's in front.


How can i do that programmatically?


Also on some of my fragments i don't want the menu to appear. For this i use inside those fragments :



public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
{
super.onCreateOptionsMenu(menu, inflater);
menu.clear();
}


And i try to find a way using the menu var to change the icon of the menu. But i did not find a way.


So.... can you please show me how to change the menu icon programmatically?


Thanks,




I am trying to build the master branch of AOSP, but it fails with following error:



host C++: validatekeymaps <= frameworks/base/tools/validatekeymaps/Main.cpp
In file included from frameworks/base/tools/validatekeymaps/Main.cpp:17:
In file included from frameworks/native/include/input/KeyCharacterMap.h:26:
In file included from frameworks/native/include/input/Input.h:25:
system/core/include/utils/Vector.h:20:10: fatal error: 'new' file not found
#include <new>
^
1 error generated.
make: *** [out/host/darwin-x86/obj/EXECUTABLES/validatekeymaps_intermediates/Main.o] Error 1


Does anyone has any idea on this? Where the "new" file should present? How would I solve this? Any help would be greatly appreciated.




I can't install SDK and eclipes as well. While I am trying to install an error message is shown. I can not figure it out. so, I badly need help. Someone please help me. Thanks.! The image says, "unable to execute tools\android.bat:, error 2 The system can not find the file specified."unable to execute tools\android.bat:, error 2 The system can not find the file specified.




I'm trying to create an app which at it's heart will be a music player, among other things. I want to be able to search the phone quickly and generate a list of all music on the phone.


I am using Phonegap to create this app, and would like to avoid creating a plugin if I can.


I've been doing a lot of googling and found references to the phone creating a list of all media files when it starts and runs MediaScanner. Is there a way to access this list, specifically a way to do it with JavaScript, HTML5 or Phonegap?




I'm trying to send a mail intend in android, which contains a table structure, with some test results.


For the generated text part (the main part of the mail), i tried to use a code like this:



Html.fromHtml(
new StringBuilder()

.append("<table style=\"width:100%\"><tr>\n" +
" <td>Jill</td>\n" +
" <td>Smith</td> \n" +
" <td>50</td>\n" +
" </tr>\n")
.append(
" <tr>\n" +
" <td>Eve</td>\n" +
" <td>Jackson</td> \n" +
" <td>94</td>\n" +
" </tr></table>")
.append("<small><p>More content</p></small>")
.toString());


It sends the mail, but all the information is like this: Jill Smith50.....


What shoud I change? Do you have any other idea? Thank you!





10-29 05:13:29.240: I/dalvikvm(1516): Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
10-29 05:13:29.240: W/dalvikvm(1516): VFY: unable to resolve virtual method 11379: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
10-29 05:13:29.260: D/dalvikvm(1516): VFY: replacing opcode 0x6f at 0x0000
10-29 05:13:29.260: I/dalvikvm(1516): Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
10-29 05:13:29.260: W/dalvikvm(1516): VFY: unable to resolve virtual method 11385: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
10-29 05:13:29.260: D/dalvikvm(1516): VFY: replacing opcode 0x6f at 0x0000
10-29 05:13:29.260: I/dalvikvm(1516): Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
10-29 05:13:29.260: W/dalvikvm(1516): VFY: unable to resolve virtual method 8958: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
10-29 05:13:29.260: D/dalvikvm(1516): VFY: replacing opcode 0x6e at 0x000e
10-29 05:13:29.290: I/dalvikvm(1516): Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
10-29 05:13:29.290: W/dalvikvm(1516): VFY: unable to resolve virtual method 365: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
10-29 05:13:29.300: D/dalvikvm(1516): VFY: replacing opcode 0x6e at 0x0002
10-29 05:13:29.300: I/dalvikvm(1516): Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
10-29 05:13:29.300: W/dalvikvm(1516): VFY: unable to resolve virtual method 387: Landroid/content/res/TypedArray;.getType (I)I
10-29 05:13:29.300: D/dalvikvm(1516): VFY: replacing opcode 0x6e at 0x0002
10-29 05:13:29.420: D/AndroidRuntime(1516): Shutting down VM
10-29 05:13:29.420: W/dalvikvm(1516): threadid=1: thread exiting with uncaught exception (group=0xb1a4cd70)
10-29 05:13:29.450: E/AndroidRuntime(1516): FATAL EXCEPTION: main
10-29 05:13:29.450: E/AndroidRuntime(1516): Process: com.example.foodorder, PID: 1516
10-29 05:13:29.450: E/AndroidRuntime(1516): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.foodorder/com.example.foodorder.MainActivity}: android.view.InflateException: Binary XML file line #22: Error inflating class android.widget.ImageButton
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.app.ActivityThread.access$800(ActivityThread.java:138)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.os.Handler.dispatchMessage(Handler.java:102)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.os.Looper.loop(Looper.java:136)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.app.ActivityThread.main(ActivityThread.java:5026)
10-29 05:13:29.450: E/AndroidRuntime(1516): at java.lang.reflect.Method.invokeNative(Native Method)
10-29 05:13:29.450: E/AndroidRuntime(1516): at java.lang.reflect.Method.invoke(Method.java:515)
10-29 05:13:29.450: E/AndroidRuntime(1516): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
10-29 05:13:29.450: E/AndroidRuntime(1516): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
10-29 05:13:29.450: E/AndroidRuntime(1516): at dalvik.system.NativeStart.main(Native Method)
10-29 05:13:29.450: E/AndroidRuntime(1516): Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class android.widget.ImageButton
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
10-29 05:13:29.450: E/AndroidRuntime(1516): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:57)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
10-29 05:13:29.450: E/AndroidRuntime(1516): at com.example.foodorder.MainActivity.onCreate(MainActivity.java:17)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.app.Activity.performCreate(Activity.java:5242)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
10-29 05:13:29.450: E/AndroidRuntime(1516): ... 11 more
10-29 05:13:29.450: E/AndroidRuntime(1516): Caused by: java.lang.reflect.InvocationTargetException
10-29 05:13:29.450: E/AndroidRuntime(1516): at java.lang.reflect.Constructor.constructNative(Native Method)
10-29 05:13:29.450: E/AndroidRuntime(1516): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.view.LayoutInflater.createView(LayoutInflater.java:594)
10-29 05:13:29.450: E/AndroidRuntime(1516): ... 24 more
10-29 05:13:29.450: E/AndroidRuntime(1516): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x5/d=0x1001 a=2 r=0x7f08002b}
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.content.res.Resources.loadDrawable(Resources.java:2073)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.view.View.<init>(View.java:3566)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.widget.ImageView.<init>(ImageView.java:123)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.widget.ImageButton.<init>(ImageButton.java:87)
10-29 05:13:29.450: E/AndroidRuntime(1516): at android.widget.ImageButton.<init>(ImageButton.java:83)
10-29 05:13:29.450: E/AndroidRuntime(1516): ... 27 more


Could someone plz explain to me what should I do to solve the runtime error?




Following the Google Sheets Api examples, I wish to allow the user of my android application to authenticate with his google user account, access a spreadsheet in his google drive account and extract the cell content. So far I have managed to succesfully login with the Google+ Sign in button and have a working GoogleApiClient. From here on it seems unclear how to proceed to use this authentication to authorize the SpreadSheetService to obtain the necessary Sheets feeds. Authorizing with hard coded credentials as in



service.setUserCredentials(USERNAME, PASSWORD);


works and allows me to continue to access the feeds, but is it not possible to use the GoogleApiClient authentication for authorization of this service? Or is there another way to obtain these credentials (i.e. Drive.Query)?




I'm trying to fully style my plot using XML and I could do some things, but not everything I wanted.


Here are the things I'm missing now:



  • Add a background color to the legend (androidPlot.legendWidget.backgroundPaint.color="#ffffff" causes a "java.lang.NullPointerException: Attempt to call getObjectContaining(Object obj, String path) on a null Object instance. Path was: color")

  • Set the legend in the upper-right-or-left corner with a sensible width and with series stacking vertically and not horizontally (Matlab-style)


I think the documentation is lacking quite a lot, even if this guide helped somehow.


I could get (almost) everything else working properly without having to write Java code




I have activity for fullscreen browsing of images (something like gallery). In this activity I have ViewPager with offscreen limit 6. I use TouchImageView for my images. The problem is, that when I first zoom image and swipe to another photo, I want to see not zoomed photo when I return to it. TouchImageView has resetZoom() function, but how can I get offscreen page view from the FragmentStatePageAdapter or from ViewPager? Here's code of my activity:



public class ImageSlidesActivity extends FragmentActivity implements ViewPager.OnPageChangeListener {

final int PAGE_LIMIT = 6;
final int PAGE_MARGIN = 8;

long userID;
long deviceID;
String key;
String[] mAttachments;

ImageSlidesAdapter mAdaper;
ViewPager mPager;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
setContentView(R.layout.activity_image_slides);
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
//actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#33ffffff")));

Intent intent = getIntent();
mAttachments = intent.getStringArrayExtra("attachments");
int position = intent.getIntExtra("position", 0);

SharedPreferences pref = getApplicationContext().getSharedPreferences("authData", 0);
key = pref.getString("key", null);
userID = pref.getLong("userID", 0);
deviceID = pref.getLong("deviceID", 0);

setPageIndicator(position);
mAdaper = new ImageSlidesAdapter(getSupportFragmentManager(), mAttachments);

final View container = findViewById(R.id.container);
container.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getActionBar().hide();
container.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
}
});
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mAdaper);
mPager.setOnPageChangeListener(this);
mPager.setOffscreenPageLimit(PAGE_LIMIT);
mPager.setCurrentItem(position-1);

/* cause bug with the white strip
final float density = getResources().getDisplayMetrics().density;
mPager.setPageMargin((int) (PAGE_MARGIN * density + 0.5f));
mPager.setPageMarginDrawable(android.R.color.black);
*/
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
//getMenuInflater().inflate(R.menu.image_slides, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

if (id == android.R.id.home) {
onBackPressed();
}

if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}

@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

}

@Override
public void onPageSelected(int position) {
setPageIndicator(position+1);
}

@Override
public void onPageScrollStateChanged(int state) {

}

private void setPageIndicator(int page) {
setTitle(Integer.toString(page) + "/" + Integer.toString(mAttachments.length));
}

/**
* A fragment containing zoomable image.
*/
public static class ShowImageFragment extends Fragment {

String mAlias;
long mUserId;
long mDeviceId;
String mKey;
TouchImageView mImage;

static ShowImageFragment newInstance(String alias, long userId, long deviceId,
String key) {
ShowImageFragment f = new ShowImageFragment();

Bundle args = new Bundle();
args.putString("alias", alias);
args.putLong("userID", userId);
args.putLong("deviceID", deviceId);
args.putString("key", key);
f.setArguments(args);

return f;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = getArguments();
mAlias = bundle.getString("alias");
mUserId = bundle.getLong("userID");
mDeviceId = bundle.getLong("deviceID");
mKey = bundle.getString("key");
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_image_slides, container, false);
mImage = (TouchImageView) rootView.findViewById(R.id.imageView);
final ProgressBar prBar = (ProgressBar) rootView.findViewById(R.id.progressBar);

new AsyncTask<Void, Void, Bitmap>() {

@Override
protected Bitmap doInBackground(Void... voids) {
try {
String[] links = API.getImageLinkByAlias(mAlias, mUserId,
mDeviceId, mKey);
return ImageLoader.getInstance().loadImageSync(links[1]);
} catch (Exception e) {
// TODO: handle exceptions
e.printStackTrace();
cancel(true);
return null;
}
}

@Override
protected void onPostExecute(Bitmap bitmap) {
prBar.setVisibility(View.GONE);
if (bitmap == null) { return; }
mImage.setImageBitmap(bitmap);
mImage.setVisibility(View.VISIBLE);
mImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (getActivity().getActionBar().isShowing()) {
getActivity().getActionBar().hide();
} else {
getActivity().getActionBar().show();
}
}
});
}
}.execute();
return rootView;
}


@Override
public void setUserVisibleHint(boolean hidden) {
if (hidden && mImage != null) {
mImage.resetZoom();
mImage.invalidate();
}
}

}

public class ImageSlidesAdapter extends FragmentStatePagerAdapter {

private String[] mAliases;
public ImageSlidesAdapter(android.support.v4.app.FragmentManager fm, String[] aliases) {
super(fm);
mAliases = aliases;
}

@Override
public android.support.v4.app.Fragment getItem(int position) {
return ShowImageFragment.newInstance(mAliases[position], userID, deviceID, key);
}

@Override
public int getCount() {
return mAliases.length;
}
}


}




How I can get coordinates(x,y) of center point of the pie?enter image description here




I am trying to develop a custom swipe function, after reviewing the swipe method of jquery mobile version 1.4.4 which doesn't work in Android 4.2 onwards and other libraries, using touchStart, touchMove, touchCancel, touchEnd events. The objective is to drag a div in left direction so a menu comes up after a certain distance is covered.


I am able to determine the direction and distance covered. Once touchStart event is fired and till touchEnd i have to disable the vertical scrolling. The problem is when the page loads and when i try to do a vertical scrolling then also the scroll doesn't work. How will I disable vertical scroll only after detecting that i am trying to do a horizontal scroll first.


Any help in this regard will be greatly appreciated. Thanks




I am animating an ImageView by scaleX. This is supposed to be a progress bar which fills from left to right. It works without problem om API 10 and API 18,19. But on API 16 there seems to be a problem with the setPivotX. I have tried every option in NineOldAndroids: set view pivot .



final ImageView progressBarFill = (ImageView) getView().findViewById(R.id.progressbarImageFill);
...

ViewHelper.setPivotX(progressBarFill, 0);
AnimatorProxy.wrap(progressBarFill).setPivotX(0);
animate(progressBarFill).setDuration(1000).scaleX(0.25f);


and



AnimatorSet set = new AnimatorSet();
set.playTogether(
ObjectAnimator.ofFloat(progressBarFill, "scaleX", 0f, 0.25f)
);
AnimatorProxy.wrap(progressBarFill).setPivotX(0.0f);
ViewHelper.setPivotX(progressBarFill, 0f);
set.setDuration(1000).start();


The animation works but it animates from the center ot the ImageView. Can anyone confirm this issue?




Hi i am making demo application in which there are three activities. A, B, C. I am on B Activity and on button click starting C Activity. On same time I want to finish A activity.


I found some flag ClEAR_TOP and CLEAR_TASK but it is not for same which i am looking.


Is there any way to do in android ?


Any help. Thanks in advance.




I needed a checkbox with three states (Unchecked, PartiallyChecked and Checked) much like you see in tree views when some children are selected for use in one of my android projects so I decided to create a custom View.


I did this by copying the code from CompoundButton.java (https://github.com/android/platform_frameworks_base/blob/master/core/java/android/widget/CompoundButton.java) and adding an extra state.


The mechanics of my new button work fine but I cant get it to display properly. The image shown doesnt change after I press it.


I think one issue is with the line Drawable d = a.getDrawable(R.styleable.ThreeStateRadioButton_button); in the constructor because d is null here. I am not sure how to fix this and even if i make it my button drawable directly it doesnt resolve my issue.


My code is below. Any help would be greatly appreciated.


Thanks,


ThreeStateButton.java



class ThreeStateRadioButton extends Button {

private int mState = 1;
final public static int UNCHECKED = 0;
final public static int HALF_CHECKED = 1;
final public static int CHECKED = 2;

private boolean mBroadcasting;

private int mButtonResource;
private Drawable mButtonDrawable;

private OnCheckedChangeListener mOnCheckedChangeListener;
private OnCheckedChangeListener mOnCheckedChangeWidgetListener;

private static final int[] CHECKED_STATE_SET = {
R.attr.state
};

public ThreeStateRadioButton(Context context) {
this(context,null);
}

public ThreeStateRadioButton(Context context, AttributeSet attrs){
this(context, attrs, 0);
}

public ThreeStateRadioButton(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);

TypedArray a =
context.getTheme().obtainStyledAttributes(
attrs, R.styleable.ThreeStateRadioButton, defStyle, 0);


Drawable d = a.getDrawable(R.styleable.ThreeStateRadioButton_button);
if (d != null)
{
setButtonDrawable(d);
}

int state = a.getInt(R.styleable.ThreeStateRadioButton_state, 0);
setState(state);

a.recycle();
}

public void toggle(){
if(this.mState == this.UNCHECKED)
{setState(this.CHECKED);}
else if (this.mState == this.HALF_CHECKED)
{setState(this.CHECKED);}
else if (this.mState == this.CHECKED)
{setState(this.UNCHECKED);}
}

@Override
public boolean performClick(){
toggle();
return super.performClick();
}


public int getState() {
return mState;
}


public void setState(int state) {
if (mState != state) {
mState = state;
refreshDrawableState();


if(mBroadcasting)
{return;}

mBroadcasting = true;
if (mOnCheckedChangeListener != null) {
mOnCheckedChangeListener.onCheckedChanged(this, mState);
}
if (mOnCheckedChangeWidgetListener != null) {
mOnCheckedChangeWidgetListener.onCheckedChanged(this, mState);
}
mBroadcasting = false;
}
}

public void setOnCheckedChangeListener(OnCheckedChangeListener listener) {
mOnCheckedChangeListener = listener;
}

void setOnCheckedChangeWidgetListener(OnCheckedChangeListener listener) {
mOnCheckedChangeWidgetListener = listener;
}

public static interface OnCheckedChangeListener {
void onCheckedChanged(ThreeStateRadioButton buttonView, int State);
}

public void setButtonDrawable(int resId)
{
if (resId !=0 && resId == mButtonResource)
{
return;
}

mButtonResource = resId;

Drawable d = null;
if(mButtonResource != 0){
d = getResources().getDrawable(mButtonResource);
}
setButtonDrawable(d);
}

public void setButtonDrawable(Drawable d)
{

if (d!=null){

if(mButtonDrawable != null){
mButtonDrawable.setCallback(null);
unscheduleDrawable(mButtonDrawable);
}
d.setCallback(this);
d.setState(getDrawableState());
d.setVisible(getVisibility() ==VISIBLE, false);
mButtonDrawable = d;
mButtonDrawable.setState(null);
setMinHeight(mButtonDrawable.getIntrinsicHeight());
}
refreshDrawableState();
}

@Override
protected void onDraw(Canvas canvas){
super.onDraw(canvas);

final Drawable buttonDrawable = mButtonDrawable;
if(buttonDrawable != null){
final int verticalGravity = getGravity() & Gravity.VERTICAL_GRAVITY_MASK;
final int height = buttonDrawable.getIntrinsicHeight();


int y = 0;

switch (verticalGravity){
case Gravity.BOTTOM:
y = getHeight() - height;
break;
case Gravity.CENTER_VERTICAL:
y = (getHeight() - height) /2;
break;
}


buttonDrawable.setBounds(0,y,buttonDrawable.getIntrinsicWidth(),y+getHeight());
buttonDrawable.draw(canvas);
}
}

@Override
protected int[] onCreateDrawableState(int extraSpace){
final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
mergeDrawableStates(drawableState, CHECKED_STATE_SET);
return drawableState;
}

@Override
protected void drawableStateChanged()
{
super.drawableStateChanged();

if (mButtonDrawable != null){
int [] mDrawableState = getDrawableState();

mButtonDrawable.setState(mDrawableState);

invalidate();
}
}

@Override
protected boolean verifyDrawable(Drawable who){
return super.verifyDrawable(who) || who == mButtonDrawable;
}

static class SavedState extends BaseSavedState{
int state;

SavedState(Parcelable superState){
super(superState);
}

private SavedState(Parcel in){
super(in);
state = (Integer)in.readValue(null);
}

@Override
public void writeToParcel(Parcel out, int flags){
super.writeToParcel(out, flags);
out.writeValue(state);
}

@Override
public String toString() {
return "CompoundButton.SavedState{"
+ Integer.toHexString(System.identityHashCode(this))
+ " state=" + state + "}";
}

public static final Parcelable.Creator<SavedState> CREATOR
= new Parcelable.Creator<SavedState>() {
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}

public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
}

@Override
public Parcelable onSaveInstanceState() {
// Force our ancestor class to save its state
setFreezesText(true);
Parcelable superState = super.onSaveInstanceState();

SavedState ss = new SavedState(superState);

ss.state = getState();
return ss;
}

@Override
public void onRestoreInstanceState(Parcelable state) {
SavedState ss = (SavedState) state;

super.onRestoreInstanceState(ss.getSuperState());
setState(ss.state);
requestLayout();
}}


attrs.xml



<resources>
<declare-styleable name="ThreeStateRadioButton">
<attr name="state" format="enum">
<enum name="unchecked" value="0"/>
<enum name="half_checked" value="1"/>
<enum name="checked" value="2"/>
</attr>

<attr name="button" format="reference"/>

</declare-styleable>
</resources>


button.xml



<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res/my.app">
<item custom:state="unchecked" android:state_window_focused="false"
android:drawable="@drawable/btn_radio_off_holo_light" />
<item custom:state="checked" android:state_window_focused="false"
android:drawable="@drawable/btn_radio_on_holo_light" />
<item custom:state="half_checked" android:state_window_focused="false"
android:drawable="@drawable/btn_radio_on_disabled_holo_light" />


<item custom:state="checked" android:state_pressed="true"
android:drawable="@drawable/btn_radio_on_pressed_holo_light" />
<item custom:state="half_checked" android:state_pressed="true"
android:drawable="@drawable/btn_radio_on_pressed_holo_light" />
<item custom:state="unchecked" android:state_pressed="true"
android:drawable="@drawable/btn_radio_off_pressed_holo_light" />

<item custom:state="checked" android:state_focused="true"
android:drawable="@drawable/btn_radio_on_focused_holo_light" />
<item custom:state="checked" android:state_focused="true"
android:drawable="@drawable/btn_radio_on_disabled_focused_holo_light" />
<item custom:state="unchecked" android:state_focused="true"
android:drawable="@drawable/btn_radio_off_focused_holo_light" />

<item custom:state="unchecked" android:drawable="@drawable/btn_radio_on_holo_light" />
<item custom:state="checked" android:drawable="@drawable/btn_radio_off_holo_light" />
<item custom:state="half_checked" android:drawable="@drawable/btn_radio_on_disabled_focused_holo_light" />

</selector>