android-activity

How can we call one fragment from another class that doesn't contain that fragment?

删除回忆录丶 提交于 2019-12-26 04:57:26
问题 I am having one activity class : IdeaBoxActivity Here is the layout code of the activity- <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.asif047"> <android.support.v4.widget.DrawerLayout android:layout

How can we call one fragment from another class that doesn't contain that fragment?

拟墨画扇 提交于 2019-12-26 04:57:17
问题 I am having one activity class : IdeaBoxActivity Here is the layout code of the activity- <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.asif047"> <android.support.v4.widget.DrawerLayout android:layout

How to save data from come another Activity [closed]

淺唱寂寞╮ 提交于 2019-12-25 19:45:12
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . I want to save data with sharedpreference.This data come from another Activity. 回答1: Write to Shared Preferences To write to a shared preferences file, create a SharedPreferences.Editor by calling edit() on your SharedPreferences. Pass the keys and values you want to write with methods such as

I am trying this code to share pdf fromAsset of app But it's showing error

泪湿孤枕 提交于 2019-12-25 18:57:13
问题 I am trying this code to share pdf fromAsset of app But it's showing error InputStream outputFile = getAssets().open("new-age-careers-careers-that-didnt-exist-20-yr-ago.pdf") ; Uri uri = Uri.fromFile( (File) InputStream ); **Here is my code ** Intent share = new Intent(); share.setAction(Intent.ACTION_SEND); share.setType("application/pdf"); share.putExtra(Intent.EXTRA_STREAM, uri); share.setPackage("com.whatsapp"); activity.startActivity(share); 回答1: public class MainActivity extends

How can we set onClickListener for each list item(each row) of recycler view, different activity for different object of list

余生长醉 提交于 2019-12-25 18:47:30
问题 I need to set OnClickListener for each list item of recycler view . I want to navigate to a different activity by clicking each list view item. So far I've managed to pass the click position via a callback to the same activity for each click item from then list. However, I want to start a different activity when clicking an item from the list. Let's assume I want to click the row that has text "dd" then it should go to activity named "abc" please help me. please. This is main activity: public

How to install an APK from Service

☆樱花仙子☆ 提交于 2019-12-25 18:47:13
问题 I have a BroadcastReceiver , I download an apk from the server, when I catch action DownloadManager.ACTION_DOWNLOAD_COMPLETE I install the apk using activity.startActivityForResult(my_intent, REQUEST_CODE) Now I want to move this logic in a Service and also install the apk, but inside the service I don't have a Activity, I can to cast context to Activity obtained from getapplicationcontext(), but I catch the error that context can't be casted to com.android.Activity How I can to run

How can we set onClickListener for each list item(each row) of recycler view, different activity for different object of list

二次信任 提交于 2019-12-25 18:47:00
问题 I need to set OnClickListener for each list item of recycler view . I want to navigate to a different activity by clicking each list view item. So far I've managed to pass the click position via a callback to the same activity for each click item from then list. However, I want to start a different activity when clicking an item from the list. Let's assume I want to click the row that has text "dd" then it should go to activity named "abc" please help me. please. This is main activity: public

How to install an APK from Service

吃可爱长大的小学妹 提交于 2019-12-25 18:47:00
问题 I have a BroadcastReceiver , I download an apk from the server, when I catch action DownloadManager.ACTION_DOWNLOAD_COMPLETE I install the apk using activity.startActivityForResult(my_intent, REQUEST_CODE) Now I want to move this logic in a Service and also install the apk, but inside the service I don't have a Activity, I can to cast context to Activity obtained from getapplicationcontext(), but I catch the error that context can't be casted to com.android.Activity How I can to run

why autosuggest not display and how to add filter functionalty

帅比萌擦擦* 提交于 2019-12-25 18:45:12
问题 I make a simple demo of auto complete. I take array of string in which there is 2250 entries with Name and code like that example "Alexandra Palace-(AAP)", first name is given and the it code inside the bracket.my issue is I need to filter this using code not by name .In other word if i type anything in input field it filter with starting characters of element mean name I need to filter with code which is inside the bracket. Code: when I type "lwy" it will not show "MNCRLWY-(LWY)", can you

androidx.gridlayout.widget.GridLayout cannot be cast to android.widget.GridLayout

痞子三分冷 提交于 2019-12-25 18:35:35
问题 I am getting error "Caused by: java.lang.ClassCastException: androidx.gridlayout.widget.GridLayout cannot be cast to android.widget.GridLayout", in mainActivity.java GridLayout mygridLayout = findViewById(R.id.gridLayout); for(int i=0; i<mygridLayout.getChildCount(); i++) { ((ImageView) mygridLayout.getChildAt(i)).setImageResource(0); } 回答1: You are using GridLayout from AndroidX package in your layout.xml and you are importing Gridlayout from package android.widget in your source code. Use