我正在尝试录制视频,并希望显示正在录制的秒数.
我该怎么办?
public void startRecording(View v){
flipCamera.setVisibility(View.GONE);
captureImage.setVisibility(View.GONE);
String deviceMan = android.os.Build.MANUFACTURER;
this.mediaRecorder = new MediaRecorder();
this.mediaRecorder.setCamera(this.camera);
camera.unlock();
this.mediaRecorder.setCamera(camera);
this.mediaRecorder.setOrientationHint(90);
this.mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
this.mediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
CamcorderProfile camcorderProfile_HQ = CamcorderProfile
.get(CamcorderProfile.QUALITY_480P);
this.mediaRecorder.setProfile(camcorderProfile_HQ);
this.mediaRecorder.setOutputFile(this.initFile().getAbsolutePath());
this.mediaRecorder.setMaxDuration(60000); // Set max duration 60 sec.
this.mediaRecorder.setMaxFileSize(5000000);
this.mediaRecorder.setPreviewDisplay(this.cameraPreview.getHolder()
.getSurface());
this.mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
try {
this.mediaRecorder.prepare();
// start the actual recording
// throws IllegalStateException if not prepared
this.mediaRecorder.start();
Toast.makeText(this, R.string.recording, Toast.LENGTH_SHORT).show();
this.toggleButtons(true);
} catch (Exception e) {
Log.wtf(TAG, "Failed to prepare MediaRecorder", e);
Toast.makeText(this, R.string.cannot_record, Toast.LENGTH_SHORT)
.show();
this.releaseMediaRecorder();
}
}
Run Code Online (Sandbox Code Playgroud)
我对Android很新,所以请任何人都可以提供帮助.
我试图通过twilio(Android应用程序)发送短信来验证用户.
以下是详细摘要 - (在Snapchat中)在注册期间,我想通过向用户移动设备发送动态运行时代码来验证用户.发送后我有验证字段.
所以我该怎么做 ?
我试过,也搜索了这些东西,但没有得到答案
我正在点击一个视图点击现在我想解雇膨胀的视图,但这里没有发生的是我的来源...
icon1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
LayoutInflater inflater = (LayoutInflater)screen.getSystemService(screen.LAYOUT_INFLATER_SERVICE);
layout = inflater.inflate(R.layout.image_popup,null);
AlertDialog.Builder builder = new AlertDialog.Builder(Actvity.this);
builder.setCancelable(true);
builder.setView(layout);
Run Code Online (Sandbox Code Playgroud)
我不想添加正面或负面按钮
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
final AlertDialog alertDialog = builder.create();
alertDialog.setIcon(R.drawable.icon1);
alertDialog.show();
}
});
Run Code Online (Sandbox Code Playgroud) 我试图在几秒钟后用一些时间计数器自动关闭我膨胀的弹出窗口.我不知道怎么做计数定时器(5秒).
LayoutInflater inflater = (LayoutInflater)screen.getSystemService(screen.LAYOUT_INFLATER_SERVICE);
layout = inflater.inflate(R.layout.log_viewer,null);
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setCancelable(true);
builder.setView(layout);
AlertDialog alertDialog = builder.create();
alertDialog.show();
Button btn0= (Button)layout.findViewById(R.id.btn0);
Button btn1= (Button)layout.findViewById(R.id.btn1);
Button btn2= (Button)layout.findViewById(R.id.btn2);
btn0.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i =new Intent(Main_Activity.this,Act.class);
startActivity(i);
overridePendingTransition(R.anim.animation,R.anim.animation2);
}
});
btn1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i =new Intent(Main_Activity.this,Activity2.class);
startActivity(i);
overridePendingTransition(R.anim.animation,R.anim.animation2);
}
});
btn2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i =new Intent(Main_Activity.this,Activity1.class);
startActivity(i);
overridePendingTransition(R.anim.animation,R.anim.animation2);
}
}); …Run Code Online (Sandbox Code Playgroud) 我试图读取字符串的第7行,以便我可以过滤所需的文本,但没有得到更多.(假设我有n行).
class Lastnthchar {
public static void main(String[] args) {
// TODO Auto-generated method stub
String alldata =" FORM"+"\n"+
" to get all data"+"\n"+
" PART A is mandatory"+"\n"+
" enclose all Certificate"+"\n"+
" Certificate No. SFDSFDFS Last updated on 12-Jun-2009"+"\n"+
" Name and address"+"\n"+
" Lisa Lawerence"+"\n"+
" 10/3 TOP FLOOR, Street no 22 ,NewYork"+"\n"+
" residence"+"\n"+
" zip-21232"+"\n"+
" C 78,New York"+"\n"+
" US"+"\n"+
" US"+"\n"+
" "+"\n"+
" worldwide";
String namerequired = new String ();
//BufferedReader br …Run Code Online (Sandbox Code Playgroud)