‘Must Override a Superclass Method’ Errors after importing a project into Eclipse

Eclipse is defaulting to Java 1.5 and you have classes implementing interface methods (which in Java 1.6 can be annotated with @Override, but in Java 1.5 can only be applied to methods overriding a superclass method). Go to your project/IDE preferences and set the Java compiler level to 1.6 and also make sure you select … Read more

Strange OutOfMemory issue while loading an image to a Bitmap object

To fix the OutOfMemory error, you should do something like this: BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 8; Bitmap preview_bitmap = BitmapFactory.decodeStream(is, null, options); This inSampleSize option reduces memory consumption. Here’s a complete method. First it reads image size without decoding the content itself. Then it finds the best inSampleSize value, it should be … Read more

Is there a way to get the source code from an APK file?

Simple way: use online tool https://www.decompiler.com/, upload apk and get source code. Procedure for decoding .apk files, step-by-step method: Step 1: Make a new folder and copy over the .apk file that you want to decode. Now rename the extension of this .apk file to .zip (e.g. rename from filename.apk to filename.zip) and save it. … Read more

Activity restart on rotation Android

Using the Application Class Depending on what you’re doing in your initialization you could consider creating a new class that extends Application and moving your initialization code into an overridden onCreate method within that class. public class MyApplicationClass extends Application { @Override public void onCreate() { super.onCreate(); // TODO Put your application initialization code here. … Read more

How do I pass data between Activities in Android application?

In your current Activity, create a new Intent: String value=”Hello world”; Intent i = new Intent(CurrentActivity.this, NewActivity.class); i.putExtra(“key”,value); startActivity(i); Then in the new Activity, retrieve those values: Bundle extras = getIntent().getExtras(); if (extras != null) { String value = extras.getString(“key”); //The key argument here must match that used in the other activity } Use this … Read more

error code: 521