Menu
  • HOME
  • TAGS

Want to perform an action on a button press rather than a button click

java,android,android-studio

You're looking for an onTouch event, available with the OnTouchListener. final Button button = (Button) findViewById(R.id.button_id); button.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN) { // Do something } } }); ...

Android build project error trying to build apps > 65K (65536) methods

android,android-studio,gradle,build,android-gradle

You need to reduce the size or include only the imports you need to for your application. You are hitting the dex limit of 65536 methods. Here's the link Building Apps with Over 65K Methods which might help....

Android image fade animation

java,android,animation,android-studio,objectanimator

Try this code, its using ViewPropertyAnimator : View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { view.animate().alpha(0.2f).setDuration(1000); } }; Its always good to set a duration, so the Animation knows how long its supposed to run. EDIT : You might want to attach it to...

Twitter4j - cannot resolve method - setUsessl(boolean)

android,android-studio,twitter4j

Try to use the following configuration: ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setOAuthAuthenticationURL("https://api.twitter.com/oauth/request_token"); cb.setOAuthAccessTokenURL("https://api.twitter.com/oauth/access_token"); cb.setOAuthAuthorizationURL("https://api.twitter.com/oauth/authorize"); cb.setOAuthRequestTokenURL("https://api.twitter.com/oauth/request_token"); cb.setRestBaseURL("https://api.twitter.com/1.1/"); cb.setOAuthConsumerKey(consumerKey);...

Install Ultimate edition IntelliJ plugins in Android Studio

android,intellij-idea,android-studio

As you stated, some plugins are only available in IntelliJ Ultimate, hence you cannot use them in IntelliJ Community, which Android Studio is based on. This is noted in the plugin.xml of the Database plugin: <depends>com.intellij.modules.ultimate</depends> That's why simply moving the plugin lib files won't help. A solution would be...

Android _ failed for task ':app:packageAllDebugClassesForMultiDex' _ AbstractDateTime.class?

android,android-studio

Why do you have two joda times in your Gradle script? I always used just this one, and it works fine: compile 'joda-time:joda-time:2.8.1' I'm guessing there's probably a conflict between those two....

Invisible folders in Android Studio Project view

android-studio

Android Studio puts them by default into one view, physically there are still in different folders. If you want to change this, just change the project perspective in the project view on the left side.

Gradle - Error:Failed to find: com.squareup.okhttp:okhttp:2.4.0

android,android-studio,gradle,okhttp

You need to add the following block to the build script: repositories { mavenCentral() } ...

Cannot resolve symbols setAdapter and AttachToListView in Android Studio

android,android-studio

You have written all the code outside onCreate(). As codeMagic said, move all your code as shown below public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String[] values = new String[]{"Change message", "Change picture"}; ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, values); ListView listView...

How to determine Android Full SDK Download size?

android,android-studio,android-sdk-tools

You can find the archive size directly in the XML used by SDK Manager: https://dl.google.com/android/repository/repository-11.xml For example the size of Android SDK Platform 5.1.1 is 66852371 byte: <sdk:platform> <!-- Generated at Mon Mar 30 10:48:23 2015 from git_lmp-mr1-sdk-release @ 1819727 --> <sdk:revision>2</sdk:revision> <sdk:description>Android SDK Platform 5.1.1</sdk:description> <sdk:version>5.1.1</sdk:version> <sdk:api-level>22</sdk:api-level> <sdk:min-tools-rev>...

Can I replace ActionBarActivity with AppCompatActivity in a Tabbed Activity in Android Studio?

android-studio

You can safely replace ActionBarActivity with AppCompatActivity. As you can see in v7-appcompat source code from version v22.1.0 ActionBarActivity simply extends AppCompatActivity: /** * @deprecated Use {@link android.support.v7.app.AppCompatActivity} instead. */ @Deprecated public class ActionBarActivity extends AppCompatActivity { } ...

Android project: errors after changing machine

java,android,eclipse,android-studio

It states out that your ActionBar is null. If you're using Support Library try getActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true); instead of getActivity().getActionBar().setDisplayHomeAsUpEnabled(true); ...

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException

android,android-studio,gradle,multidex

Try adding dexOptions{ incremental true javaMaxHeapSize "4g" } ...

