当我在android中按下按钮时,我正在尝试拨打电话
((Button)findViewById(R.id.button1)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String phno="10digits";
Intent i=new Intent(Intent.ACTION_DIAL,Uri.parse(phno));
startActivity(i);
}
});
Run Code Online (Sandbox Code Playgroud)
但是当我跑步并点击按钮时,它会给我错误
ERROR/AndroidRuntime(1021): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.CALL dat=9392438004 }
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
我是服务器端开发的新手.我想处理一个应用程序,我需要通过我的应用程序从我的Android设备上录制Helix Server上的视频.我在Windows Server PC上安装了Helix Server.
在Android应用程序中,我正在尝试在Helix服务器上传录制的视频.我已经实现了在SD卡上录制视频的应用程序,但我想直接在Helix Server上录制并保存该视频.我已经实现了我的Android应用程序如下:
public class NewRecordingVideo extends Activity implements SurfaceHolder.Callback {
private MediaRecorder recorder;
boolean flag = false;
boolean startedRecording = false;
boolean stoppedRecording = false;
SurfaceHolder mHolder;
SurfaceView videoSView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setContentView(R.layout.activity_main);
recorder = new MediaRecorder();
recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_RECOGNITION);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
videoSView = ((SurfaceView)findViewById(R.id.surfaceView1));
mHolder=videoSView.getHolder();
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
((Button)findViewById(R.id.startBtn)).setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View arg0) {
if(startedRecording == false) {
recorder.start();
startedRecording = true;
Toast.makeText(NewRecordingVideo.this,
"Your video …
Run Code Online (Sandbox Code Playgroud) 我想实现一个从蓝牙设备接收文件的应用程序.
在收到之前,将发出通知以接受传入的文件请求.
从那里,我想激活"接受"并自动下载文件,而无需在用户从另一个蓝牙配对设备接收第二个文件时提出接受对话框,而在用户启动应用程序时没有通知干扰.
我是android应用程序的新开发人员.当我通过国家代码传递手机号码时,我想获得ISO国家代码.如果我将手机号码传递给1-319-491-6338,我可以在Android中获得美国/美国的国家ISO代码吗?
我编写的代码如下:
TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String countryCode = tm.getSimCountryIso();
String mobileno="1-319-491-6338";
Run Code Online (Sandbox Code Playgroud)
在这里,我可以在哪里通过手机号码?
有人可以帮帮我吗?
提前致谢
我想实现一个用于阻止移动号码的应用程序,用于接收或发送呼叫和消息.在我的应用程序中,我在EditText
框中输入手机号码然后我点击一个按钮来阻止用户输入的手机号码.
我已经实现了一个活动类,如下所示:
public class BlockNumberActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
((Button)findViewById(R.id.block)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String mobileNumer = ((EditText)findViewById(R.id.mobileNum)).getText().toString();
//How to block entered mobileNumber
}
});
((Button)findViewById(R.id.unblock)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String mobileNumer = ((EditText)findViewById(R.id.mobileNum)).getText().toString();
//How to unblock entered mobileNumber
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
我想我们可以使用BroadcastReceiver
.但我对它没有更多的了解.请告诉我如何实现阻止或解锁移动号码.请任何人帮我.....
我想在1-60范围内输入值.该EditText
不该接受61,62一样...值,或者0,-1,-2 ...
我们如何EditText
在android中提供1-60的范围?我在main.xml中完成了
<EditText android:layout_height="wrap_content"
android:id="@+id/editText1"
android:layout_width="160dip"
android:inputType="number">
</EditText>
Run Code Online (Sandbox Code Playgroud) 我正在研究简单的应用程序,以显示不同形式的时间.显示使用此ISO代码显示ISO国家/地区代码的时间.我能否以ISO国家/地区格式更改时间?
我编写的代码如下
TelephonyManager tMgr =
(TelephonyManager)getApplicationContext().getSystemService(
Context.TELEPHONY_SERVICE);
String iso = tMgr.getNetworkCountryIso();
Log.v("Device iso", "=======>" + iso);
String mbNo = tMgr.getLine1Number();
Log.v("mbNo", "=======>" + mbNo);
Run Code Online (Sandbox Code Playgroud)
我在这里获得iso作为美国.我可以用美国时间格式显示当前的系统时间格式吗?
我使用Date类来显示时间如下
DateFormat df = DateFormat.getTimeInstance();
systime = df.format(new Date());
Run Code Online (Sandbox Code Playgroud)
它以HH:MM:SS AM/PM格式显示时间.我想将上述时间显示为美国格式.
如何以美国或任何其他格式显示时间?
我是新的programmer.i想通过使用xmpp server实现示例应用程序来获取聊天.在这个实现中,我通过使用ConnectionConfiguration对象创建了连接,如下所示:
ConnectionConfiguration connConfig =new ConnectionConfiguration(host, Integer.parseInt(sport), service);
Run Code Online (Sandbox Code Playgroud)
我通过调用connect方法将connConfig对象传递给XMPPConnection类我正在获取连接并通过调用登录方法传递用户名pand密码然后我登录到password.to登录我正在使用按钮.当我点击按钮我正在使用意图改变活动.我正在改变活动我希望在另一个活动中获得相同的连接.
我已经为LoginActivity编写了如下代码:
public class LoginActivity extends Activity
{
ConnectionConfiguration connConfig ;
XMPPConnection connection;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.setting);
((Button)findViewById(R.id.login)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0)
{
connConfig =new ConnectionConfiguration(host, Integer.parseInt(sport), service);
connection = new XMPPConnection(connConfig);
connection.connect();
connection.login(uname, password);
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
我写了如下ChatPageActivity:
public class ChatPage extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.chatpage);
//How to get the same XMPPConnection from …
Run Code Online (Sandbox Code Playgroud) 当设备连接到pc时,我想让USB Mass Storage活动打开或关闭usb模式.我已经实现了如下应用程序.
public class USB_ConnectActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final String state = Environment.getExternalStorageState();
((Button)findViewById(R.id.onButton)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!(Environment.MEDIA_SHARED.equals(state))) {
//How to navigate android USB Mass Storage page
}
}
});
((Button)findViewById(R.id.offButton)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if ((Environment.MEDIA_SHARED.equals(state))) {
//How to navigate android USB Mass Storage page
}
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
从上面的代码我已经使用两个按钮关闭和USB大容量存储.但我没有更多的信息来在内置USB大容量存储页面导航android.请任何人帮我.
我想写一些内容到XML文件.为此我创建了一个XML文件和带有元素,属性和值的写标签,其中包含以下数据:
XmlSerializer serializer = Xml.newSerializer();
serializer.startTag(null, element);
serializer.attribute(null, atbname, value);
serializer.text(text);
serializer.endTag(null, tag);
Run Code Online (Sandbox Code Playgroud)
如果我想添加一个带有新元素,新属性等的新标签,我会在之前使用标签修改的标签处输入元素.
如何将新标签附加到先前附加的标签?
android ×10
phone-call ×2
blocking ×1
bluetooth ×1
button ×1
chat ×1
country ×1
file ×1
helix-server ×1
mobile ×1
navigation ×1
time-format ×1
upload ×1
xml ×1
xmpp ×1