I am working on an Image filter application, in this I have to apply some filters like pencil sketch, crop etc. for that I am using aviary library for android but when I call startActivityForResult() application get force close. Here are the logcats:
11-23 13:31:03.290: E/AndroidRuntime(4367): FATAL EXCEPTION: main
11-23 13:31:03.290: E/AndroidRuntime(4367): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jai.imagedemo/com.aviary.android.feather.FeatherActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class android.widget.RelativeLayout
Any help in resolving this problem ?
Here is my code:
Intent newIntent = new Intent( this, FeatherActivity.class );
newIntent.setData(Uri.parse(imageFilePath));
newIntent.putExtra( Constants.EXTRA_OUTPUT_FORMAT, Bitmap.CompressFormat.JPEG.name() );
String mSessionId = StringUtils.getSha256( System.currentTimeMillis() + "pv1frfq8o76siqy" );
newIntent.putExtra( Constants.EXTRA_OUTPUT_HIRES_SESSION_ID, mSessionId );
newIntent.putExtra( Constants.EXTRA_IN_SAVE_ON_NO_CHANGES, true );
startActivityForResult( newIntent, 2 );
And here is content of Manifest (for aviary library)
<activity
android:name="com.aviary.android.feather.FeatherActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:hardwareAccelerated="true"
android:largeHeap="true"
android:process=":standalone"
android:screenOrientation="unspecified" />
<provider
android:name="com.aviary.android.feather.library.providers.FeatherContentProvider"
android:authorities="com.aviary.launcher.HiResProvider"
android:exported="false" >
</provider>
Got the solution of your answer. Just add this line in your manifest :-
android:theme="#style/AviaryTheme"
Like that :-
<activity
android:name="com.aviary.android.feather.FeatherActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:finishOnTaskLaunch="true"
android:hardwareAccelerated="true"
android:process=":standalone"
android:screenOrientation="unspecified"
android:uiOptions="splitActionBarWhenNarrow"
android:theme="#style/AviaryTheme"/>
It will resolve Binary inflate problem. You must add aviary theme.
Related
i made a new activity and when i im trying to move between them by clicking a button the app crash and logcat shows the error below
12-16 14:02:09.016 23235-23235/com.modather.scalculate E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.modather.scalculate, PID: 23235
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.modather.scalculate/android.support.v7.widget.AppCompatButton}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java)
at android.app.Instrumentation.execStartActivity(Instrumentation.java)
at android.app.Activity.startActivityForResult(Activity.java)
at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:67)
at android.app.Activity.startActivityForResult(Activity.java)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:720)
at android.app.Activity.startActivity(Activity.java)
at android.app.Activity.startActivity(Activity.java)
at com.modather.scalculate.HomePage$onCreate$1.onClick(HomePage.kt:36)
at android.view.View.performClick(View.java)
at android.view.View$PerformClick.run(View.java)
at android.os.Handler.handleCallback(Handler.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".HomePage"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.modather.scalculate.age"
android:label="Calculate my age(SC)" />
</application>
i had searched over stackoverflow and found some solution but it didn't work for me.. so if it possible to fix mine ?
Here's the moving code
fab.setOnClickListener {
val intent = Intent(this, activity_age::class.java)
startActivity(intent)
}
There is Typing mistake check it
your activity name is activity_age and you have added in manifest age is
fab.setOnClickListener {
val intent = Intent(this,age::class.java)
startActivity(intent)
}
I'm trying to launch an Activity on a module I imported from my main app.
Nothing is happening. No crash and no launch. Here is my code on my main app:
Intent moduleActivity = new Intent("com.service.ModuleActivity");
startActivity(moduleActivity);
Here is the module manifest :
<application
android:allowBackup="true"
android:supportsRtl="true"
android:largeHeap="true"
android:persistent="true" >
<activity android:name="com.service.ModuleActivity"
android:screenOrientation="landscape"
android:launchMode="singleTask">
<intent-filter>
<action android:name="com.service.ModuleActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
I have no crash and on debug the Intent moduleActivity is not null
What did I miss ?
Finally I resolved it..
Intent moduleActivity = new Intent("com.service.ModuleActivity");
moduleActivity .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //by adding this line
startActivity(moduleActivity);
Thanks all
I'm trying to display GoogleMaps inside a nested fragment:
// inflate and return the layout
View v = inflater.inflate(R.layout.fragment_nearby_map, container, false);
mMapView = (MapView) v.findViewById(R.id.mapView);
But I'm getting an exception that seem to have to do with the play service version somehow as can be seen from the exception: Expected 7095000 but found 4323000
04-19 17:20:20.841 20612-20612/com.mahlzeit E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.mahlzeit, PID: 20612
java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 7095000 but found 4323000. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
at com.google.android.gms.common.GooglePlayServicesUtil.zzJ(Unknown Source)
at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
at com.google.android.gms.maps.internal.zzx.zzad(Unknown Source)
I'm not sure what I have to do here since the version.xml file does contain the value 7095000:
version.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="google_play_services_version">7095000</integer>
</resources>
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="#drawable/ic_app"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_maps_key" />
<activity> <!-- ... -->
Maybe you do not need your own:
<integer name="google_play_services_version">7095000</integer>
and should use the one provided in library. Try removing this entry.
Try Clean the project and rebuild
Try to find that if there is any another 'version.xml' file available and in that file replace 4323000(which value you got in error) to 7095000(which value you got in error).
referring to thread Unfortunately, 'app_name' has stopped, I solved it, I get a new error:
FATAL EXCEPTION: main
Process: com.cursoandroid.miarrayadapter, PID: 1253
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cursoandroid.miarrayadapter/com.cursoandroid.miarrayadapter.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread
Mi main Activity is already app.compat
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cursoandroid.miarrayadapter" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat" >
<activity
android:theme="#style/Theme.AppCompat"
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
But I´m geeting to execute the application:
I dont understand it?
Since you are using the appcompat library the xmlns attribute in menu_main.xml should be:
<menu xmlns:yourapp="http://schemas.android.com/apk/res-auto" .... >
as given in the android documentation:
http://developer.android.com/guide/topics/ui/actionbar.html
Hi I am new to android and I have created 2 projects.
Now I want to call an activity in the second project from the first project upon a button click.
The 1st project only handles login screen and when I click on the login button I need to call an activity which is present in the second project.
I searched the net but didn't find any tutorials which I understood properly.
Hi I found the following error.
01-30 08:36:47.230: E/dalvikvm(3408): Could not find class 'com.androidhive.googleplacesandmaps.MainActivity', referenced from method org.fluturasymphony.recommendation.LoginActivity$DownloadWebPageTask.doInBackground
01-30 08:36:52.587: E/AndroidRuntime(3408): FATAL EXCEPTION: AsyncTask #1
01-30 08:36:52.587: E/AndroidRuntime(3408): java.lang.RuntimeException: An error occured while executing doInBackground()
01-30 08:36:52.587: E/AndroidRuntime(3408): at android.os.AsyncTask$3.done(AsyncTask.java:299)
01-30 08:36:52.587: E/AndroidRuntime(3408): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
01-30 08:36:52.587: E/AndroidRuntime(3408): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
01-30 08:36:52.587: E/AndroidRuntime(3408): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
01-30 08:36:52.587: E/AndroidRuntime(3408): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
01-30 08:36:52.587: E/AndroidRuntime(3408): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
01-30 08:36:52.587: E/AndroidRuntime(3408): at java.lang.Thread.run(Thread.java:856)
01-30 08:36:52.587: E/AndroidRuntime(3408): Caused by: java.lang.NoClassDefFoundError: com.androidhive.googleplacesandmaps.MainActivity
01-30 08:36:52.587: E/AndroidRuntime(3408): at org.fluturasymphony.recommendation.LoginActivity$DownloadWebPageTask.doInBackground(LoginActivity.java:69)
01-30 08:36:52.587: E/AndroidRuntime(3408): at org.fluturasymphony.recommendation.LoginActivity$DownloadWebPageTask.doInBackground(LoginActivity.java:1)
01-30 08:36:52.587: E/AndroidRuntime(3408): at android.os.AsyncTask$2.call(AsyncTask.java:287)
01-30 08:36:52.587: E/AndroidRuntime(3408): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
01-30 08:36:52.587: E/AndroidRuntime(3408): ... 3 more
I have declared the manifest as this.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fluturasymphony.recommendation"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="11" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application android:icon="#drawable/ic_launcher" android:label="#string/app_name">
<activity android:label="#string/app_name" android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="org.achartengine.GraphicalActivity" />
<activity android:name=".CategoryWiseSalesChartActivity" />
<activity android:name=".ProductWiseSalesChartActivity" />
<activity android:name="com.androidhive.googleplacesandmaps.MainActivity"/>
<activity android:label="#string/home_screen" android:name=".HomeActivity" android:configChanges="orientation">
</activity>
<activity android:label="#string/store_screen" android:name=".StoreActivity" android:configChanges="orientation">
</activity>
<activity android:label="#string/store_list_screen" android:name=".StoreListActivity" android:configChanges="orientation">
</activity>
<activity android:label="#string/location_screen" android:name=".StoreMapActivity" android:configChanges="orientation">
</activity>
<activity android:label="#string/recommended_products_list_screen" android:name=".RecommendedProductsListActivity" android:configChanges="orientation">
</activity>
<activity android:label="#string/category_wise_sales_screen" android:name=".CategoryWiseSalesActivity" android:configChanges="orientation">
</activity>
<activity android:label="#string/product_wise_sales_screen" android:name=".ProductWiseSalesActivity" android:configChanges="orientation">
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
</manifest>
And I am calling the activity in the 2nd class like this.
Intent loginintent = new Intent("com.androidhive.googleplacesandmaps.MainActivity");
startActivity(loginintent);
Is this right??
According to Android you can handle this by making the project Library and then Define it in the manifest file and call it in what ever manner you want
for an explanation i did this as per my requirement
the activity you want to call on Button click Define it in the Manifest with its full package name and then when you call it on button click the activity of the new project will trigger
the sample to do this is following
in the manifest file of your 1st project define some thing like this
<activity
android:name="packagefull.activityname"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
</activity>
in the package name define the full path of the the activity you want to call and after the package name give the name of the activity
hope this will work for you as this worked perfect for me
Use this:
Intent i = new Intent(Intent.ACTION_MAIN);
i.setComponent(new ComponentName("app package name", "app launch activity's classname"));
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
This is really not a good way for developing any application. But still if you want to achieve this , you will have to declare an Intent Filter for the target activity in that application's Manifest file and use it as implicit intent from your login activity.
Inside project A's Manifest:
<activity android:name="com.example.android.TargetActivity">
<intent-filter>
<action android:name="com.someone.wants.to.call.me"></action>
</intent-filter>
</activity>
Inside project B's Activity:
Intent intent = new Intent("com.someone.wants.to.call.me");
startActivity(intent);
in the map project's AndroidManifest file add your custom intent filter
<!-- add custom action -->
<activity android:name="MapActivity"
android:label="#string/mapLabel"
>
<intent-filter>
<action android:name="com.example.map.show" />
</intent-filter>
</activity>
from the login button call this activity like this:
Intent intent = new Intent("com.example.map.show");
startActivity(intent);
You should be using one project for each application. If you want to split up your login from the rest of your application you could use different packages. Unless I am misunderstanding what you mean by "project"?