android-context

Build Signed APK failed - Can't find common super class of [android/content/Context]

◇◆丶佛笑我妖孽 提交于 2019-12-02 02:17:00
This is Android Project. Using Normal Build was successfull, but using signed Key i got this error : Execution failed for task ':transformClassesAndResourcesWithProguardForFlavorRelease'. > java.io.IOException: java.lang.IllegalArgumentException: Can't find common super class of [android/content/Context] (with 2 known super classes) and [com/onesignal/ADMMessageHandler] (with 1 known super classes) Any Idea ? Thanks in advance... I think Proguard causes this problem. Add this line to your Proguard file. -keep class com.onesignal.** { *; } And you should read this issue. It may help you. https:

Can someone clarify Android context references?

送分小仙女□ 提交于 2019-12-01 21:49:41
问题 My misunderstanding continues ... Can anyone cite references for the proper use of get*Context() ? I get conflicting recommendations about using getBaseContext() , getApplicationContext() and getContext() and my understanding is that using this is a convenience to get*Context() . I would like to study more specifically of what Dalvik is intending its object and access methods. I had code reviews that changed my calls to getBaseContext() to getApplicationContext() , now I am seeing suggestions

Can someone clarify Android context references?

邮差的信 提交于 2019-12-01 19:31:31
My misunderstanding continues ... Can anyone cite references for the proper use of get*Context() ? I get conflicting recommendations about using getBaseContext() , getApplicationContext() and getContext() and my understanding is that using this is a convenience to get*Context() . I would like to study more specifically of what Dalvik is intending its object and access methods. I had code reviews that changed my calls to getBaseContext() to getApplicationContext() , now I am seeing suggestions to use this. theWook http://android-developers.blogspot.co.uk/2009/01/avoiding-memory-leaks.html Read

Why Context can't be used in doInBackground() of AsyncTask

此生再无相见时 提交于 2019-12-01 18:42:29
I am just finding what is the fact behind not using Context inside doInBackground() . In-fact we can't update the UI inside doInBackground() directly, to update the UI inside doInBackground() we have to call other thread via publishProgress() method which is responsible to call onProgressUpdate() . So in short I just wanted to know what is the chemistry between UI thread and AsyncTask , and why AsyncTask execute in UI Thread. Q Why Context can't be used in doInBackground() of AsyncTask? Context as the name suggests, its the context of current state of the application/object. It lets newly

NullPointerException at android.content.ContextWrapper

巧了我就是萌 提交于 2019-12-01 18:04:00
问题 When I try to get a color via getResources().getColor(R.color.yellow) in a normal Activity I get this exception: 07-12 11:58:38.019: E/AndroidRuntime(3233): FATAL EXCEPTION: main 07-12 11:58:38.019: E/AndroidRuntime(3233): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.moveinblue.planner/com.moveinblue.planner.controller.plan.PlanDayScreen}: java.lang.NullPointerException 07-12 11:58:38.019: E/AndroidRuntime(3233): at android.app.ActivityThread

Context inside a Runnable

旧时模样 提交于 2019-12-01 17:38:35
问题 I try to play a sound from R.raw. inside a Thread/Runnable But I can't get this to work. new Runnable(){ public void run() { //this is giving me a NullPointerException, because getBaseContext is null MediaPlayer mp = MediaPlayer.create( getBaseContext(), R.raw.soundfile); while (true) { if (something) play something } } How can I get the real Context inside the run method? It is null no matter what I try. Or is there a better way to do this? 回答1: You should also be able to get the this

android.content.Context.getContentResolver()' on a null object reference

怎甘沉沦 提交于 2019-12-01 11:45:53
I can't seem work out why I am getting a null pointer on this? This is my AsyncTask that I call to grab the data. It passes it to a JSON Parser and an array of Objects is returned. This is then passed to my DBHelper where it was passing to my database through a ContentResolver.... public class getFilms extends AsyncTask<String, Void, Void> { public int LIMIT_FILMS = 10; String KEY = "apikey"; String LIMIT = "limit"; private static final String URL = "http://api.rottentomatoes.com/api/public/v1.0/lists/movies/box_office.json?"; private static final String API_KEY = "******************";

android.content.Context.getContentResolver()' on a null object reference

雨燕双飞 提交于 2019-12-01 09:34:18
问题 I can't seem work out why I am getting a null pointer on this? This is my AsyncTask that I call to grab the data. It passes it to a JSON Parser and an array of Objects is returned. This is then passed to my DBHelper where it was passing to my database through a ContentResolver.... public class getFilms extends AsyncTask<String, Void, Void> { public int LIMIT_FILMS = 10; String KEY = "apikey"; String LIMIT = "limit"; private static final String URL = "http://api.rottentomatoes.com/api/public

get Activity object while in View context

梦想的初衷 提交于 2019-12-01 09:05:25
This is a followup to this post: findViewById in a subclassed SurfaceView throwing RuntimeException Based on Romain Guy's feedback (which I'll accept shortly as it is a solution), I'd like to obtain the calling Activity from within the View, so that I can use it to obtain the desired TextView resource. I don't see any methods in View that return Activity. What is the proper way to do this? Or is there a better alternative for working with TextViews from within another View context. Basically, I am calling setContentView(R.layout.xxx) in onCreate() (as usual), so I don't really have a way to

How to remove error : create method 'getApplicationContext()' and 'runOnUiThread(Runnable)' when extends Fragment

倖福魔咒の 提交于 2019-12-01 08:57:00
问题 When I am using the getApplicationContext() that time eclipse give me error create method 'getApplicationContext()' . Please let me know How to remove this error. I am try also using ClassName.this that time error like change method startListening(Context) to startListening(Main) Also when I use like : measurement_index = AppSettings.getMeasureUnit(this); then Error like : change method getMeasureUnit(Context) to getMeasureUnit(Main) So please let me know how can solve error like: create