android-activity

startActivity() from BroadcastReceiver

China☆狼群 提交于 2020-01-26 09:45:08
问题 I am trying to autostart my nightclock application on charging using the following BroadcastReceiver implemented in the onPause() method: BroadcastReceiver test = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { unregisterReceiver(this); Intent i = new Intent(context, NightClock.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } }; registerReceiver(test, new IntentFilter(Intent.ACTION_POWER_CONNECTED)); The onReceive()

How pass data between two android views?

一世执手 提交于 2020-01-26 04:49:08
问题 I have a simple application that needs to do the following: From the main view the user clicks a button that launches another view. The new view is displayed and collects information from the user. Once the user clicks OK on that new view I need to "send" that data back to the originating view. The problem I am finding is that once I use StartActivity (with an intent) or SetContentView (Resource.Layout.Main) is that my data is gone. I'm putting the information I collected in a global variable

Android Bottom Navigation - Maintaining Activity State

无人久伴 提交于 2020-01-26 03:14:28
问题 I know it's recommended to use Fragments instead of Activities when working with Bottom Navigation . Due to the current design, I want to avoid having to convert all the Activities The Design: I am using a Bottom Navigation bar like shown Each tab is an Activity . When you tap on any of the tabs, it launches the activity, startActivity(new Intent(getApplication(), TabActivityName.class)); . The problem is that when you switch between these tabs, the state of the Activity is lost. For example:

Android device can't instantiate launcher activity

痞子三分冷 提交于 2020-01-25 15:34:33
问题 When I try run my current android project on my phone, after successfully build and deploy it, I am getting this error: E/AndroidRuntime(15869): FATAL EXCEPTION: main E/AndroidRuntime(15869): Process: org.hello, PID: 15869 E/AndroidRuntime(15869): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.hello/org.hello.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "org.hello.MainActivity" on path: DexPathList[[zip file "/data/app/org.hello-1.apk"]

Is it possible to move a GoogleMap object from one activity to another?

风格不统一 提交于 2020-01-25 15:26:31
问题 So in my main activity I have instantiated a GoogleMap object. On button click, in my next Acivity, I also have a GoogleMap object. I want to know if it's possible to use the same object and not have to create a new GoogleMap object and do the appropriate set-up again. Basically I don't want to do the same thing twice in two different activities and take the performance hit. I know it's possible to move data via intents, extras, bundles etc. but I can't find information regarding GoogleMaps

how to show Progress Dialog in Non-Activity class inside list view

人盡茶涼 提交于 2020-01-25 11:52:07
问题 I have adapter class for Listview that is inside a class which is name AdapterItems that extended in ArrayAdapter. know how can I use progress dialog in this class that isn't extended in Activity? this is my fill method for listview public void fill(final ArrayAdapter<RssParser.Item> adapter, final RssParser.Item item, final int position) { Thread thread = new Thread(new Runnable() { @Override public void run() { ActivityStartup.handler.post(new Runnable() { @Override public void run() {

how to show Progress Dialog in Non-Activity class inside list view

给你一囗甜甜゛ 提交于 2020-01-25 11:51:46
问题 I have adapter class for Listview that is inside a class which is name AdapterItems that extended in ArrayAdapter. know how can I use progress dialog in this class that isn't extended in Activity? this is my fill method for listview public void fill(final ArrayAdapter<RssParser.Item> adapter, final RssParser.Item item, final int position) { Thread thread = new Thread(new Runnable() { @Override public void run() { ActivityStartup.handler.post(new Runnable() { @Override public void run() {

How to monitor all running apps activities lifecycles and crashes?

喜夏-厌秋 提交于 2020-01-25 11:32:51
问题 I'm trying to create a monitor service which would know when apps start/resume/restart/pause/... and also when apps crashes. I have tried to read logcat, but it seems that calls to [onCreate()/onStart()/onRestart()/...] are not logged into logcat. Is there a way to catch all these method calls for all running apps ? Is there a way to know when an app crash ? Note: The service don't need to be notified as soon as these events happens, few seconds/minutes after is also okay. 回答1: Refer to my

How to start an Activity in a dynamic feature module?

那年仲夏 提交于 2020-01-25 08:58:26
问题 When typing to start an Activity within a dynamic feature module trough an Android Studio run-configuration, I get the following warning: The activity 'SomeActivity' is not declared in AndroidManifest.xml . (because it is being declared in the AndroidManifest.xml of the dynamic feature module). For reference, this is the library being used: // https://developer.android.com/guide/app-bundle/playcore api "com.google.android.play:core:1.6.4" The run configuration shows & deploys both modules,

Android Can Applicaton Detect How it is being Launched?

穿精又带淫゛_ 提交于 2020-01-25 07:23:07
问题 Is there a way for Android application to detect how it is being launched? whether by a BOOT or by user launching the application from the application list? When my application is launched on boot I don't want any activity to show at all. When the user specifically launches it from the application list, then and only then would I want the main activity to show. If I could detect whether the launch was a user launch or system boot launch I might be able to control this. 回答1: What you're