我不知道如何在android中以编程方式转发语音邮件?
我无法在android 4.1 mobile中看到toast消息.直到昨天我才能看到吐司的消息.从今天起,我才看不到这条消息.请帮我.
Toast.makeText(getApplicationContext(), "hi", Toast.LENGTH_SHORT).show();
Run Code Online (Sandbox Code Playgroud)
我也尝试过自定义toast消息而不是toast消息.但仍然没有工作.
定制吐司:
LayoutInflater inflater=getLayoutInflater();
View layout = inflater.inflate(R.layout.toast_layout,(ViewGroup) findViewById(R.id.toast_layout_root));
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("Please fill Name");
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout);
toast.show();
Run Code Online (Sandbox Code Playgroud) 如何使用Google API将Android原生联系人同步到Google帐户.提供一些有用的链接.
我需要拖动和缩放图像.这是我的代码......
//instance variables
Matrix matrix = new Matrix();
Matrix savedMatrix = new Matrix();
static final int NONE = 0;
static final int DRAG = 1;
static final int ZOOM = 2;
int mode = NONE;
PointF start = new PointF();
PointF mid = new PointF();
float oldDist = 1f;
Run Code Online (Sandbox Code Playgroud)
//用于imageview的OnTouchListener
OnTouchListener touchAction = new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
ImageView i = (ImageView)v;
dragAndZoom(i, event);
return true;
}
};
Run Code Online (Sandbox Code Playgroud)
//执行拖动和缩放操作
private void dragAndZoom(View v, MotionEvent …Run Code Online (Sandbox Code Playgroud) 我能够以编程方式断开呼叫,以便在Android 2.2中调用未知号码.但在android 4.1中,它不起作用.
工作代码断开Android 2.2中的调用:
private Class c;
private Method m;
private com.android.internal.telephony.ITelephony telephonyService;
public void onReceive(Context context, Intent intent)
{
Bundle b = intent.getExtras();
String state = b.getString(TelephonyManager.EXTRA_STATE);
if(state.equalsIgnoreCase(TelephonyManager.EXTRA_STATE_RINGING))
{
TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
c = Class.forName(tm.getClass().getName());
m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
telephonyService = (ITelephony) m.invoke(tm);
telephonyService.silenceRinger();
telephonyService.endCall();
}
}
Run Code Online (Sandbox Code Playgroud)
请帮帮我.谢谢
最后我得到了2.6版本的解决方案.
MODIFY_PHONE_STATE自2.3+以来,权限不再适用于silenceRinger(),但endCall也没问题.因此解决方案是注释掉对silenceRinger()的调用.
我如何从 php 服务器向我的 android 应用程序发送通知/消息/警报。我不想使用 C2DM 服务。有没有其他选择?提前致谢
我必须使用内容解析器获得不同的原始联系人ID.
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
null, null, null, null);
if (cur.getCount() > 0){
while (cur.moveToNext()){
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
System.out.println("id............"+id+"..."+name);
}
}
Run Code Online (Sandbox Code Playgroud)
我已将所有联系人插入本机联系人.然后使用上面的代码我得到所有本机联系人ID.插入1个联系人后,如何一次获得一个id.请帮帮我.谢谢.
我动态创建了很多按钮.如何在两个按钮之间添加空格.请帮我.提前致谢
我的代码:
private LinearLayout LLDynamic;
private RelativeLayout.LayoutParams ParaOne;
ParaOne = new RelativeLayout.LayoutParams(280, 30);
Button button1= new Button(Twindo_fromEditGroup.this);
button1.setTextSize(16);
LLDynamic = new LinearLayout(Twindo_fromEditGroup.this);
LLDynamic.setOrientation(LinearLayout.VERTICAL);
LLDynamic.addView(button1,ParaOne);
Run Code Online (Sandbox Code Playgroud)