[android-developers] Update an AbsouleLayout through code.

2010-05-09 Thread Lordsaibat
My application sends a text message, it receives a reply through a
broadcast receiver  that fires off a Notification.

Here is my problem.
My display needs to update when I receive the sms back but the only
way it does update is if I click on the notification or reload the
app.

How can I get the display to update without reloading the app.  The
main thing I am trying to update is an ImageButton if that helps.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Calling function from Receiver class not working.

2010-04-20 Thread Lordsaibat
I have a SMSReceiver class that needs to pass the phone number and
message to another class.  Which works but when I call that class I
need the function to read preference to compare if it needs to execute
another function.  So here is the code.

SMSReceiver

public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub

//--get the SMS message passed in --
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
String str = "";
String from;
String mymsg;

if (bundle != null)
{
//---retrieve the sms message received--
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int i=0; ihttp://groups.google.com/group/android-developers?hl=en


[android-developers] startActivityForResult and setResult problems

2010-03-31 Thread Lordsaibat
ok I have two classes my main class calls a menu class when the user
gets done with that they press the back button to go to the main
class. on the main class I have onActivityResult setup but no matter
what the data field is null all the time even though I setup the
bundle and attached it to an Intent. Please look over my code and see
what it going on.

Main class

import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;

public class caralarm extends Activity {



/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);


@Override
public boolean onCreateOptionsMenu(Menu menu) {
new MenuInflater(this).inflate(R.menu.menu, menu);
return(super.onCreateOptionsMenu(menu));
}


@Override
public boolean onOptionsItemSelected(MenuItem item) {

if (item.getItemId()==R.id.close) {
Toast.makeText(this, "Trying to close app",
Toast.LENGTH_SHORT).show();
}

if (item.getItemId()==R.id.refresh) {
Toast.makeText(this, "Trying to refresh app",
Toast.LENGTH_SHORT).show();
}

if (item.getItemId()==R.id.settings) {
Toast.makeText(this, "Trying to open settings app",
Toast.LENGTH_SHORT).show();
launch_settings2();



}

return(super.onOptionsItemSelected(item));
}

 protected void onActivityResult(int requestCode, int resultCode,
Intent data){



if (data == null)
{
Log.d ("data", "data was null");
Number = Settings2.Number; //this works
Password = Settings2.Passwordtext;
Often = Settings2.NumMin;
return;

}

Bundle extras = data.getExtras();
String name = extras.getString("Alarm");
Toast.makeText(this, name, Toast.LENGTH_SHORT);

}

void launch_settings2(){
  Intent i = new Intent(this, Settings2.class);
  startActivityForResult(i, 0);

  }
}

Settings2 class
Import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.widget.EditText;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;

public class Settings2 extends PreferenceActivity{
static String Number = "";
static String Passwordtext = "";
static String NumMin = "";

protected void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings2);
}

public static String getNumber (Context context){

return
PreferenceManager.getDefaultSharedPreferences(context).getString("AlarmNumber",
Number);
}

public static String getPassword (Context context){

return
PreferenceManager.getDefaultSharedPreferences(context).getString("Password",
Passwordtext);
}

public static String getNumMin (Context context){

return
PreferenceManager.getDefaultSharedPreferences(context).getString("Often",
NumMin);
}

@Override
protected void onPause(){
super.onPause();


//copy data
Number = getNumber(this);
Passwordtext = getPassword(this);
NumMin = getNumMin(this);

Bundle info = new Bundle();
info.putString("Alarm", Number );
info.putString("Password", Passwordtext);
info.putString("Often", NumMin);
Intent intent = new Intent();
intent.putExtras(info);


setResult(RESULT_OK, intent);
finish();



}
}



-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.


[android-developers] Biloxi Android Group

2010-01-03 Thread Lordsaibat
If any one is interested, I am starting up a Linux, Android, and 2600
group in Biloxi, Ms. Come check out my group at
http://groups.google.com/group/biloxi-linux-android-2600-group . If I
get enough interest I would like to have a meeting in February.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Need help with ServerSocket

2009-07-23 Thread Lordsaibat

Java:

public void server()
 {
  DataOutputStream os=null;
 DataInputStream is = null;
 ServerSocket socket = null;
 Socket ClientSocket = null;
 String out = null;
 try
 {
  socket = new ServerSocket(SERVERPORT);//10.0.2.2

  if(socket == null)
  {
   Log.d("TagServer()", "socket null");
  }
  else
  {
   Log.d("TagServer()", "Waiting...");
   ClientSocket = socket.accept();
 os = new DataOutputStream
(ClientSocket.getOutputStream());
 is = new DataInputStream
(ClientSocket.getInputStream());
 /* By magic we know, how much data will be
waiting for us*/
 byte[] buf = new byte[100];
 int readLen = 0;
 boolean listening = true;


 while(listening == true)
 //while((out != "end") || (readLen = is.read(buf,
0, 100)) != -1)
 //while (out != "end")
 {

  if ((readLen = is.read(buf, 0, 100)) != -1){
  out = new String(buf, 0, readLen-1);
  Log.d("TCP", out);
  os.writeBytes("gotit");

  String test = out.toString();

  if (test != "end")
 {
  listening = true;
  }else{
  listening = false;
  }
  }

 }
 os.close();
 is.close();
 socket.close();
 ClientSocket.close();
 Log.d("TagServer()", "Finished");
  }
 }
 catch(Exception e)
 {
  System.out.println(e);
  Log.d("TagServer()", e.toString());
 }
 }


Ok I am trying to be able to stop listening for packets and I am
trying to do that with the test variable.
no matter what it seems that test never = ends.

Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] New Projects

2009-06-14 Thread Lordsaibat

When I make a new project the .java file is not generated.
I can run the project, but it does not run in the emulator or
anything.
It did use to work before then it stop working. I tried deleting the
folder and all project files.
After that I reinstalled everything but I am still having problems.
Please help.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Creating new projects in eclipse

2009-06-14 Thread Lordsaibat

When I make a new project the .java file is not generated.
I can run the project, but it does not run in the emulator or
anything.
It did use to work before then it stop working. I tried deleting the
folder and all project files.
After that I reinstalled everything but I am still having problems.
Please help.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---