android-activity

Android - Stop AsyncTask when back button is pressed and return to previous Activity

╄→гoц情女王★ 提交于 2020-01-12 05:31:08
问题 I've an AsyncTask and I want it to stip execution when back button is pressed. I also want the app to return to the previous displayed Activity. It seems I've managed in stop the Task but the app doesn't return to the previous activity. Any ideas? This is an extract from my code private class MyTask extends AsyncTask<Void, Void, Void> implements OnDismissListener{ private boolean exception= false; @Override protected void onPreExecute(){ pd = ProgressDialog.show( IscrizioniActivity.this,

What could cause an Android activity to relaunch itself infinitely when returning from camera?

馋奶兔 提交于 2020-01-12 04:57:05
问题 I have a weird bug in my application that causes an activity to relaunch itself in an infinite loop when I'm returning from a camera application, after taking a picture. The UI flow is like this: Main Activity -> Accept Photo activity -> in onCreate() open camera with startActivityForResult() Camera screen -> take picture (or cancel) -> return to Accept Photo The Accept Photo screen is created completely and immediately stopped and recreated in an infinite loop The weird part is that it only

Is it good to have a Base Activity class?

余生长醉 提交于 2020-01-12 03:56:47
问题 Is it good to have BaseActivity class and that will act as super class for all other activity. I need this to have some common implementations for the activities. BaseActivity: public class BaseActivity extends Activity { //All Common implementations goes here } Activities public class HomeActivity extends BaseActivity { } 回答1: In this case, I suggest having a base abstract activity, and two concrete inherited subclasses. You define all the common behaviour in the base activity, and have

How to get a PERMANENT application notifier in the status bar?

旧时模样 提交于 2020-01-12 03:37:26
问题 I searched on the Internet alot but cant find a proper answer to this. I have used apps like 3G watchdog and Advanced task killer on my android phone. I noticed that they always have an icon up when the status bar is minimized and also have a notification( Upon clicking opens the app) which cant be cleared from the status bar. I like to use something like this in my app. I know how to get an image and everything in the status bar, but how to keep one that cant be cleared till my app is

Android app with multiple activities

心不动则不痛 提交于 2020-01-12 03:27:11
问题 I have a very simple game that consists of only one activity, and I want to add a title screen. If the title screen is another activity, what changes do I need to make to my manifest file to make the title screen open first? The gameplay activity is called Leeder, and the title screen activity is called LeederTitleScreen here is my current manifest file. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.nifong.leeder"

Android app with multiple activities

北城以北 提交于 2020-01-12 03:27:09
问题 I have a very simple game that consists of only one activity, and I want to add a title screen. If the title screen is another activity, what changes do I need to make to my manifest file to make the title screen open first? The gameplay activity is called Leeder, and the title screen activity is called LeederTitleScreen here is my current manifest file. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.nifong.leeder"

How can I make my Android SwipeableCardViews more like the IOS 7 mail app (swipe to show buttons)

自作多情 提交于 2020-01-12 03:20:51
问题 How can I make my SwipeableCardViews more like the IOS 7 mail app (swipe to show buttons) So far I have created an android application which allows the user to swipe Cardviews either to the left or to the right. Each card has 2 buttons, which at a later date I will assign functions to. (As the image below shows): What I would like to accomplish is (but don't yet know how), is instead of swiping to the left or right to completely remove a card. Instead I would like either swipe gesture, to

In android What is efficent way for use of Activity

元气小坏坏 提交于 2020-01-11 14:03:30
问题 I just want to ask what is efficient way of use activity. Mean use one activity for multiple functionality or use multiple activity for every functionality. In my application working some thing like Category->subcategory->Product listing. In which orientation change design and also need to consume previous functionality state for Back. Thanks 回答1: Per the documentation for Activities, "An activity is a single, focused thing that the user can do". In other words, each different screen of your

The method startActivity(Intent) is undefined for the type?

≡放荡痞女 提交于 2020-01-11 07:54:14
问题 So im trying to start an activity by pressing a widget. I keep running into the error "The method startActivity(Intent) is undefined for the type Photos" any help is much appreciated! My class code is below: package com.natehoch96.widgets.iOS; import android.appwidget.AppWidgetProvider; import android.content.Intent; public class Photos extends AppWidgetProvider { Intent myIntent = new Intent(android.provider.Settings.ACTION_SETTINGS); {startActivity(myIntent); } } 回答1: You need to implement

moving from one activity to another in Android

泄露秘密 提交于 2020-01-11 07:28:06
问题 The following if my code. Please tell me what I am doing wrong? package version.nitt; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.LinearLayout; import version.nitt.R; import android.util.Log; import android.content.Intent; public class versionActivity extends Activity { private Runnable runnable; private static final String TAG="WElcome!"; /** Called when the