Search Results

Search found 3983 results on 160 pages for 'activity'.

Page 13/160 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Video playback on VideoView disappears after going back from another Activity

    - by pixel
    I have two Activities: one with VideoView and the second one. I start watching a video in the first Activity, then during playback I start second Activity. After going back to first Activity I can hear sound but see no picture. My Video Layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <VideoView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:id="@+id/videoView" android:layout_gravity="center" /> <ListView android:layout_width="fill_parent" android:layout_height="125dp" android:id="@+id/ListView" /> </LinearLayout> Do you have any ideas why video doesn't appear?

    Read the article

  • Can't get a LiveFolder to launch my activity like it should

    - by Felix
    I was able to create a ContentProvider for a LiveFolder, but I can't seem to be able to create my intents correctly, so it always gives "Application is not installed on your phone" errors when clicking on items inside the folder. My Activity is defined like so, in the manifest: <activity android:name=".MyActivity"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> Then, I create the intents I place in the LiveFolders.INTENT column like this: i = new Intent(); i.setAction(null); i.setClassName("my.package.here", ".MyActivity"); I don't get why this is not working. Maybe I'm making some stupid mistake, but please point me in the right direction.

    Read the article

  • workflow 4 activity designer IValueConverter

    - by pdiddy
    Lets say i have an activity with InArgument<int> ProductId I'd like to expose in the activity designer a combobox to show all Products and the user can select a product. I can show the list of product in the combo no problem. But how do I bind the selected product to the InArgument<int> of my custom activity? I suppose I need some kind of ValueConverter? Not sure how to code the value converter for this case, if anybody has an idea, suggestion, will be helpful. I have to convert the InArgument<int> to an int? and the convert back from int to InArgument<int> Thanks,

    Read the article

  • ADT will not allow creation of Android Activity

    - by NewShelbyWoo
    I installed the ADT bundle from http://developer.android.com/sdk/index.html yesterday, and I was following a basic Hello World tutorial. I created a new Android Application Project with a Blank Activity named MainActivity. The resulting project has an empty src folder and empty res\layout folder. There is a R.java file in the gen folder but it has no reference to MainActivity. This is what the SDK manager says I have installed Android SDK Tools v 22.6 Android SDK Platform-tools v 19.0.1 Android SDK Build-tools v 19 SDK Platform v 3 ARM EABI v7a System Image v 2 Android Support Library v 19.0.1 Google USB Driver v 9 I also tried manually creating an activity by right clicking the src folder and going to Android Activity, but when I hit Finish on the creation wizard, nothing happens. Does anyone have any clues as to what's going on? Did I miss a key component to install or something?

    Read the article

  • WF4RC, How to: Activity to Xaml?

    - by johnny g
    Hello all, I have Googled a bit, and cannot seem to find any examples of Xaml-fying Activities - good, bad, or otherwise! public static string ToXaml (this Activity activity) { // i would use ActivityXamlServices to go from Xaml // to activity, but how to go other way? documentation // is slim, and cannot infer proper usage of // ActivityXamlServices from Xml remarks :S string xaml = string.Empty; return xaml; } Hints, tips, pointers would be welcome :) NOTE: so found this. Will work through and update once working. Anyone wanna beat me to the punch, by all means. Better yet, if you can find a way to be rid of WorkflowDesigner, seems odd it is required.

    Read the article

  • Widget starting a service also starts main activity

    - by Nick
    Hi, I have a widget that is supposed to start and stop a service (start it when it's not running, stop it when it is). This is working fine, however, each time the service is started, my app's main activity is also launched, which I don't want. If I remove the MAIN-intent-filter ( <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />) from the app's manifest, it works as I want it to (without launching the main-activity, just the service), but then I obviously don't have a main activity anymore... This is how I start the service (I would assume this is the normal way, and I can't see any reference to what might cause the MAIN intent to fire): Intent svc = new Intent(this, OnOffService.class); startService(svc); Thanks, Nick

    Read the article

  • Activity monitor doesnt display process name

    - by Mohsin Khawas
    Hi, I have an application, when I see that application in "Activity Monitor" the applications Process Name is displayed nothing. Only the application icon is displayed. I tried debugging this by getting processInfo of the app, I got the application name correct. Even tried with the "top" command, I got the application name correct. The target name and settings also shows the same, only the activity monitor got wrong. Is it something I missed so that activity monitor is displaying nothing. M

    Read the article

  • Implementing activity indicator

    - by Prash.......
    I am implementing an activity indicator in my application. In my application on button click a webservice is called and it takes some time. To show the user that process is going on I implemented an activity indicator: CGRect frame = CGRectMake(140, 300, 40, 37); UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:frame]; activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; [self.view addSubview:activityIndicator]; This Snippet is written in viewDidLoad() method, and I have an action called, -(IBAction)agree:(id)sender { //here webservice is called } I have to start that activity by [activityIndicator startAnimating]; But I am unable to start that activityIndicator, please suggest a proper solution for that.

    Read the article

  • How to create a splash activity , call a second activity via a button, simple data form 5 fields and 2 buttons

    - by Mike
    New to Android need help with one solid build that I can refer to and study for future projects. The first activity is a background image with a button,when clicked the it takes you to the second activity which is a form with 5 data fields and 2 buttons. One button calls an intent to take a picture within the app and one button that submits the data from the form along with the picture to URL. lastly a third activity that says complete thank you. I can make some of this but don't know how to link button or open and merge camera with the app to be sent as a package of data. I suppose I could also hook into GPS acquire location as well as the camera call?

    Read the article

  • User activity vs. System activity on the Index Usage Statistics report

    - by Zachary G Jensen
    I recently decided to crawl over the indexes on one of our most heavily used databases to see which were suboptimal. I generated the built-in Index Usage Statistics report from SSMS, and it's showing me a great deal of information that I'm unsure how to understand. I found an article at Carpe Datum about the report, but it doesn't tell me much more than I could assume from the column titles. In particular, the report differentiates between User activity and system activity, and I'm unsure what qualifies as each type of activity. I assume that any query that uses a given index increases the '# of user X' columns. But what increases the system columns? building statistics? Is there anything that depends on the user or role(s) of a user that's running the query?

    Read the article

  • Android Round Button and Spinner inside Activity Group

    - by vaishali
    I have a Spinner and 2 buttons in an Activity Group. I want to apply rounded corner to the buttons. I have created shape xml resource file for round button in Android. I have assigned this resource file as background to the button while creating the button in Layout. But the change is not reflected after executing the application. I have set the ContentView for that screen as : setContentView(LayoutInflater.from(getParent()).inflate(R.layout.textmessage,null)); This has to be done to make spinner work in an Activity Group. How can I make the Button as round corner in an Activity Group having Spinner? Any help would be appreciated. Thanks in Advance.

    Read the article

  • Expose NativeActivity Variables to Workflow Designer

    - by sixlettervariables
    I've got a NativeActivity which contains an Activity body. The purpose of this activity is to expose a resource for the duration of the child activity as a Variable. The problem I've encountered is it appears the Variable cannot be used outside the activity. I'll use StreamReader as an example resource. ResourceActivity.cs: [Designer(typeof(ResourceActivityDesigner))] public sealed class ResourceActivity : NativeActivity { [RequiredArgument] public InArgument<string> Path { get; set; } [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] public Activity Body { get; set; } [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] public Variable<StreamReader> Resource { get; set; } public ResourceActivity() { this.Resource = new Variable<StreamReader> { Default = null, Name = "reader" }; } protected override void CacheMetadata(NativeActivityMetadata metadata) { if (this.Path != null) metadata.AddArgument(this.Path); if (this.Body != null) metadata.AddChild(this.Body); if (this.Resource != null) metadata.AddVariable(this.Resource); } protected override void Execute(NativeActivityContext context) { this.Resource.Set(context, new StreamReader(this.Path.Get(context))); context.ScheduleActivity(this.Body, new completionCallback(Done), new FaultCallback(Faulted)); } private void Done(NativeActivityContext context, ActivityInstance instance) { var reader = this.Reader.Get(context); if (reader != null) reader.Dispose(); } private void Faulted(NativeActivityFaultContext context, Exception ex, ActivityInstance instance) { var reader = this.Reader.Get(context); if (reader != null) reader.Dispose(); } } I cannot view "Resource" or "reader" in the Variables list in the Workflow Designer. Am I missing something in CacheMetadata?

    Read the article

  • AlerDialog is not created - java.lang.IllegalArgumentException: Activity#onCreateDialog did not crea

    - by Jayomat
    Hi, I want to create a normal AlertDialog. I used the example provided by the android dev docs. I just changed the DIALOG_PAUSED_ID to DIALOG_DELETEDB. If I execute my code and press the button which in return should create the dialog, I get the following error log: 04-29 01:01:20.973: WARN/dalvikvm(1168): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 04-29 01:01:20.973: ERROR/AndroidRuntime(1168): Uncaught handler: thread main exiting due to uncaught exception 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): java.lang.IllegalArgumentException: Activity#onCreateDialog did not create a dialog for id 4 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.app.Activity.createDialog(Activity.java:871) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.app.Activity.showDialog(Activity.java:2483) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at mjb.project.AVV.Favs.onMenuItemSelected(Favs.java:111) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:139) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:525) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.view.View.onTouchEvent(View.java:4179) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.widget.TextView.onTouchEvent(TextView.java:6540) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.view.View.dispatchTouchEvent(View.java:3709) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.os.Handler.dispatchMessage(Handler.java:99) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.os.Looper.loop(Looper.java:123) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.app.ActivityThread.main(ActivityThread.java:4363) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at java.lang.reflect.Method.invokeNative(Native Method) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at java.lang.reflect.Method.invoke(Method.java:521) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at dalvik.system.NativeStart.main(Native Method) so here are the "relevant" code parts: define the ID: private static final int DELETE_DB_ID = 3; private Dialog dialog; static final int DIALOG_DELETEDB = 4; onCreateDialog(...): protected Dialog onCreateDialog(int id) { switch(id) { case DIALOG_DELETEDB: // do the work to define the pause Dialog AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Are you sure you want to exit?") .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Favs.this.finish(); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); break; default: dialog = null; } return dialog; } Here I try to "create" the dialog: @Override public boolean onMenuItemSelected(int featureId, MenuItem item) { switch(item.getItemId()) { case ADD_ID: createNote(); return true; case DELETE_DB_ID: showDialog(DIALOG_DELETEDB); return true; } return super.onMenuItemSelected(featureId, item); } As I already said, I just copied the code and changed the name. Unfortunately, I don't understand the error log message.. :/ Somehow I think I don't return the created dialog, but I cannot see "where" my reference is or where/what I have to return... thanks in advance for help.

    Read the article

  • Layout does not show up after Activity launch

    - by Peter
    I have an activity which invokes an onItemClick and launches another activity. This activity has a static layout(for testing purposes), but only thing I see is black(I even set the text color to white to check it out). My listener list.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) { //create new intent Intent item = new Intent(getApplicationContext(), Item.class); // Close all views before launching logged //item.putExtra("name", ((TextView)arg1).getText()); //item.putExtra("uid", user_id); item.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(item); // Close Login Screen onPause(); } }); My activity is here(not much to do it just launches the layout) public class Item extends Activity{ protected SQLiteDatabase myDB=null; protected String name; protected int uid; TextView yeart,year,itemname,comment,commentt,value,valuet,curr,currt; protected void onStart(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.herp); /*name=getIntent().getStringExtra("name"); uid=Integer.parseInt(getIntent().getStringExtra("uid")); itemname=(TextView) findViewById(R.id.itemName);//itemname.setText(name); year=(TextView) findViewById(R.id.itemYear); yeart=(TextView) findViewById(R.id.year); comment=(TextView) findViewById(R.id.itemComments); commentt=(TextView) findViewById(R.id.comments); curr=(TextView) findViewById(R.id.itemcurrent); currt=(TextView) findViewById(R.id.current); value=(TextView) findViewById(R.id.itemValue); valuet=(TextView) findViewById(R.id.value);*/ Database openHelper = new Database(this); myDB = openHelper.getReadableDatabase(); myDB=SQLiteDatabase.openDatabase("data/data/com.example.login2/databases/aeglea", null, SQLiteDatabase.OPEN_READONLY); }} And finally my XML layout <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/itemName" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="asdasd" android:gravity="center" android:layout_marginBottom="10px" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#fff" /> <TextView android:id="@+id/current" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Current" android:textSize="20dp" android:textStyle="bold" /> <TextView android:id="@+id/itemcurrent" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="asdasd" /> <TextView android:id="@+id/year" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Year" android:textSize="20dp" android:textStyle="bold" /> <TextView android:id="@+id/itemYear" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="asdasd" /> <TextView android:id="@+id/value" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Value" android:textSize="20dp" android:textStyle="bold" /> <TextView android:id="@+id/itemValue" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="TextView" /> <TextView android:id="@+id/comments" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Comments" android:textSize="20dp" android:textStyle="bold" /> <TextView android:id="@+id/itemComments" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="TextView" /> </LinearLayout>

    Read the article

  • Android: new Intent() starts new instance with android:launchMode="singleTop"

    - by Stefan Klumpp
    I have Activity A with android:launchMode="singleTop" in the manifest. If I go to Activity B, C and D there I have menu shortcuts to return to my applications root activity (A). The code looks like this: Intent myIntent = new Intent(getBaseContext(), MainActivity.class); startActivity(myIntent); However, instead of returning to the already existing instance A of my MainActivity.class it creates a new instance - it goes to onCreate() instead of onNewIntent(). This is not the expected behavior, right?

    Read the article

  • Android Multiple Handlers Design Question

    - by Soumya Simanta
    This question is related to an existing question I asked. I though I'll ask a new question instead of replying back to the other question. Cannot "comment" on my previous question because of a word limit. Marc wrote - I've more than one Handlers in an Activity." Why? If you do not want a complicated handleMessage() method, then use post() (on Handler or View) to break the logic up into individual Runnables. Multiple Handlers makes me nervous. I'm new to Android. Is having multiple handlers in a single activity a bad design ? I'm new to Android. My question is - is having multiple handlers in a single activity a bad design ? Here is the sketch of my current implementation. I've a mapActivity that creates a data thread (a UDP socket that listens for data). My first handler is responsible for sending data from the data thread to the activity. On the map I've a bunch of "dynamic" markers that are refreshed frequently. Some of these markers are video markers i.e., if the user clicks a video marker, I add a ViewView that extends a android.opengl.GLSurfaceView to my map activity and display video on this new vide. I use my second handler to send information about the marker that the user tapped on ItemizedOverlay onTap(int index) method. The user can close the video view by tapping on the video view. I use my third handler for this. I would appreciate if people can tell me what's wrong with this approach and suggest better ways to implement this. Thanks.

    Read the article

  • passing int into android activities

    - by Dawood Abbasi
    i pass int to next activity using this code Intent intent = new Intent(A.this, B.class); intent.putExtra("selectedType", i); startActivity(intent); and then receive this in activity B Intent intent = new Intent(); int i = intent.getIntExtra("selectedType", 0); Toast.makeText(getApplicationContext(), String.valueOf(i), Toast.LENGTH_LONG).show(); but when in this activity, it always display 0.

    Read the article

  • AsyncTask and onDestroy...

    - by stormin986
    I have an activity initiate a few AsyncTask downloads. After two of the three finish, it issues an Intent to load the next activity while still finishing up the last download. Obviously in onDestroy() i will call cancel() on all AsyncTask objects. If the OS tries to destroy my activity after the next activity starts, it will call and begin executing onDestroy in the apps UI thread, right? It won't wait for that AsyncTask to complete, correct? In all cases it will ultimately call onDestroy(), in turn canceling all AsyncTasks?

    Read the article

  • null pointer exception when starting new activity

    - by acithium
    Okay, I'm getting a null pointer exception when I start my third activity. Here is the LogCat message: 12-28 04:38:00.350: ERROR/AndroidRuntime(776): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.acithium.main/com.acithium.rss.ShowDescription}: java.lang.NullPointerException 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread.access$2100(ActivityThread.java:116) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.os.Handler.dispatchMessage(Handler.java:99) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.os.Looper.loop(Looper.java:123) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread.main(ActivityThread.java:4203) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at java.lang.reflect.Method.invokeNative(Native Method) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at java.lang.reflect.Method.invoke(Method.java:521) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at dalvik.system.NativeStart.main(Native Method) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): Caused by: java.lang.NullPointerException 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at com.acithium.rss.ShowDescription.onCreate(ShowDescription.java:48) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): ... 11 more Here is the section of code where I call the activity: public void onItemClick(AdapterView parent, View v, int position, long id) { Log.i(tag,"item clicked! [" + feed.getItem(position).getTitle() + "]"); Intent itemintent = new Intent(this,com.acithium.rss.ShowDescription.class); //Intent itemintent = new Intent(); //itemintent.setClassName("com.acithium.main", "com.acithium.rss.ShowDescription"); Bundle b = new Bundle(); b.putString("title", feed.getItem(position).getTitle()); b.putString("description", feed.getItem(position).getDescription()); b.putString("link", feed.getItem(position).getLink()); itemintent.putExtra("android.intent.extra.INTENT", b); startActivityForResult(itemintent,0); } And here is new activity class that is called: public class ShowDescription extends Activity { public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.showdescription); String theStory = null; Intent startingIntent = getIntent(); if (startingIntent != null) { Bundle b = startingIntent.getBundleExtra("android.intent.extra.INTENT"); if (b == null) { theStory = "bad bundle?"; } else { theStory = b.getString("title") + "\n\n" + b.getString("description") + "\n\nMore information:\n" + b.getString("link"); } } else { theStory = "Information Not Found."; } TextView db= (TextView) findViewById(R.id.storybox); db.setText(theStory); Button backbutton = (Button) findViewById(R.id.back); backbutton.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { finish(); } }); } }

    Read the article

  • SurfaceView drawn on top of other elements after coming back from specific activity

    - by spirytus
    I have an activity with video preview displayed via SurfaceView and other views positioned over it. The problem is when user navigates to Settings activity (code below) and comes back then the surfaceview is drawn on top of everything else. This does not happen when user goes to another activity I have, neither when user navigates outside of app eg. to task manager. Now, you see in code below that I have setContentVIew() call wrapped in conditionals so it is not called every time when onStart() is executed. If its not wrapped in if statements then all works fine, but its causing loosing lots of memory (5MB+) each time onStart() is called. I tried various combinations and nothing seems to work so any help would be much appreciated. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Toast.makeText(this,"Create ", 2000).show(); // set 32 bit window (draw correctly transparent images) getWindow().getAttributes().format = android.graphics.PixelFormat.RGBA_8888; // set the layout of the screen based on preferences of the user sharedPref = PreferenceManager.getDefaultSharedPreferences(this); } public void onStart() { super.onStart(); String syncConnPref = null; syncConnPref = sharedPref.getString("screensLayouts", "default"); if(syncConnPref.contentEquals("default") && currentlLayout!="default") { setContentView(R.layout.fight_recorder_default); } else if(syncConnPref.contentEquals("simple") && currentlLayout!="simple") { setContentView(R.layout.fight_recorder_simple); } // I I uncomment line below so it will be called every time without conditionals above, it works fine but every time onStart() is called I'm losing 5+ MB memory (memory leak?). The preview however shows under the other elements exactly as I need memory leak makes it unusable after few times though // setContentView(R.layout.fight_recorder_default); if(getCamera()==null) { Toast.makeText(this,"Sorry, camera is not available and fight recording will not be permanently stored",2000).show(); // TODO also in here put some code replacing the background with something nice return; } // now we have camera ready and we need surface to display picture from camera on so // we instantiate CameraPreviw object which is simply surfaceView containing holder object. // holder object is the surface where the image will be drawn onto // this is where camera live cameraPreview will be displayed cameraPreviewLayout = (FrameLayout) findViewById(id.camera_preview); cameraPreview = new CameraPreview(this); // now we add surface view to layout cameraPreviewLayout.removeAllViews(); cameraPreviewLayout.addView(cameraPreview); // get layouts prepared for different elements (views) // this is whole recording screen, as big as screen available recordingScreenLayout=(FrameLayout) findViewById(R.id.recording_screen); // this is used to display sores as they are added, it displays like a path // each score added is a new text view simply and as user undos these are removed one by one allScoresLayout=(LinearLayout) findViewById(R.id.all_scores); // layout prepared for controls like record/stop buttons etc startStopLayout=(RelativeLayout) findViewById(R.id.start_stop_layout); // set up timer so it can be turned on when needed //fightTimer=new FightTimer(this); fightTimer = (FightTimer) findViewById(id.fight_timer); // get views for displaying scores score1=(TextView) findViewById(id.score1); score2=(TextView) findViewById(id.score2); advantages1=(TextView) findViewById(id.advantages1); advantages2=(TextView) findViewById(id.advantages2); penalties1=(TextView) findViewById(id.penalties1); penalties2=(TextView) findViewById(id.penalties2); RelativeLayout welcomeScreen=(RelativeLayout) findViewById(id.welcome_screen); Animation fadeIn = AnimationUtils.loadAnimation(this, R.anim.fade_in); welcomeScreen.startAnimation(fadeIn); Toast.makeText(this,"Start ", 2000).show(); animateViews(); } Settings activity is below, after coming back from this activity surfaceview is drawn on top of other elements. public class SettingsActivity extends PreferenceActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(MyFirstAppActivity.getCamera()==null) { Toast.makeText(this,"Sorry, camera is not available",2000).show(); return; } addPreferencesFromResource(R.xml.preferences); } }

    Read the article

  • Typical Search, Result and Detail Workflow Staying Within an Android Tab

    - by Justin
    So, I've been banging my head looking for a good solution for a few days and am stuck. I have a search screen (Activity) in a tab, and after the user enters a value and clicks "search" I would like the results to come back in that same tab, and then if an item from the results is selected, to show more detailed results, in that same tab. I have it all working now in separate activities, and even the first step working in a tab, but as soon as I call the activity to process he search results... i.e. startActivity(i); for the results Activity, the results displayed are not in the tab! I am having a very difficult time getting this flow to work all under a tab. Any thoughts on how to make this happen? I keep hearing that Android views should be used instead of activities, but am I then to assume that all the logic I have right now for 3 activity needs to go inside 1 activity and then I need to handle setting the content and state for each of these cases? Plus, won't the history stack not work as pressing the back button will take the user out of the application, instead of taking them from say the search result to the search screen, or the details to the search results, etc. This seems like a mess. Can anyone show a more complex example of tabs or how one might have a simple search, result and detail workflow staying in a tab? I have seen a few questions on this concept of keeping activities "within a tab", but no good resolution. Please help.

    Read the article

  • How to force main Acivity to wait for subactivity in Android?

    - by rmaster
    hi, I am calling a subactivity from main activity. This subactivity should take few numbers from user (i'm using Edit text control to achieve this), save them to static variable in another class and terminate. I want main activity to wait for subactivity but both are just running simultaneously. Even doing sth like that doesn't help: Thread t = new Thread(new Runnable(){ public void run(){ Log.v("==================", "run "+new Date()); startActivityForResult(new Intent(ctx,myCustomSubactivity.class),1); } }); Log.v("==================", "calling run "+new Date()); t.start(); try { t.join(); } catch (InterruptedException e) {Log.v("==================", "can't join");} Log.v("==================", "back from activity "+new Date()); do you know how to force main activity to wait? Thread.wait() method is not supported in Android(program throws error).

    Read the article

  • What happens to thread as onDestroy is called when device is rotated

    - by Lakshmie
    I would like to know as to what will happen to the thread which has been created by an activity and the device is rotated. I have observed that the onDestroy method is called when this happens. Will the thread be killed too? If the thread is not killed, how can I reassociate the thread with the activity as a new instance of the activity is created on rotation. Thanks, Lakshmie

    Read the article

  • Android - Take a photo, save it in app drawables and display it in an ImageButton

    - by Andres7X
    I have an Android app with an ImageButton. When user clicks on it, intent launches to show camera activity. When user capture the image, I'd like to save it in drawable folder of the app and display it in the same ImageButton clicked by the user, replacing the previous drawable image. I used the activity posted here: Capture Image from Camera and Display in Activity ...but when I capture an image, activity doesn't return to activity which contains ImageButton. Edit code is: public void manage_shop() { static final int CAMERA_REQUEST = 1888; [...] ImageView photo = (ImageView)findViewById(R.id.getimg); photo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent camera = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(camera, CAMERA_REQUEST); } }); [...] } And onActivityResult(): protected void onActivityResult(int requestCode, int resultCode, Intent data) { ImageButton getimage = (ImageButton)findViewById(R.id.getimg); if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) { Bitmap getphoto = (Bitmap) data.getExtras().get("data"); getimage.setImageBitmap(getphoto); } } How can I also store the captured image in drawable folder?

    Read the article

  • onActivityResult method not being called Android

    - by Chintan
    I am trying to send data from child activity to parent. But somehow, onActivityResult(..) is not getting called. here is code Parent activity selectedText.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { Intent intent = new Intent(Parents.this,Child.class); startActivityForResult(intent, 1); } return true; } }); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case 1: if (resultCode == RESULT_OK) { if (data.hasExtra("selText")) { selectedText.setText(data.getExtras().getString( "selText")); } break; } } Child Activity: I can see selected value set in the setResult(). But after finish of child activity, it's not going back to parent activity. textListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int myItemInt, long arg3) { selectedFromList =(String) (textListView.getItemAtPosition(myItemInt)); Intent data = new Intent(); data.putExtra("selText", selectedFromList); setResult(RESULT_OK,data); finish(); } });

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >