View写真のキャプチャとプレビューを担当する を書いています。Fragmentを使用する必要がある限り、 を使用して実装していますstartActivityForResult()。
それは私が望むことをしますが、キャプチャした後、これImageを私の中に取得する必要がありますCustomImageView classが、私の問題は、私Fragmentの中からこれを取得できないことです。ViewCustom View
コードは次のとおりです。
CustomImageView:
public class CustomImageView extends LinearLayout {
private LayoutInflater inflater;
private View view;
private CustomFragment frag;
public CustomImageView(Context context, AttributeSet attrs) {
super(context, attrs);
initViews();
}
private void initViews(){
inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.view_imageview, this, true);
// Get Fragment Here . . . .
}
}
view_imageView (CustomImageView xml):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
class="com.example.fragments.CustomFragment"
custom:viewParameter="eg ari ra"
tools:ignore="MissingPrefix" />
</LinearLayout>
だから私FragmentはinitViews()(上でコメントしたように)入る必要がありますが、方法がわかりません。あなたのアイデアを共有してください。
できれば助けてください。前もって感謝します