|
"simpe doctor appointment app" not found. Redirect to www.freelance.com[^]
Peter Leow
http://www.peterleowblog.com/
https://www.amazon.com/author/peterleow
|
|
|
|
|
|
|
Expecting : I am displaying more than one notification in Notification bar. In this notification i have three button like 1, 2 and 3. From the notification if click 1 button then it has to go the first activity if click 2 button it has to go second activity same like 3 button also.
But i am stuck below:
1. displaying more than one notification => No problem 2. But if i click 1 st button it is going the 1st activity.(Now app is opening) again when i click the 1 st button some other notification as displayed in notification status bar it not opening the 1st activity
AirshipReceiver(Push Receiver)
@Override
protected boolean onNotificationOpened(@NonNull Context context, @NonNull NotificationInfo notificationInfo, @NonNull ActionButtonInfo actionButtonInfo) {
Log.i(TAG, "Notification action button opened. Button ID: " + actionButtonInfo.getButtonId() + ". NotificationId: " + notificationInfo.getNotificationId());
Toast.makeText(context.getApplicationContext(),"Button Click",Toast.LENGTH_LONG).show();
Log.e("@@@@@@@ID", String.valueOf(notificationInfo.getNotificationId()));
Log.e("$$", String.valueOf(notificationInfo.getMessage().getAlert()));
Log.e("eGSSSHKJHSHJS", (String) notificationInfo.getMessage().getPushBundle().get("AlarmJson"));
String pushjson=(String) notificationInfo.getMessage().getPushBundle().get("AlarmJson");
if(actionButtonInfo.getButtonId()!=null && actionButtonInfo.getButtonId().equalsIgnoreCase("Graph")) {
Log.e("Graph","You clicked Graph");
Toast.makeText(context.getApplicationContext(),"Graph Click",Toast.LENGTH_LONG).show();
Intent i = new Intent(context.getApplicationContext(), **ResultActivity**.class);
i.putExtra("From", "from@@#graphicViewRoute");
i.putExtra("Pushjson","json@@"+pushjson);
i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK |Intent.FLAG_ACTIVITY_CLEAR_TOP |Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(i);
return true;
}
else if(actionButtonInfo.getButtonId()!=null && actionButtonInfo.getButtonId().equalsIgnoreCase("DD"))
{
Log.e("DD","You clicked DD");
Intent i = new Intent(context.getApplicationContext(), **ResultActivity**.class);
i.putExtra("From", "from@@#ddviewRoute");
i.putExtra("Pushjson","json@@"+pushjson);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
return true;
}
return false;
}
ResultActivity.class:
public class ResultActivity extends CordovaActivity{
public static boolean mIsInForegroundMode;
public static String PREF_FILE = "eG_sp";
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Log.e("ResultActivity","You ResultActivity");
Bundle extras = getIntent().getExtras();
String pushPage = extras.getString("From");
String pushJSON = extras.getString("Pushjson");
Toast.makeText(getApplicationContext(),"ResultActivity Click",Toast.LENGTH_LONG).show();
Log.e("ResultActivity",pushPage+pushJSON);
SharedPreferences.Editor editor = getSharedPreferences(PREF_FILE, MODE_APPEND).edit();
editor.putString("pushPage", pushPage);
editor.putString("pushJSON",pushJSON);
editor.commit();
super.loadUrl("file:///android_asset/www/index.html");
}
@Override
protected void onPause(){
super.onPause();
mIsInForegroundMode = false;
}
@Override
protected void onResume() {
super.onResume();
mIsInForegroundMode=true;
}
@Override
protected void onStop() {
super.onStop();
mIsInForegroundMode=false;
}
@Override
protected void onStart() {
super.onStart();
mIsInForegroundMode=true;
}
@Override
public void onDestroy() {
LOG.d(TAG, "CordovaActivity.onDestroy()");
super.onDestroy();
mIsInForegroundMode=false;
}
}
|
|
|
|
|
Where is the problem occurring, and which button is Button 1, 2 etc?
|
|
|
|
|
 when the button click the activity not opening from notifcation bar at second time.