java.lang.NoClassDefFoundError: android/support/v7/internal/widget/ActionBarOverlayLayout$1

java,android,android-studio

Sometimes Android Studio has some rendering problems, so you could do three things in this situation: Firstly: be sure to have imported right appcompat-v7 library in your project structure (in your dependencies) Secondly: change the AppTheme in the preview window to NOT an AppCompat theme. You could try with some...

Where to put Gradle 2.2.1 manually

android,android-studio,android-gradle

Yes download the file manually from the gradle Homepage and then it really doesn't matter where you put the file. Just unzip the file to any directory on you workstation e.g., where you have your programms - and then in android studio you go File -> Settings -> Build execution...

Huge unusable font size in Android Studio

android,android-studio,fonts

The way to fix this is pretty easy actually. Navigate to C:/Users/< your account >/.AndroidStudio/config/options/ Open ui.Inf.xml and change the FONT_SIZE property to an appropriate value (12 is default iirc)...

Android Studio and gradle

android,android-studio,gradle

So I have found the solution at this http://www.alonsoruibal.com/my-gradle-tips-and-tricks/. The trick is in your Java Library module's build.gradle file you need to include the following. apply plugin: 'java' sourceCompatibility = 1.6 targetCompatibility = 1.6 Wrong Java Compiler When Including a Java Module as Dependency in Android Studio...

Android Studio: cannot upgrade google play services

android,google-maps,android-studio,google-play-services,google-play-developer-api

If you are using Android Studio open the build.gradle file and enter inside dependencies dependencies { compile 'com.google.android.gms:play-services:4.2.+' } more info Add Google Play Services to Your Project...

Android studio gradle flavor dimensions build varients not working correctly

android-studio,gradle,android-gradle,build.gradle,android-productflavors

I think you misunderstood the concept of flavorDimension. A flavorDimension is something like a flavor category and every combination of a flavor from each dimension will produce a variant. In your case, you must define one flavorDimension named "type" and another dimension named "organization". It will produce, for each flavor...

Automatically copy .so files from NDK library project?

android-studio,gradle,android-ndk

