2016-09-22 7 views
-1

私はアンドロイドのJavaプログラミングで新しいです、私はイメージ、ビデオ、オーディオのようなメディアを送信するのに役立つ活動を作成する必要があります..別のユーザーまたはユーザーのグループに送信して、whatsappのように送信アクションが超高速になるようにしますが、どの方法で私が従うことができ、何を知っていて必要なのかわかりません。私はアンドロイドスタジオ2.ifを使用していますいくつかのチュートリアルやソースコードが私とリンクを共有してください。私の質問への最高の配慮に感謝します。イメージのようなメディアを送る効果的な方法は何ですか..私のアンドロイドアプリケーションを使用して

パブリッククラスMainActivityアクティビティ{

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main);  
    EditText MyText=(EditText) findViewById(R.id.text); 
    Button send=(Button) findViewById(R.id.button1); 
    ImageView attach =(ImageView) findViewById(R.id.attach); 

    button.setOnClickListener(new OnClickListener() { 

    @SuppressWarnings("deprecation") 
    @Override 
    public void onClick(View arg0) { 
// TODO Auto-generated method stub 

String txt =MyText.getText().toString(); 
     ... 
AlertDialog alertDialog = new  AlertDialog.Builder(MainActivity.this).create(); 
    ... 

} 

@Override 
public boolean onCreateOptionsMenu(Menu menu) { 
    // Inflate the menu; this adds items to the action bar if it is present. 
    getMenuInflater().inflate(R.menu.activity_main, menu); 
    return true; 
} 

}

+0

Defuke効率 – Antoniossss

+0

私は非常によく@Antoniosssあなたをキャッチしていない、あなたは –

+0

は私が意味*の定義を意味したいと思いますどのような;) – Antoniossss

答えて

0

https://firebase.google.com/docs/storage/android/upload-files

小Sを参照してください

Firebase https://firebase.google.com/

使用FirebaseストレージともFirebaseリアルタイムデータベースを試してみてくださいを拡張上のリンクから十分なコード ローカルファイルからアップロード

カメラの写真やビデオなどのローカルファイルをputFile()メソッドでアップロードできます。 putFile()はFileを受け取り、アップロードのステータスを管理および監視するために使用できるUploadTaskを返します。あなたのケースで

Uri file = Uri.fromFile(new File("path/to/images/rivers.jpg")); 
StorageReference riversRef = storageRef.child("images/"+file.getLastPathSegment()); 
uploadTask = riversRef.putFile(file); 

// Register observers to listen for when the download is done or if it fails 
uploadTask.addOnFailureListener(new OnFailureListener() { 
    @Override 
    public void onFailure(@NonNull Exception exception) { 
     // Handle unsuccessful uploads 
    } 
}).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { 
    @Override 
    public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { 
     // taskSnapshot.getMetadata() contains file metadata such as size, content-type, and download URL. 
     Uri downloadUrl = taskSnapshot.getDownloadUrl(); 
    } 
}); 
+0

FirebaseのためのいくつかのチュートリアルGoogleのhttps://www.udacity.com/course/firebase-essentials-for-android--ud009 –

関連する問題