Android :: Passing Parameters To New Activity
Mar 2, 2009
I'm programming an Activity that launches a second one through startActivity just like in the Forwarding example. The main difference is that I'd like to pass some data to the second Activity when starting it, for example an item selected in a list owned by the first Activity. I can't find how to do that. Am I missing something? I guess I do.
View 3 Replies
Jun 23, 2010
I am trying to display a dialog box in a simple Java class that is called from my main Activity but not successful. Please help me to figure it out.
I am passing the required values as parametrs.
I have two class: class MainActivity extends Activity :: Main *starting point *of Application class ShowMyDialog :: a simple java program In which I *generate an URl* and *display a dialog with WebView*.
I am passing the Acitivity from my MainActivity to this class as a parameter in function.
But I am *unable to call* the onCreateDialog method that I have *defined in the simple java class.
However, If I define the *onCreateDialog method in MainActivity, I am able to display it successfully.
What Should I pass as Parameter to the non Activity class from MainActivity class so that I am able to display the dialog as defined by showdialog method in JAVA class ???*
My steps of source code is as follow:
code:.........................
View 3 Replies
View Related
Dec 15, 2009
Im using ksoap2 to call web .net services. The call works just fine except when I pass paramaters. The passed paramaters are always recieved as null values by the web service. I dont know what the problem is, I hope someone can help.
View 7 Replies
View Related
Feb 28, 2012
I am working on a project that require porting a program from Linux to Android; I have been successful to make work the required equinox3.6(modified) on Android and to make call the osgi by the application itself, BUT through the adb shell, running a script that launches the files in the .jar. At this point I should create an activity.apk that includes everything and makes it work the same way.
More in details, until now I have uploaded some archives.jar (containing the classes.dex) in the emulator: two jars for the program itself, a jar for equinox, other jars for support.Then there is the script.sh that launches the main.class of my program passing it some parameters necessary to the program and to equinox to start; the main.class launches the equinox framework and then the program can load bundles and do its job.To make it clear here is the starting script:
#/bin/sh
/system/bin/dalvikvm -Xbootclasspath:/system/framework/core.jar -Xverify:none -Dosgi.debug=file:.options -Dosgi.framework=file: org.eclipse.osgi_3.6.0.v20100517.jar -Dosgi.install.area=file:/bundles/ -Dosgi.java.profile=file: dalvik_Core_Library-0.9.profile -Dosgi.parentClassloader=ext -Dnetserv.container.ctrlport=7001 -Dnetserv.container.serveripv4=127.0.0.1 -Djava.security.policy=all.policy -Dnetserv.security.bindableports=1024 -Dnetserv.container.user=jae -classpath org.eclipse.osgi_3.6.0.v20100517.jar:netservlaunch .jar NetServ.launch.Main -console -clean
I have been trying to create an activity that behaves similar to my script, but without any success.I added all my archives.jar to my project the way of "Add External jars" and tryed to launch the main.class as it was another activity, using Intent, and passed the parameters using putExtra(), but on the other side, in the jar of the program, I cannot retrieve and use the needed parameters, because it is not an apk..
View 1 Replies
View Related
Dec 9, 2009
I'm having a problem in calling .net c# web services from android using ksoap2. The call is executed just fine without parameters, but when I pass parameters of any type, the web service just receives a null value. I tried everything possible but no luck so far. I hope someone can help, The client side code is:
public static boolean temp(){try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME_TEMP);
PopertyInfo p = new PropertyInfo();
p.type = PropertyInfo.INTEGER_CLASS;
p.setName("num");
p.setValue(5);
p.setNamespace(NAMESPACE);
request.addProperty(p);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope (SoapEnvelope.VER11 );
envelope.dotNet = true;
envelope.encodingStyle = SoapSerializationEnvelope.ENC;
envelope.setOutputSoapObject(request);
AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport (URL);
androidHttpTransport.setXmlVersionTag("<?xml version= "1.0" encoding="UTF-8"?>")
androidHttpTransport.call(SOAP_ACTION_TEMP, envelope); ....
View 3 Replies
View Related
Jul 21, 2010
I am new to android applications, I am using Ksoap2 to access .Net webservice and The call is executed just fine without parameters. But with parameters I am getting Empty. I followed all the steps provided in sites. I tried everything possible but no luck so far.
private static final String SOAP_ACTION = "http://www.agilelearning.com/GetProvincelist1";
private static final String METHOD_NAME = "GetProvincelist1 ";
private static final String NAMESPACE = "http://www.agilelearning.com" ;
private static final String URL = "http://192.168.1.24/Service.asmx";
//Method executed when Province is selected
private OnItemSelectedListener selectListener = new OnItemSelectedListener(){
public void onItemSelected(AdapterView parent, View v, int position, long id){
try{
ArrayList districts=new ArrayList();
int Provinceid=position+1;//parent.getItemAtPosition(position).toString();
SoapObject request1 = new SoapObject(NAMESPACE, METHOD_NAME1);
request1.addProperty("Provincename","East Province");
SoapSerializationEnvelope envelope1 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope1.dotNet = true;
envelope1.setOutputSoapObject(request1);
HttpTransportSE at = new HttpTransportSE(URL);
at.debug = true;
at.setXmlVersionTag("");
at.call(SOAP_ACTION1, envelope1);
SoapObject rs = (SoapObject)envelope1.getResponse();
int count=rs.getPropertyCount();
for(int i=0;i aa;
aa = new ArrayAdapter(home1.this, android.R.layout.simple_spinner_item, districts); aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sd.setAdapter(aa);
}catch(Exception ex){
MessageBox("No Districts found");}}
View 2 Replies
View Related
May 16, 2010
I'm writing an application that starts with a loading activity. In the loading activity the app requests html from web and parses the html, then it sends the parsing result to the main activity. The main activity has several tabs, and contents of these tabs are based on the result of parsing.For example, the result of parsing is a list of strings ["apple", "banana", "orange"], and I need to pass this list to main activity, so that the main activity can create three tabs named after three fruits.I would like to know if there is any way to pass a list of strings among activities, BTW, is it the common way of do this?
View 2 Replies
View Related
Feb 11, 2010
I have an app which makes use of several layout-views. Every layout - view also got a class for it, which extend the Activity class. One class for example retrieves some database values whilst offering a search form to the user. Afterwards the user can select one of those values and he gets presented with another screen which gives similar options as the one selected. Anyways, I'd like for the first Activity to be able to send an array with data (Strings for example) to the second one. Right now I show an activity by using:
Intent i = new Intent(this, activitysName.class); startActivity(i);
I have no idea whilst using this construction how I can "initialize" the new object with the String array I want to pass to it. So how should this be achieved ? Should I be using something else instead of an Intent-Activity combination ?
View 5 Replies
View Related
Jun 7, 2010
I have a Bitmap image and i want to forward the bitmap to another activity. I have two activities Activity A and Activity B. This is how I started the Activity B
startActivityForResult(new Intent(Activity A.this, Activity B.class), 120);
in activity B
private void forwardImage(Bitmap bit) {
Intent i = new Intent(MMS.this, Compose.class);
i.putExtra("MMS", bit);
setResult(RESULT_OK, i);
finish(); }
This is not forwarding to Activity A but if I put a String to the intent it'll forward. This is how I listen to result in Activity A
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
// super.onActivityResult(requestCode, resultCode, data);
switch (resultCode)
case RESULT_OK: Intent intent = getIntent();
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("MMS");
mmsImage.setImageBitmap(bitmap);
default: break;
} }
How can I pass a bitmap.
View 3 Replies
View Related
Jun 14, 2010
I have a ListView that shows a list of names. When you select a name, I want to pass the selected person' ID to the next view (Profile) and retreieve their data based on their ID. I am able to load the Profile View, but do not know how to pass the ID from the ListView to the Profile. Here is how I am loading the Profile: Code...
View 2 Replies
View Related
Nov 20, 2010
I have a need where I must pass some values from an Activity to another file which extends View class (instead of Activity). Its not the normal passing of values from one activity to another. In my Activity, I will pass some co-ordinate values to the class that extends View. In this class, I will draw an image and place points over the image on the required co-ordinates. But, the problem is, I cant send values using Intent.
View 11 Replies
View Related
Feb 28, 2010
For a rather crazy reason I am trying to pass a linear Layout from one activity to another. Should I use an intent extra for this? What would be the right way to create a Linear Layout in one activity and then spawn a new activity using that linear Layout.
View 8 Replies
View Related
Apr 1, 2009
I need to pass a 2 dimensional array to an ACTIVITY from a SERVICE. How can I achieve this in minimum number of statements (as in avoiding putExtras for each and every string stored in the array)?
View 4 Replies
View Related
Sep 19, 2010
So I'm getting really confused on how to do this whole thing and I was hoping someone could break it down for me a little bit.I have a service that should always be running, and at certain times it needs to alert the user that a task is to be completed(probably through a notification bar icon). When the user accepts the task, the service needs to look into the local database, construct some non primitive objects, and give them to the activity that it just started.I have looked all over and gotten very confused as to a proper approach so I have a few questions to help me wrap my head around it.If an activity creates a local SQLite database can the service and activities of that application access that same database later?Does the service and activity need to be in the same or separate packages? I would think no but for some reason I remember seeing something about this elsewhere.
How would I do the data transmission from the service to the activity? I was thinking a content provider but it seems like there should be an easier way for the service to just hand off the data. Similar to an Intent but for non primitives.
View 2 Replies
View Related
Apr 4, 2009
I'm trying to create an activity which would be on top of other activities (a small dialog themed activity) and I want to get ALL key events to be ignored by my activity and handled normally by the activity beneath it. When I say all I mean the send, end and back keys too. Is this possible?I've tried setFocusable(false), setting the flag FLAG_NOT_FOCUSABLE, and adding a dummy onKeyListener but nothing doesn't seem to do the trick.
View 4 Replies
View Related
Apr 7, 2009
I am developing an image applications.
One activity decoding image file (jpg, bmp, and so on) to byte buffer RGB 565 or 888 type.
Then want to pass image buffer to another activity for change image data.
I have 3 activity the main decoding activity[A] and selecting effect activity[B] and apply effect activity[C] for change image data.
If i use intent then activity[A] should make intent[1] and putExtra to that intent. and then [B] call getIntent and getByteArrayExtra for get byte buffer.
If user select effect then [B] make new intent[2] and putExtra to intent[2]. and startActivityForResult with intent[2] and activity[C].
Then activity[C] call getIntent to get intent[2] and getByteArrayExtra for get byte buffer again.
There takes much times to make new byte buffer and copy from parent's activity's byte buffer 2 times. [A]->[B] and [B]->[C]
That process drops application performance.
Questions
1. Can i pass intent[1] to activity[C] without make new intent[2] and putExtra byte buffer? by modify intent[1]. (if it works just 1 buffer copy will perform)
2. Can i use application global memory for share byte buffer? if i use hash map how can each activity access same hash map? (if it works don't need to copy buffer)
View 2 Replies
View Related
Jul 23, 2010
I have two activities:
"a" that spawns thread for generating a dynamic array of values inside public void run() function.
"b", graphics activity that will help me draw rectangular pulses based on array values calculated in activity "a" (calculated in a's thread to be precise).
When I am in thread inside "a", how do I pass values of array to activity "b" and
call activity as well.
activity A
CODE:..........
activity B
CODE:..............
View 1 Replies
View Related
Nov 6, 2010
I'm new to Android, and event driven code in general. Rather than embed loads of anonymous event listener classes in my Activity to handle onClick events etc, I defined separate classes to keep the code clean. Then I use them e.g. like this
myButton.setOnClickListener(new MyEventListener());
So, when 'myButton' gets clicked, MyEventListener's onClick method does some stuff.
I wanted to know the best practice for
a) accessing things in my Activity from the event listener. For example to change the text of a label. The onClick event takes a View in, but this is the view for the button that's been clicked, so if the label is NOT a child of my button, I can't use findViewById to get a handle to it. I've modified the constructor to pass in a reference to the label, so that the event has a handle to it but not sure if this is the most elegant way of doing it.
b) Passing information back e.g. when my event fires, I might want to disable some EditText fields. I'm thinking the proper way to do this is probably to dispatch another event from my event listener, that the Activity listens for, and when it sees the event, disables the fields in question. Is that the way to do it in Android?
View 1 Replies
View Related
Mar 30, 2009
How do you pass an intent from a service to a new activity launched from a main activity? There's a passextra( intent src ); but I don't think thats what I am looking for?
activity main > start service( intent wuteverserviceintent );
activity main > start activity( intent newactivityintent );
View 2 Replies
View Related
Sep 21, 2009
So I read through the SDK docs and I thought that calling a new activity(browser) as part of a task (myTask) will mean that activity* (browser) will close when a user closes the task (myTask) But I am left with a browser window.
Here is my scenario (in sudo code);
CODE:..........
Question 1: What is the cleanest way to ensure that when a user closes my app, any outside activities called will be closed to.
Question 2: Does a callback URl start a new Task, or use one in the stack if available?
View 3 Replies
View Related
May 20, 2010
I am trying to create app widget.In this widget I have added one image button.If i click on this button i should pass list of object to next activity.Before passing this list to activity I am converting it to parceable list and adding it to bunddle and puting that bundle to intent.This logic is working fine in android 1.6, but this is not working in Android 2.1.In android 2.1.I am getting Null pointer excepion when I try to access this list in next activity.To solve this problem I tried to pass only String data through bundle,in next activity String is displaying properly,but when I try to pass list,then only i am not getting list in next activity.
View 5 Replies
View Related
Jun 12, 2010
How can we pass Android Home Screen Widget info ( putExtra maybe ) to an Activity.. What particular method callback will handle this one?
View 1 Replies
View Related
Jun 17, 2010
I am working on an app that has multiple tabs. In the first tab the user will enter values. In the other tabs it will display the results of calculations based off of those values.
Like in tab 1, the user will enter "3" and "2". In tab 2, the program will add them and display "5".
In tab 2 how do I access the ints "3" and "2"?
View 1 Replies
View Related
Apr 20, 2010
In requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this); if I put time interval and distance as zero, will this work, or shall I need to give a value greater than zero.
View 4 Replies
View Related
Feb 17, 2009
I am trying the FaceDetector class using the code as shown in the following link: http://www.anddev.org/quick_and_easy_facedetector_demo-t3856.html Everything works fine as far as the activity drawing the bitmaps is concerned but I haven't had any success in getting Android to recognize a face. Has anyone tried this feature? Could anyone please help in understanding the parameters of the images to use or please post a link to some image that has worked for them?
View 2 Replies
View Related
Oct 8, 2009
I want to use default Android credentials for specific phone to pass authentication test in Google Apps, but documentation is terrible :-(, and worst of all I'm a newbie. Anyone have a idea how to do it? There are some apache libs for it, but as I mentioned documentation is very weak. Here is reference to this class.
View 2 Replies
View Related
Oct 6, 2009
I want to use default user login/pwd in my app. Do you know how can I have access to this data?
View 1 Replies
View Related
Feb 18, 2010
This link describes how to search the Android Market for apps using various parameters:
http://developer.android.com/guide/publishing/publishing.html
I'm having a heck of a time figuring out how to format a link for my apps published by my company using this format. For searching by developer name, the doc says to use the following format:
market://search?q=pub:<Developer Name>
It also says it returns exact matches only. My publisher name is "Polyclef Software". I guess I'm wondering why Google can't make a market search feature that searches for substrings in the publisher's name, but aside from that, how am I supposed to format the link? Neither of the following work:
market://search?q=pub:Polyclef Software market://search?q=pub:Polyclef+Software
I've tried a number of variations now and nothing works.
View 4 Replies
View Related
Jun 2, 2010
I have a HTTP GET request that I am attempting to send. I tried adding the parameters to this request by first creating a BasicHttpParams object and adding the parameters to that object, then calling setParams( basicHttpParms ) on my HttpGet object. This method fails. But if I manually add my parameters to my URL (i.e. append '?param1=value1śm2=value2') it succeeds.
View 3 Replies
View Related
Jul 20, 2010
I am trying to upload file to php server using following tutorial http://getablogger.blogspot.com/2008/01/android-how-to-post-file-to-php-server.html
I dont know how to add parameters like: userid="12312";sessionid="234" in it.
How to achieve this?
View 1 Replies
View Related