Questions tagged [methods android]

25
votes
9answers
142k views

Android ListView with onClick items

I'm a new programmer and new in Android. I'm using this example http://www.androidhive.info/2012/09/android-adding-search-functionality-to-listview/ and it works great. Now I want to make the items (...
21
votes
13answers
36k views

Android ViewPager setCurrentItem not working after onResume

Ive got this strange issue, ViewPager's setCurrentItem(position, false) works perfectly fine, then im switching to another activity, and after im back to the first activity, the ViewPager always ends ...
23
votes
4answers
39k views

“No enclosing instance of type” error while calling method from another class in Android

Colleagues, I have the such question:1. In my first class I have the public class parseYouTubeAndYahoo extends AsyncTask<String, Void, List<VideoDataDescription>>to parse data from ...
11
votes
3answers
12k views

Communication between BroadcastReceiver and Activity - android

I have a broadcast receiver in my app which is fired every time the user gets an incoming call. Now, when it happens, I need the broadcast receiver to invoke a specific method in a specific activity. ...
6
votes
3answers
14k views

how to resolve this error “com.android.internal.telephony cannot be resolved to a type” in android

i am creating simple call filter application which restrict unwanted calls. i use following code to restrict call but i am unable to resole problem of this line in below code " com.android.internal....
100
votes
4answers
121k views

Android: How can I pass parameters to AsyncTask's onPreExecute()?

I use an AsyncTask for loading operations that I implemented as an inner class. In onPreExecute() I show a loading dialog which I then hide again in onPostExecute(). But for some of the loading ...
7
votes
4answers
6k views

Android call method from another app

I have 2 android apps. Both are installed on the phone. Lets say the package name for the two are com.android.test1 and com.android.test2. How can i call the method Main2method() from the test1.Main ...
9
votes
3answers
26k views

Android/Java: Calling a method using reflection?

I have a static method titled chooseDialog(String s, int i) in which I want to call another method within the same class (Dialogs.class) based on the parameters provided to chooseDialog. s is the name ...
4
votes
4answers
3k views

Declare local variables as late as possible or at the nearest curly brace they belong? [closed]

I am working to set some programming practices standards for my organization.Doing so i came across the issue "Title of this question"Some finds it best declaring variables as late as possible and ...
40
votes
3answers
27k views

Can't Override onPostExecute() method in AsyncTask Class or get it to trigger

I am having trouble getting the onPostExecute() method to call when running an AsyncTask. When I try to set up my class extending AsyncTask in which the onPostExecute() is overridden I get the ...
16
votes
11answers
47k views

getActivity() where it is defined?

I'm very new to android and I'm following this example.The code says we need to do these steps to get an dialog box:AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());// 2. ...
23
votes
3answers
22k views

Calling a Activity method from BroadcastReceiver in Android

Here I am creating an online application that depends only on Internet.So whenever there is a network error it must notify user. For that, I have created a BroadcastReciver that receives call when ...
8
votes
3answers
10k views

Get current wallpaper

I'm pretty new to Android programming so bear with me.I was wondering if there was a method of retrieving the current wallpaper on an android device and saving it to a variable in your app's code....
11
votes
2answers
3k views

Android 6 Permissions=> Crash when disable permission and go back to the app

I would like to use permission for android 6 in my app but i saw a strange event. Perhaps you can help me about that.If you start your app with "Dangerous" permissions, these permissions appears in ...
1
vote
1answer
694 views

Android - Calling an ordinary object method from an activity

First, I am an android rookie, so my solution ways can be found awkward, and i am open to suggestions.I am trying to create a game manager object that handles all transitions between activities. And ...
10
votes
2answers
2k views

Mapping between Android permissions (that we define in the manisfest file ) to corresponding API calls /methods

Where can I find the mapping between Android permissions (that we define in the manisfest file ) to corresponding API calls /methods?For exampleGET-ACCOUNTS” is a permission type which maps to...
14
votes
8answers
8k views

Best way to store SparseBooleanArray in Bundle?

When a config change happens, my ListView Checkbox states get lost, which I understand why.I try to implement public void onSaveInstanceState(final Bundle outState)in one of my Fragments. So I'm ...
12
votes
5answers
16k views

Eclipse Content Assist not working with Android

I'm not sure is this is a problem with my installation of Eclipse (Helios) and Android SDK or something else but Eclipse Content Assist doesn't propose Object Methods for Android classes. For ...
10
votes
7answers
11k views

Where the heck is Bitmap getByteCount()?

I know the Android platform is a huge mess, over complicated and over-engineered, but seriously to get the size of a bitmap, is it really necessary to do all those conversions?Bitmap bitmap=your ...
9
votes
6answers
29k views

“System services not available to Activities before onCreate()” Error message?

When the user hits an icon in my app, I want the app first to check if the device is connected to the internet and then do something depending on the result it receives (for know it's just popping up ...
3
votes
5answers
12k views

Call Activity Method From Fragment

I'm dealing with fragments.I have an Activity and different fragments.Each fragment need the access to a Class(call it X) that allow it to access a database, but, because I have a lot of fragments, ...
1
vote
4answers
6k views

Android: Access method in an activity from another activity

My launch activity starts up another activity whose launch is set to single instance. In this 2nd activity, I have a public method. I then start up a 3rd activity and that activity needs to access the ...
0
votes
1answer
1k views

how to fire notification from BroadcastReceiver?

how to fire notification from BroadcastReceiver (can't use most methods and can't use "this")?I need it to open a activity with info from the DB I already did it but now must of the methods dosen't ...
0
votes
5answers
21k views

How to call method in main activity from other activity?

I want to call public method in main activity from other activity. How can I do that?class MainActivity extends Activity {public void myMethod() {}}class MyActivity extends Activity {...
8
votes
1answer
15k views

The method getFragmentManager() is undefined for the type MyActivity

Since I've been using my code, I used fragments. To do so, I have an activity calling a fragment using a fragment by tag :FluxListFragment FLF=(FluxListFragment) getFragmentManager()....
6
votes
5answers
14k views

Java multiple variable length argument

I have not seen the particular thing before today when working on variable length argument For e.g., There is a method named prepared statement with declaration such that1.String ...
5
votes
2answers
4k views

Different Java methods for different API Levels

How can you make a method with some versions each for a different API level. I think it's something like this, but I'm not sure@apilevel("11")private void getR(){...}@apilevel("4")private ...
2
votes
3answers
522 views

click listener in OnBindViewholder recyclerview android

In the below code 'setlisteners' method is called every time,should'nt value of position change?There is only one method'setlisteners'in which parameter position is passed,but when in log ,i see that ...
1
vote
1answer
2k views

Android: method call expected error

I've searched internet for that error and have not found right answer. I've got error saying "method call expected" on mPrefsKeys in bindPreferenceSummaryToValue(findPreference(mPrefsKeys(i)))public ...
1
vote
2answers
997 views

How can I Reuse Methods for ListViews?

I have several methods in the ListAC ListActivity that I want to reuse and would like to put in separate classes (if possible??). I will be having dozens of ListView Activities (ListActivities ie: ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,