I does not know if ther is a way to have you .so files copied as you want whiout wirtting anything. But you could have gradle doing it for you. In your gradle file, add a task that copy those .so files where you need them to be. android {...

Android Studio : UNEXPECTED TOP-LEVEL EXCEPTION:

java,android,android-studio,android-gradle,build.gradle

Welcome. You are at the first step of Android gradle hell. Update your Android SDK components in SDK Manager to latest one including Extra > Google Repository (recommend to add almost all in Extra). Let's wash up your current file. AndroidManifest.xml: Remove the <uses-sdk ... /> lines. It's redundant as...

Action Bar No Resource Found.

android,android-studio,android-actionbar

You need to create the string value for your action_search reference. <resources> <string name="app_name">My Application</string> <string name="edit_message">Enter a message</string> <string name="button_send">Send</string> <string name="action_settings">Settings</string> <string name="action_search">Search</string> <string name="title_activity_main">MainActivity</string> <string name="title_activity_display_message">My...

Issue in Parcelable implementation in Android Studio 1.2.2 Upgrade

android,android-studio,parcelable

department.getClass().getClassLoader() This is what throws the error. department == null and you're trying to fetch it's class. Therefore it throws an NPE. Instead, fetch the class loader via the class object: Department.class.getClassLoader() ...

Android studio how to put the logcat window back to original place

android-studio,logcat,setting

It's easy. See the picture below: ...

Show notification in Adroid 5.0.1

java,android,android-studio,notifications

From developer.android.com Required notification contents A Notification object must contain the following: A small icon, set by setSmallIcon() A title, set by setContentTitle() Detail text, set by setContentText() So set a small icon too....

Android device monitor seems to miss crashes

android,android-studio,logcat,android-logcat

Logcat streams the log output from the device (or from an emulator) and that stream can be delayed, interrupted or just slow. When this happen I stop and restart it by clicking on this icon in Android Studio : If it's from a device and this behavior is frequent you...

Android studio can not resolve com.google.android.gms.location.places.AutocompleteFilter

android,android-studio,google-play-services,google-places-api

The Places API was only added in Google Play services 7.0: you'll need to update your dependency to be at least 7.0.0, although the latest as of this answer is 7.5.0. Note in almost every case, you should use selective APIs to only include the portions of Google Play services...

Unhandled Exception when calling SipProfile.Builder from Android SIP Class

java,android,object,android-studio,compiler-errors

The problem is, SipProfile.Builder may fail at runtime. It depends on server not the code. Then we should always use it with try-catch block. This is the working code: try { String id = txtId.getText().toString(); String username = txtUsername.getText().toString(); SipProfile.Builder builder1 = new SipProfile.Builder(id, username); } catch(java.text.ParseException e){ e.printStackTrace(); }...

If I change ID of an element in Android Studio, how do I carry on this change throughout the code?

android,android-studio

Select what you want to refactor for windows Press Shit+f6 do refactor for Mac press Shift+fn+F6 do refactor...

can anyone tell me how to store geocoder address in android database using android studio?

android,android-studio,android-sqlite

Simply return your address as String and store it in your local db using SQlite. It is easy to store a string in SQLite. Below is the code to get address. public static String getAddressFromLocation(Context context, double latitude, double longitude) { String address = ""; Geocoder geocoder; List<Address> listAddresses; try...

ProGuard issues with Android Archieve(.aar) library

android-studio,proguard,aar

Okay then, answering myself. Tried running ProGuard manually on .aar, worked with latest version v5.2.1. Didn't work with default version v4.7 which came with Studio v1.2.2. Hope this helps....

populating a text view in an android Fragment from a text file in /res/raw

java,android,android-fragments,android-studio

here is a bug in your Code. cuz you have forgotten the reference to TextView so add TextView text = (TextView) rootView.findViewById(R.id.txtSource); and then text.setText("your text!"); hope work for you:)...

Make Robolectric run test for the current build type only

android-studio,robolectric

It is quite simple. Let assume you have next: productFlavours { one two } So to run tests for on flavour you simply run gradle: gradle testOneDebug To run all tests for all variants: gradle test ...

Is there a way to make images take up less space in an apk or will I have to use an APK expansion file? [closed]

android,image,android-studio,apk-expansion-files

First of all, mipmap folders are for your app icon only. Any other other resources must be placed in drawable folder. Take a look at this post mipmap vs drawable. And to answer your question, there are several ways to optimize your images and layout to decrease the size of...

Having problems while trying to delete single rows from a custom ToDo list?

android,android-fragments,checkbox,android-studio

You need to assign an onclick listener to your delete button outside of the onChecked statement. Add it in code just after you assign the onClick event to the add button. This is because a view in android can only have 1 listener per event type. The onClick event can...

Can't migrating AndroidManifest.xml file to Android Studio?

android,android-studio

open project.properties file in a text editor and remove the line which was related to appcompat. Then I managed to import the project without errors. After successful import, I added appcompat as a dependency Android Studio: Android Manifest doesn't exists or has incorrect root tag Migrating From Eclipse Projects http://tools.android.com/tech-docs/new-build-system/migrating-from-eclipse-projects...

Android - Custom Home Application Doesn't Appear When Click Home Button

android,android-studio

You most likely have a different launcher set as default launcher. In the settings of your device you should be able to set the default launcher. Go to applications and look for your current launcher. Clear the default launcher. If you cleared the default launcher and correctly installed your launcher,...

Team explorer for android studio like visual studios [on hold]

android,android-studio

Yes, you can use Git or any other from below list. CVS Subversion Mercurial GitHub ...

How to send my project to someone not nearby?

android,android-studio

You can give them your apk file for testing. To get the debug version of your APK file, go to AndroidStudioProjects\ProjectName\app\build\outputs\apk\app-debug.apk Copy app-debug.apk and send it to your friend....

where to change the project configuration into the updated build tool revision in android studio?

android,android-studio

Yes, you can use the updated Build tools. And it will not create any problem to build your gradle project. Just modify the build.gradle from the app module with the latest build tool version: android { compileSdkVersion 22 buildToolsVersion "24.3.3" //most update version I can see in my sdk manager...

Android Studio HAXM not working

android,android-studio,haxm

Unfortunately you can't use HAXM because it's only for Intel processors: The Intel Hardware Accelerated Execution Manager (Intel® HAXM) is a hardware-assisted virtualization engine (hypervisor) that uses Intel Virtualization Technology (Intel® VT) to speed up Android app emulation on a host machine. In combination with Android x86 emulator images provided...

Generated source files should not be edited?

java,android,android-studio

You're in Packages view and putting all your files in the wrong folder. Switch to Project view (left hand, top side toggle). Under app, you should see a folder called src -> main -> java -> com.example.prateek. That's where all your class files should properly be to avoid autodeletion.

XML parsing error (android studio)

android,xml,android-studio

use this <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:id="@+id/toolbar"     app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"     android:layout_width="match_parent"     android:layout_height="wrap_content"...

Android Studio incorrect package name

android,eclipse,android-studio,android-gradle,packages

My problem was that I was looking at the wrong build.gradle file and didn't see the application id value. Once I found the correct file (thanks to @ianhanniballake) I changed the application id and it worked.

How to download a library dependence on gradle for external use?

cordova,android-studio,gradle,android-gradle,cordova-plugins

What you're looking for is an aar file. You can copy this file to lib folder with the following script: apply plugin: 'java' repositories { mavenCentral() } dependencies { compile 'io.filepicker:filepicker-android:[email protected]' } task copyLibs(type: Copy) { from configurations.compile into 'lib' } ...

App crashing after pushing button, but the action is working

android,button,android-studio,compiler-errors

It crashed if you dont press btn1 because without press it, mpAudio will be null. Then when onPause call, mpAudio.release(); will cause NullPointerException. Note that: onPause is called whenever the activity is not shown on screen but is still running(in your case, you start other activity with btn2,3 then it...

Android Studio Library Projects (Modules) show up as different Build Variants

android,android-studio

This is normal. It isn't showing each module as a different build variant, it's showing you each module in your project and allowing you to choose which build variant you want to build for that individual module. The actual build variants are selectable in the right-hand column of that view.

Android Studio javax.mail jar build error

java,android,email,android-studio

Add this to your dependencies section: compile 'javax.mail:javax.mail-api:1.5.3' ...

Android Studio manifest Errors

java,android,android-studio

That is because I believe your manifest is simply incorrect. Your manifest should look something like the following: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="location" > <uses-permission android:name="android.permission.INTERNET" /> <application android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" >...

How to set max line length in Android Studio code editor?

android-studio

Give this a shot: Android Studio Soft Wrapping Howto...

Reset Android Studio settings to default setting on linux

android,android-studio

It's very simple. Depending on your AndroidStudio version, the settings are stored in ~/.AndroidStudio, ~/.AndroidStudio1.1 or ~/.AndroidStudio1.2. Open a terminal and run the following code: ls -a | grep Android # See which of those three folders above you have. Then rename each of the settings folders you have with...

how make Sync or Async HTTP Post/Get in Android Studio

android,http,android-studio

The example I have posted below is based on an example that I found on the Android Developer Docs. You can find that example HERE, look at that for a more comprehensive example. You will be able to make any http requests with the following import android.app.Activity; import android.os.AsyncTask; import...

Logcat goes crazy on Android Studio

android,android-studio,android-logcat,android-debug

This is because you see log lines of the whole device. On the right top side of logcat you see: "Show only selected application". For some reason this does not do what you expect it to do. What I always do is filter on package name. Open the dropdown menu...

button.setPressed(true) suddenly not working

java,android,android-studio

Write your code as follows- redBut.performClick(); redBut.setPressed(true); redBut.invalidate(); new Handler().postDelayed(new Runnable() { @Override public void run() { redBut.setPressed(false); redBut.invalidate(); } }, 500); ...

How can make the width of string the same in Android?

android,android-studio

Unless you're using a monospaced font, achieving what you wanted is going to be quite difficult. Non-monospaced fonts has different width for each of the characters they posses. However, there's a workaround to this using layout arrangement. Here's an example: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="300dp" android:layout_height="match_parent"> <LinearLayout android:orientation="vertical"...

Android Studio Error: 'command 'C:\Program Files\Java\jdk1.7.0_75\bin\java.exe'' finished with non-zero exit value 2

android,android-studio

I've got this error when I had duplicates of libraries. For example if some module uses the same library that you are adding to the project this errorr might occur. Try to find if there any duplciates in your app. EDIT Yes correct , I have two same library in...

Simplest way to create a Shape in Android Studio

android,android-studio

The best way to create a circle in Android is using XML drawable. They don't have an exact circle shape, but oval shape will do the same job <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <solid android:color="#000000"/> </shape> ...

Use higher API level in android with an external library

java,android,api,android-studio,material-design

You can use limited features from material design in pre-lollipop versions. No Path Animations and such. Check out this link to see which features can be backported. http://android-developers.blogspot.com/2014/10/appcompat-v21-material-design-for-pre.html Although now it is appcompat-v22 which is the latest SDK released by Google....

Why does Gradle disregard release{} and implement a rule on debug build as well?

android-studio,android-gradle

the release{} is being disregarded Not really. Every line of code in build.gradle is executed when the script is processed. Gradle scripts are not there to execute code at build time. They are there to define the object model of the build process. In Android Studio, Gradle scripts are...

android studio casting warning

android,android-studio

You can try the following trick: Step 1: Find the inspector icon (a human with a cap) at the bottom right corner of your Android Studio. Step 2: Click on that and you can find a seek bar. It will help you to enable/disable or even you can configure it...

Null Pointer Exception when writing to a File - Android Studio

java,android-studio,nullpointerexception

You get the error because you are trying to write to a READ ONLY file. The line out = new FileOutputStream(f) throws an exception: java.io.FileNotFoundException: /storage/sdcard/Walk Data.csv: open failed: EROFS (Read-only file system), but you actually ignore it, so out = NULL and then you get the other exception. Move...

PDF file path is incorrect [duplicate]

java,android,pdf,android-studio,filepath

Replace your this line file = new File(Environment.getExternalStorageDirectory() + "/raw/" + "tirepressuremonitoringsystem3.pdf"); with this line file = new File("android.resource://com.cpt.sample/raw/tirepressuremonitoringsystem3.pdf"); ...

Android SQLite issue: 'Table […] has no column named' error

android,sqlite,android-studio,android-sqlite

First of all, you have to put whitespaces between each column names and their type : db.execSQL("CREATE TABLE " + TABLE + "(" + ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + NAME + " TEXT," + PHONE + " TEXT," + EMAIL + " TEXT," + ADDRESS + "...

app crashes with no input while using Edittext in android studio

java,android-studio,android-edittext

Integer.parseInt() fails when no input is given, calculate only if there is an input. public void onButtonClick (View v) { int num1 = 0,num2 = 0,sum = 0; EditText e1 = (EditText)findViewById(R.id.num1); EditText e2 = (EditText)findViewById(R.id.num2); TextView t1 = (TextView)findViewById(R.id.sum); if(!(e1.getText().toString()).equals("")) num1 = Integer.parseInt(e1.getText().toString()); if(!(e2.getText().toString()).equals("")) num2 = Integer.parseInt(e2.getText().toString()); sum =...

Getting processDebugResources error in Android Studio

android,android-studio

Fixed the issue. There was a png image inside mipmap folders named default and renaming that name to a different name solved the issue.

Error execute studio.sh unrecognized vm option 'MaxPermSize=350m' on Ubuntu 14.04

ubuntu,android-studio,ubuntu-14.04

oh I've solved this problem, I install Oracle JDK 9 when android studio runs on JDK 6 or JDK 7 (if I'm not mistaken). so I uninstalled Oracle JDK 9, then download and install the JDK 7...

Gradle Compilation Errors when adding 'com.amazonaws:aws-java-sdk:1.10.1'

java,amazon-web-services,android-studio,build.gradle

It seems that when you added the Amazon SDK your app reached the maximum method count allowed in Android (over 65K). see here on how to configure your app for multidex: https://developer.android.com/tools/building/multidex.html

Add Event Handler to ImageButton

android,android-studio

You must have View as a parameter of method that you wish to call, while bind click event through layout file. Try this: public void tapImageButton(View view) { // Code that does stuff will come later on. Toast.makeText(this, "clicked !!", Toast.LENGTH_SHORT).show(); } In xml: ... android:onClick="tapImageButton" ... ...

Trouble implementing android_serialport_api into my own application

android,android-studio,serial-port,embedded-linux,beagleboneblack

Create a new Module using the third party library and include in your project. Now you can start importing the classes directly from the third party library. Android studio has options to create a new module from the current project.

how to add menu items to action bar in more than 30 activities

android,android-activity,android-studio,menu,menuitem

Option A A base Activity class that implements the logic for the menu items - in this case all 30 of your Activities should extend the base Activity. This approach has the serious limitation that it forces you to extend a class even though you may need to extend another...

SugarORM + Kotlin: Unresovled reference “listAll”

android,android-studio,kotlin,sugarorm

As those are static methods, you need to call them on the declaring class SugarRecord. Your code should be: SugarRecord.listAll(javaClass<Contact>()) ...

Failed to create JVM in android studio

android,android-studio,jvm

At this point in time, Android supports up to JDK v1.7. See here for more technical info. You can get the latest JDK v1.7 release 79 here. Note: You can have multiple JDK versions installed on your computer, but you need your JAVA_HOME variable to point to the installation of...

Duplicate entry for class in gradle

java,android,android-studio,gradle

The above library is already on maven. Just remove the imported folder and add the code below to your dependencies: compile 'com.flaviofaria:kenburnsview:1.0.6' Sometimes due to downloading issues; the library fails to download. In that case ; just find your .gradle folder and clear cache inside it. Recompile and you are...

Unfortunately Application has stopped after running it from Anroid Studio

java,android,android-studio

If your XML-Layout file should be the layout of the rows of the list, then as your stacktrace tells you, you are having a LinearLayout where you should only have a TextView. The ArrayAdapter takes only a single TextView as layout as this is the place where it will show...

Create menu from button?

android,android-studio

Today the best way is create a dialog fragment where you can inflate it with differents layouts, in your case different menus. In this post I talk a little about Dialog Fragment and I show a simple example. Tell me if I helped you and good programming!!...

Unexpected Token Error in Android Studio

android,android-studio

First, I believe there is a syntax error. It should probably be: private static final String TAG = "My Message"; Secondly, the error just means that this line of code is never used. To solve it, just delete that line of code. (Alternately, you could use it somewhere like Log.i(TAG,...

How can IntelliJ refactor class constants to an external class?

java,intellij-idea,android-studio

Click the menu "Refactor", and choose "Move...". Then select the constants you want to move and enter the class where you want to move them.

Android Studio — Changing generation path and filename of both unsigned and signed APKs

android,android-studio

Ok, @Selvin gave me the way to understand how to do it, but I'll post it anyway. In your build.gradle you have to edit your buildTypes.release section. release { debuggable false minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt') proguardFiles 'proguard-rules.pro' applicationVariants.all { variant -> variant.outputs.each { output -> def date = new Date()...

PNG transparent backgrounds appearing black when using Android Studio

android,android-studio,png,adt,android-drawable

Its seems to be problem in Theme used in xml file . -check it once if the theme is different in eclipse and Android Studio then you can correct it. by changing the Theme on file style.xml Hope this will helpful .thanks...

ImageButton Not clickable - AndroidStudio

java,android,android-layout,android-studio

You are using PNG images as background. You should use the android:src attribute instead of android:background to get the touch feedback when the button is being clicked. If you want to change the background you must use an XML drawable selector. See the docs

Countdown Timer Notification

android,android-activity,android-studio,background,countdowntimer

Use Android's Timer and TimerTask classes. Below I assume that you know how to display notifications, as it appears you do in your question. Along with your number pickers, have a Button defined in your static layout like so: <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Start CountDown" android:onClick="startCountdown" /> Above I assume that...

Cant start developing for android

android,android-studio

Start with studio When starting with studio will be confusing but don't worry I think this may help you Start a project Writing a layout first decide the layout for the app for scrollable apps use Writing java this is main part here you can do wherever you want to...

Choosing specific ports on local development server for non-default modules

java,google-app-engine,android-studio,gradle,app-engine-modules

@crazystick answered it for Maven. Here's the same solution re-done for Gradle: apply plugin: ear ... appengine { downloadSdk = true httpAddress = "0.0.0.0" jvmFlags = ['-Dcom.google.appengine.devappserver_module.default.port=8080', '-Dcom.google.appengine.devappserver_module.module1.port=8081'] appcfg { email = "[email protected]" oauth2 = true } } ...

How to put Like function under an image and save the “Liked” status?

java,android,android-studio,imageview,sharedpreferences

I wouldn't really recommend using SharedPreferences to that extent. To me that feels like that extends in to "abuse" of its intended functionality. Maybe other people having differing opinions on that. I would personally use an SQLite database or something. However, to answer your question. When initializing your like button:...

Resetting an Inflated ListView's height, Listview height

android,android-listview,android-studio

It will expand your listview as per your row height and width dynamically. public static void getTotalHeightofListView(ListView listView) { ListAdapter mAdapter = listView.getAdapter(); int totalHeight = 0; for (int i = 0; i < mAdapter.getCount(); i++) { View mView = mAdapter.getView(i, null, listView); mView.measure( View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); totalHeight +=...

Cannot resolve method 'openFileOutput(java.lang.String,int)

java,android,android-studio,android-file

openFileOutput(); needs a Context. You are calling it in an ArrayAdapter. It should be: // Define your context then use below code context.openFileOutput(); ...

Error:(12) No resource identifier found for attribute 'scalteType' in package 'android'

android,android-studio

All the information you need is right here, before your eyes. No resource identifier found for attribute 'scalteType' in package 'android' There is no attribute called "scalteType" in ImageView. Find it in the layout file 'main.xml' and change to "scaleType"....

Android Studio plugin for capture Strings

android,string,android-studio

I'm not exactly sure what you are asking, but if you are wondering how you can find all of your hardcoded strings, you can find them through Android Lint. In android studio go to Analyze -> Inspect Code. Then in the results expand Android Lint. Hardcoded text will be one...

Close module in android studio

android,eclipse,android-studio

There is no notion of opening and closing a module in Android Studio. There should be no need to do it. You seem to be treating an Android Studio project as being the equivalent of an Eclipse workspace, and IMHO that is not a valid comparison....

Simple Android Studio TextView Code Using Java

java,android,android-studio

if I understand correctly what you're trying to accomplish, is with java code create a TextView in an Android App. If so, you are aproaching it the wrong way. Let me explain: What you are doing; You are creating an Activity that extends (inherits in Object Oriented Programming lexicon) TextView,...

getView method causing NullPointerException

java,android,android-studio

It looks like you just need to set your local reference of imageInformationList in the constructor of your ImageAdapter class. Since you never set it to the reference that is passed into the constructor, it is still null when you call imageInformationList.get(position).getImg() inside getView(). To fix it, just assign the...

Android Studio work with module

java,android,android-studio,gradle

You need to check all Manifest files and ensure your modules are not providing activity with <intent-filter> used by Lauchers: <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> Also ensure your module's build.gradle for module is lists apply plugin: 'com.android.library' (as it should), and not apply plugin: 'com.android.application' (which is not correct)...

ClassNotFoundException on android blank activity

java,android,android-studio,classloader,classnotfoundexception

Тry to change the class loader ClassLoader.getSystemClassLoader() with this one this.getClass().getClassLoader()

Android getSupportedPreviewSizes() on Camera returns only 3 sizes

java,android,android-studio,android-emulator,android-camera

The preview size will rarely, if ever, exactly match the size of the surface on which you are rendering the previews. SurfaceView and TextureView will scale the previews to fill the available space of those views. Your job, therefore, is to size the surface as big as you want to...

Error trying to call .buildClassifier (Weka) in Java AndroidStudio

java,android,android-studio,weka

It was problem with weka.jar library. Normal one that I download from weka site is not working with android.Now I downloaded modified one from user rjmanrsan: https://github.com/rjmarsan/Weka-for-Android Working now :)

How can I control android webview activity changes when I change screen orientation?

java,android,android-studio,android-webview,screen-orientation

Use savedInstanceState. Load the url only when it is null. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_webview); wv = (WebView) findViewById(R.id.myWeb); wv.getSettings().setJavaScriptEnabled(true); wv.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); wv.getSettings().setDomStorageEnabled(true); wv.setWebViewClient(new MyWebViewClient()); wv.setWebChromeClient(new MyWebChromeClient()); if (savedInstanceState == null) {...