problem is here
@Override
protected boolean onNotificationOpened(@NonNull Context context, @NonNull NotificationInfo notificationInfo, @NonNull ActionButtonInfo actionButtonInfo) {
Log.i(TAG, "Notification action button opened. Button ID: " + actionButtonInfo.getButtonId() + ". NotificationId: " + notificationInfo.getNotificationId());
Toast.makeText(context.getApplicationContext(),"Button Click",Toast.LENGTH_LONG).show();
Log.e("@@@@@@@ID", String.valueOf(notificationInfo.getNotificationId()));
Log.e("$$", String.valueOf(notificationInfo.getMessage().getAlert()));
Log.e("eGSSSHKJHSHJS", (String) notificationInfo.getMessage().getPushBundle().get("AlarmJson"));
String pushjson=(String) notificationInfo.getMessage().getPushBundle().get("AlarmJson");
if(actionButtonInfo.getButtonId()!=null && actionButtonInfo.getButtonId().equalsIgnoreCase("Graph")) {
Log.e("Graph","You clicked Graph");
Toast.makeText(context.getApplicationContext(),"Graph Click",Toast.LENGTH_LONG).show();
Intent i = new Intent(context.getApplicationContext(), **ResultActivity**.class);
i.putExtra("From", "from@@#graphicViewRoute");
i.putExtra("Pushjson","json@@"+pushjson);
i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK |Intent.FLAG_ACTIVITY_CLEAR_TOP |Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(i);
return true;
}
else if(actionButtonInfo.getButtonId()!=null && actionButtonInfo.getButtonId().equalsIgnoreCase("DD"))
{
Log.e("DD","You clicked DD");
Intent i = new Intent(context.getApplicationContext(), **ResultActivity**.class);
i.putExtra("From", "from@@#ddviewRoute");
i.putExtra("Pushjson","json@@"+pushjson);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
return true;
}
return false;
}
|
|
|
|
|
Shanmugapriya D wrote: problem is here Where?
|
|
|
|
|
I am trying to make a speech to text notepad.
I have made an app in which I can take notes manually, but when I select the option to speak, I am thrown outside of the note, and nothing is written into the note.
I wish to be able to write down everything that is being said in the environment, and I also want to make changes to the note, before its saved.
I also want to be able to select the language that is being used.
I have made a condition in which the audio is captured only the first time that I press the speak button, and the second time it does nothing and the boolean is set to false again.
I also want to be able to convert the text that was captured, into speech one I select another option in the options menu, in the editText class.
I am just trying to get this app working, so I used the code in an example I found here in the code project. I hope that there's no problem with that.
I really need help, so can someone please help me fix this?
Thanks.
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.database.Cursor;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.TextView;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.view.Menu;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
public class NoteEdit extends Activity{
<pre>
public static int numTitle = 1;
public static String curDate = "";
public static String curText = "";<br />
private EditText mTitleText;
private EditText mBodyText;
private TextView mDateText;
private Long mRowId;
protected static final int RESULT_SPEECH = 1;
public boolean count=false;
private Cursor note;
private NotesDbAdapter mDbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDbHelper = new NotesDbAdapter(this);
mDbHelper.open();
setContentView(R.layout.note_edit);
setTitle(R.string.app_name);
mTitleText = (EditText) findViewById(R.id.title);
mBodyText = (EditText) findViewById(R.id.body);
mDateText = (TextView) findViewById(R.id.notelist_date);
long msTime = System.currentTimeMillis();<br />
Date curDateTime = new Date(msTime);
SimpleDateFormat formatter = new SimpleDateFormat("d'/'M'/'y");<br />
curDate = formatter.format(curDateTime);
mDateText.setText(""+curDate);
mRowId = (savedInstanceState == null) ? null :
(Long) savedInstanceState.getSerializable(NotesDbAdapter.KEY_ROWID);
if (mRowId == null) {
Bundle extras = getIntent().getExtras();
mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID)
: null;
}
populateFields();
}
public static class LineEditText extends EditText{
public LineEditText(Context context, AttributeSet attrs) {
super(context, attrs);
mRect = new Rect();
mPaint = new Paint();
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mPaint.setColor(Color.BLUE);
}
private Rect mRect;
private Paint mPaint;
@Override
protected void onDraw(Canvas canvas) {
int height = getHeight();
int line_height = getLineHeight();
int count = height / line_height;
if (getLineCount() > count)
count = getLineCount();
Rect r = mRect;
Paint paint = mPaint;
int baseline = getLineBounds(0, r);
for (int i = 0; i < count; i++) {
canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint);
baseline += getLineHeight();
super.onDraw(canvas);
}
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
saveState();
outState.putSerializable(NotesDbAdapter.KEY_ROWID, mRowId);
}
@Override
protected void onPause() {
super.onPause();
saveState();
}
@Override
protected void onResume() {
super.onResume();
populateFields();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.noteedit_menu, menu);
return true;<br />
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_about:
<br />
AlertDialog.Builder dialog = new AlertDialog.Builder(NoteEdit.this);
dialog.setTitle("About");
dialog.setMessage("Hello! I'm Heng, the creator of this application. This application is created for learning." +
" Using it on trading or any others activity that is related to business is strictly forbidden."
+"If there is any bug is found please freely e-mail me. "+
"\n\tedisonthk@gmail.com"
);
dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
dialog.show();<br />
return true;
case R.id.menu_delete:
if(note != null){
note.close();
note = null;
}
if(mRowId != null){
mDbHelper.deleteNote(mRowId);
}
finish();
return true;
case R.id.menu_speak:
if(count==false){
Intent intent = new Intent(
RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");
try {
startActivityForResult(intent, RESULT_SPEECH);
} catch (ActivityNotFoundException a) {
Toast t = Toast.makeText(getApplicationContext(),
"Opps! Your device doesn't support Speech to Text",
Toast.LENGTH_SHORT);
t.show();
}
count=true;
}else{count=false;}
case R.id.menu_save:
saveState();
finish();
default:
return super.onOptionsItemSelected(item);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case RESULT_SPEECH: {
if (resultCode == RESULT_OK && null != data) {
ArrayList<string> text = data
.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
mBodyText.setText(text.get(0), TextView.BufferType.EDITABLE);
}
break;
}
}
}
private void saveState() {
String title = mTitleText.getText().toString();
String body = mBodyText.getText().toString();
if(mRowId == null){
long id = mDbHelper.createNote(title, body, curDate);
if(id > 0){
mRowId = id;
}else{
Log.e("saveState","failed to create note");
}
}else{
if(!mDbHelper.updateNote(mRowId, title, body, curDate)){
Log.e("saveState","failed to update note");
}
}
}
private void populateFields() {
if (mRowId != null) {
note = mDbHelper.fetchNote(mRowId);
startManagingCursor(note);
mTitleText.setText(note.getString(
note.getColumnIndexOrThrow(NotesDbAdapter.KEY_TITLE)));
mBodyText.setText(note.getString(
note.getColumnIndexOrThrow(NotesDbAdapter.KEY_BODY)));
curText = note.getString(
note.getColumnIndexOrThrow(NotesDbAdapter.KEY_BODY));
}
}
}
|
|
|
|
|
Member 10850253 wrote: I used the code in an example I found here in the code project Then you should post your question in the forum at the end of the article that contains the example.
|
|
|
|
|
I'd like to build a remote mobile app view the Screen of Desktop .
What should i do ,use and learn ?
|
|
|
|
|
|
I am trying to follow Val Okafor's Drawing App Tutorial.
Under Create CustomView, Step 2: Implement Constructor:
How do I have the CustomView class extend the framework’s View class?
I have just installed Android Studio and would like to get this running so that I can understand Android better.
Gerhard Oosthuizen
-- modified 22-Nov-16 13:05pm.
|
|
|
|
|
Ask Val Okafor, we have no idea what he told you.
|
|
|
|
|
Member 10654350 wrote: How do I have the CustomView class extend the framework’s View class? This comes to mind:
public class CustomView extends View
{
...
}
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
i want to know how can i make seat booking system of a movie in my application??
|
|
|
|
|
Research, design, develop, code, test, fix ...
|
|
|
|
|
It will take a lot of code. What exactly is your question?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
i want to save text in android application using sqllite database... plz any one help me to do this i am newly to coding and android..
|
|
|
|
|
|
You can open my profile and see my article "Android SQLite", it is poor but simply.
|
|
|
|
|
please help me to make this app
|
|
|
|
|
This type of mobile app can be found all over the Internet. The first three hits from here[^] would be a good starting point.
Which part do you need help with SPECIFICALLY?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Member 12838657 wrote: please help me to make this app How can we help?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
i'm developing an app with warp function but my code does not working peoperly
i need to move pixels with fingers like liquify in PS
any help would be great.
tnx
private static final int WIDTH = 20;
private static final int HEIGHT = 20;
private static final int COUNT = (WIDTH + 1) * (HEIGHT + 1);
private final Bitmap mBitmap;
private final float[] mVerts = new float[COUNT * 2];
private final float[] mOrig = new float[COUNT * 2];
private final Matrix mMatrix = new Matrix();
private final Matrix mInverse = new Matrix();
private float[] matrixInverse;
private int mLastWarpX = -9999;
private int mLastWarpY;
private static void setXY(float[] array, int index, float x, float y) {
array[(index * 2)] = x;
array[(index * 2) + 1] = y;
}
public Warp(Bitmap imgBitmap, float i, float j, Canvas myCanvas) {
mBitmap = imgBitmap;
float w = mBitmap.getWidth();
float h = mBitmap.getHeight();
int index = 0;
for (int y = 0; y <= HEIGHT; y++) {
float fy = h * y / HEIGHT;
for (int x = 0; x <= WIDTH; x++) {
float fx = w * x / WIDTH;
setXY(mVerts, index, fx, fy);
setXY(mOrig, index, fx, fy);
index++;
}
}
mMatrix.invert(mInverse);
float[] pt = {i, j};
mInverse.mapPoints(pt);
int x = (int) pt[0];
int y = (int) pt[1];
if (mLastWarpX != x || mLastWarpY != y) {
mLastWarpX = x;
mLastWarpY = y;
draw(pt[0], pt[1], myCanvas);
}
}
private void draw(float cx, float cy, Canvas canvas) {
final float K = 10000;
float[] src = mOrig;
float[] dst = mVerts;
for (int i = 0; i < COUNT * 2; i += 2) {
float x = src[i + 0];
float y = src[i + 1];
float dx = cx - x;
float dy = cy - y;
float dd = dx * dx + dy * dy;
float d = dd/2;
float pull = K / (dd + 0.000001f);
pull /= (d + 0.000001f);
if (pull >= 1) {
dst[i + 0] = cx;
dst[i + 1] = cy;
} else {
dst[i + 0] = x + dx * pull;
dst[i + 1] = y + dy * pull;
}
}
canvas.drawColor(0xFFCCCCCC);
canvas.concat(mMatrix);
canvas.drawBitmapMesh(mBitmap, WIDTH, HEIGHT, mVerts, 0,
null, 0, null);
}
|
|
|
|
|