I have external package class (my custom library), which I want to include in the project. It uses Activity, but shows error as you see.
If I place this command in main project class, it works well... What to do?
Here is the code:
package com.__MyDefaultLibrary; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.preference.PreferenceManager; import android.view.View; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.LinearInterpolator; import android.view.animation.ScaleAnimation; import android.widget.*; import java.io.File; import java.util.Calendar; // import android.app.Activity; import com.oceanesa.samplevideorecorder.R; public class __MyDefaultFunctions{ public android.app.Activity actv1 = android.app.Activity; public void Initt(){ PreferenceManager.setDefaultValues(actv1.getBaseContext(), R.xml.mypreferences, false); } // ========== MY CUSTOM LIBRARY =============// //button find public Button fvb(int id) { return (Button) actv1.findViewById(id); } //message show public void msg(String text) { Toast.makeText(actv1.getApplicationContext(), text, Toast.LENGTH_LONG).show(); } public View.OnClickListener optionsListener2 = new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(actv1.getBaseContext(), com.__MyDefaultLibrary.__MyDefaultPreferencesInit1.class); actv1.startActivity(i); } }; } And AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.oceanesa.samplevideorecorder" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <uses-feature android:name="android.hardware.camera.front" android:required="false" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:screenOrientation="landscape" android:theme="@style/AppTheme" > <activity android:name="com.oceanesa.samplevideorecorder.VideoCaptureExample" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.__MyDefaultLibrary.__MyDefaultPreferencesInit1" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN_ACTIVITY" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> </manifest> 