import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.Resources;
import android.os.Bundle;
import android.os.Message;
;
import android.provider.Telephony.Sms;
import android.view.View;
import android.view.ViewInflate;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MatchingStuff extends Activity{
// private final Toast mToast;
private String textMessage="";
private TextView Text;
private Mstuff mstuff;
// private final Toast t;
private ViewInflate inflate = null;
@Override
public void onCreate(Bundle icicle){
super.onCreate(icicle);
setContentView(R.layout.matchingstuff);
TextView serverreptext = (TextView) findViewById(R.id.serverrep);
Bundle bundle = this.getIntent().getExtras();
String s = bundle.getString("ServerReply");
serverreptext.setText(s);
Button button = (Button) findViewById(R.id.notify);
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View arg0) {
showToast();
showNotification(mstuff);
}
private void showNotification(Mstuff mstuff) {
}
private void showToast() {
View view = inflateView(R.layout.matchingstuff_message);
TextView tv = (TextView)view.findViewById(R.id.message);
tv.setText("HttpClient");
Toast t = new Toast(mstuff);
t.setView(view);
t.setDuration(Toast.LENGTH_LONG);
t.show();
}
private View inflateView(int matchingstuff) {
ViewInflate v = (ViewInflate)getSystemService(Context.INFLATE_SERVICE);
return v.inflate(R.layout.catalog, null, null);
}
private void showNotification() {
NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
String from = "Match found";
Intent contentIntent = new Intent(MatchingStuff.this, Settings.class);
// Intent contentIntent = new Intent();
String text = getString(R.string.matchingstuff_text);
Intent appIntent = new Intent(Intent.VIEW_ACTION, Sms.Inbox.CONTENT_URI);
//Intent appIntent = new Intent();
Notification notif = new Notification(
MatchingStuff.this,
R.drawable.stat_sample,
text,
System.currentTimeMillis(),
from,
textMessage,
contentIntent,
R.drawable.shadow,
getText(R.string.activity_sample_code),
appIntent);
nm.notify(R.string.matchingstuff_text, notif);
}
});
}
}